Skip to content

Commit 31296d0

Browse files
committed
Merge pull request #70 from ewolinetz/rfe_62
Allow ability to specify node selectors for ES, Kibana and Curator with deployer
2 parents 87f2e44 + 354d007 commit 31296d0

File tree

4 files changed

+97
-9
lines changed

4 files changed

+97
-9
lines changed

deployment/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ are available:
144144
* `ES_INSTANCE_RAM`: Amount of RAM to reserve per ElasticSearch instance (e.g. 1024M, 2G). Defaults to 8GB; must be at least 512M (Ref.: [ElasticSearch documentation](https://www.elastic.co/guide/en/elasticsearch/guide/current/hardware.html#_memory).
145145
* `ES_CLUSTER_SIZE` (required): How many instances of ElasticSearch to deploy. At least 3 are needed for redundancy, and more can be used for scaling.
146146
* `FLUENTD_NODESELECTOR`: The nodeSelector to use for the Fluentd DaemonSet. Defaults to "logging-infra-fluentd=true".
147+
* `ES_NODESELECTOR`: Specify the nodeSelector that Elasticsearch should be use (label=value)
148+
* `KIBANA_NODESELECTOR`: Specify the nodeSelector that Kibana should be use (label=value)
149+
* `CURATOR_NODESELECTOR`: Specify the nodeSelector that Curator should be use (label=value)
147150
* `ENABLE_OPS_CLUSTER`: If "true", configure a second ES cluster and Kibana for ops logs. (See [below](#ops-cluster) for details.)
148-
* `KIBANA_OPS_HOSTNAME`, `ES_OPS_INSTANCE_RAM`, `ES_OPS_CLUSTER_SIZE`: Parallel parameters for the ops log cluster.
151+
* `KIBANA_OPS_HOSTNAME`, `ES_OPS_INSTANCE_RAM`, `ES_OPS_CLUSTER_SIZE`, `ES_OPS_NODESELECTOR`, `KIBANA_OPS_NODESELECTOR`, `CURATOR_OPS_NODESELECTOR`: Parallel parameters for the ops log cluster.
149152

150153
You run the deployer by instantiating a template. Here is an example with some parameters:
151154

@@ -256,6 +259,10 @@ to each other. You will likely want to direct the instances to dedicated
256259
nodes, or a dedicated region in your cluster. You can do this by supplying
257260
a node selector in each deployment.
258261

262+
The deployer has options to specify a nodeSelector label for Elasticsearch, Kibana
263+
and curator. If you have already deployed the EFK stack or would like to change
264+
your current nodeSelector labels, see below.
265+
259266
There is no helpful command for adding a node selector. You will need to
260267
`oc edit` each DeploymentConfig and add the `nodeSelector` element to specify
261268
the label corresponding to your desired nodes, e.g.:

deployment/deployer.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ objects:
7171
value: ${ES_OPS_RECOVER_AFTER_TIME}
7272
- name: FLUENTD_NODESELECTOR
7373
value: ${FLUENTD_NODESELECTOR}
74+
- name: ES_NODESELECTOR
75+
value: ${ES_NODESELECTOR}
76+
- name: ES_OPS_NODESELECTOR
77+
value: ${ES_OPS_NODESELECTOR}
78+
- name: KIBANA_NODESELECTOR
79+
value: ${KIBANA_NODESELECTOR}
80+
- name: KIBANA_OPS_NODESELECTOR
81+
value: ${KIBANA_OPS_NODESELECTOR}
82+
- name: CURATOR_NODESELECTOR
83+
value: ${CURATOR_NODESELECTOR}
84+
- name: CURATOR_OPS_NODESELECTOR
85+
value: ${CURATOR_OPS_NODESELECTOR}
7486
dnsPolicy: ClusterFirst
7587
restartPolicy: Never
7688
serviceAccount: logging-deployer
@@ -154,3 +166,27 @@ parameters:
154166
description: "The nodeSelector used for the Fluentd DaemonSet."
155167
name: FLUENTD_NODESELECTOR
156168
value: "logging-infra-fluentd=true"
169+
-
170+
description: "Node selector Elasticsearch cluster (label=value)."
171+
name: ES_NODESELECTOR
172+
value: ""
173+
-
174+
description: "Node selector Elasticsearch operations cluster (label=value)."
175+
name: ES_OPS_NODESELECTOR
176+
value: ""
177+
-
178+
description: "Node selector Kibana cluster (label=value)."
179+
name: KIBANA_NODESELECTOR
180+
value: ""
181+
-
182+
description: "Node selector Kibana operations cluster (label=value)."
183+
name: KIBANA_OPS_NODESELECTOR
184+
value: ""
185+
-
186+
description: "Node selector Curator (label=value)."
187+
name: CURATOR_NODESELECTOR
188+
value: ""
189+
-
190+
description: "Node selector operations Curator (label=value)."
191+
name: CURATOR_OPS_NODESELECTOR
192+
value: ""

deployment/run.sh

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ function extract_nodeselector() {
5353
fi
5454
}
5555

56+
# node selectors
5657
fluentd_nodeselector=$(extract_nodeselector $FLUENTD_NODESELECTOR)
58+
es_nodeselector=$(extract_nodeselector $ES_NODESELECTOR)
59+
es_ops_nodeselector=$(extract_nodeselector $ES_OPS_NODESELECTOR)
60+
kibana_nodeselector=$(extract_nodeselector $KIBANA_NODESELECTOR)
61+
kibana_ops_nodeselector=$(extract_nodeselector $KIBANA_OPS_NODESELECTOR)
62+
curator_nodeselector=$(extract_nodeselector $CURATOR_NODESELECTOR)
63+
curator_ops_nodeselector=$(extract_nodeselector $CURATOR_OPS_NODESELECTOR)
5764

5865
if [ "${KEEP_SUPPORT}" != true ]; then
5966
# this fails in the container, but it's useful for dev
@@ -210,21 +217,60 @@ es_ops_params=$(join , \
210217
ES_RECOVER_AFTER_TIME=${es_ops_recover_after_time} \
211218
)
212219

213-
oc process -f templates/es.yaml -v "${es_params}" | oc create -f -
220+
if [[ -n "${ES_NODESELECTOR}" ]]; then
221+
sed "/serviceAccountName/ i\
222+
\ ${es_nodeselector}" templates/es.yaml | oc process -v "${es_params}" -f - | oc create -f -
223+
else
224+
oc process -f templates/es.yaml -v "${es_params}" | oc create -f -
225+
fi
226+
214227
es_host=logging-es
215228
es_ops_host=${es_host}
216-
oc process -f templates/kibana.yaml -v "OAP_PUBLIC_MASTER_URL=${public_master_url},OAP_MASTER_URL=${master_url}" | oc create -f -
217-
oc process -f templates/curator.yaml -v "ES_HOST=${es_host},MASTER_URL=${master_url},CURATOR_DEPLOY_NAME=curator"| oc create -f -
229+
230+
if [[ -n "${KIBANA_NODESELECTOR}" ]]; then
231+
sed "/serviceAccountName/ i\
232+
\ ${kibana_nodeselector}" templates/kibana.yaml | oc process -v "OAP_PUBLIC_MASTER_URL=${public_master_url},OAP_MASTER_URL=${master_url}" | oc create -f -
233+
else
234+
oc process -f templates/kibana.yaml -v "OAP_PUBLIC_MASTER_URL=${public_master_url},OAP_MASTER_URL=${master_url}" | oc create -f -
235+
fi
236+
237+
if [[ -n "${CURATOR_NODESELECTOR}" ]]; then
238+
sed "/serviceAccountName/ i\
239+
\ ${curator_nodeselector}" templates/curator.yaml | oc process -v "ES_HOST=${es_host},MASTER_URL=${master_url},CURATOR_DEPLOY_NAME=curator"| oc create -f -
240+
else
241+
oc process -f templates/curator.yaml -v "ES_HOST=${es_host},MASTER_URL=${master_url},CURATOR_DEPLOY_NAME=curator"| oc create -f -
242+
fi
243+
218244
if [ "${ENABLE_OPS_CLUSTER}" == true ]; then
219-
oc process -f templates/es.yaml -v "${es_ops_params}" | oc create -f -
245+
246+
if [[ -n "${ES_OPS_NODESELECTOR}" ]]; then
247+
sed "/serviceAccountName/ i\
248+
\ ${es_ops_nodeselector}" templates/es.yaml | oc process -v "${es_ops_params}" -f - | oc create -f -
249+
else
250+
oc process -f templates/es.yaml -v "${es_ops_params}" | oc create -f -
251+
fi
252+
220253
es_ops_host=logging-es-ops
221-
oc process -f templates/kibana.yaml -v "OAP_PUBLIC_MASTER_URL=${public_master_url},OAP_MASTER_URL=${master_url},KIBANA_DEPLOY_NAME=kibana-ops,ES_HOST=${es_ops_host}" | oc create -f -
222-
oc process -f templates/curator.yaml -v "ES_HOST=${es_ops_host},MASTER_URL=${master_url},CURATOR_DEPLOY_NAME=curator-ops"| oc create -f -
254+
255+
if [[ -n "${KIBANA_OPS_NODESELECTOR}" ]]; then
256+
sed "/serviceAccountName/ i\
257+
\ ${kibana_ops_nodeselector}" templates/kibana.yaml | oc process -v "OAP_PUBLIC_MASTER_URL=${public_master_url},OAP_MASTER_URL=${master_url},KIBANA_DEPLOY_NAME=kibana-ops,ES_HOST=${es_ops_host}" | oc create -f -
258+
else
259+
oc process -f templates/kibana.yaml -v "OAP_PUBLIC_MASTER_URL=${public_master_url},OAP_MASTER_URL=${master_url},KIBANA_DEPLOY_NAME=kibana-ops,ES_HOST=logging-es-ops" | oc create -f -
260+
fi
261+
262+
if [[ -n "${CURATOR_OPS_NODESELECTOR}" ]]; then
263+
sed "/serviceAccountName/ i\
264+
\ ${curator_ops_nodeselector}" templates/curator.yaml | oc process -v "ES_HOST=${es_ops_host},MASTER_URL=${master_url},CURATOR_DEPLOY_NAME=curator-ops"| oc create -f -
265+
else
266+
oc process -f templates/curator.yaml -v "ES_HOST=${es_ops_host},MASTER_URL=${master_url},CURATOR_DEPLOY_NAME=curator-ops"| oc create -f -
267+
fi
268+
223269
fi
224270

225271
if [[ -n "${FLUENTD_NODESELECTOR}" ]]; then
226272
sed "/serviceAccountName/ i\
227-
\ $fluentd_nodeselector" templates/fluentd.yaml | oc process -v "ES_HOST=${es_host},OPS_HOST=${es_ops_host},MASTER_URL=${master_url},IMAGE_PREFIX=${image_prefix},IMAGE_VERSION=${image_version}" -f - | oc create -f -
273+
\ ${fluentd_nodeselector}" templates/fluentd.yaml | oc process -v "ES_HOST=${es_host},OPS_HOST=${es_ops_host},MASTER_URL=${master_url},IMAGE_PREFIX=${image_prefix},IMAGE_VERSION=${image_version}" -f - | oc create -f -
228274
else
229275
oc process -f templates/fluentd.yaml -v "ES_HOST=${es_host},OPS_HOST=${es_ops_host},MASTER_URL=${master_url},IMAGE_PREFIX=${image_prefix},IMAGE_VERSION=${image_version}"| oc create -f -
230276
fi

deployment/templates/es.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,3 @@ parameters:
141141
- name: ES_RECOVER_AFTER_NODES
142142
- name: ES_RECOVER_EXPECTED_NODES
143143
- name: ES_RECOVER_AFTER_TIME
144-

0 commit comments

Comments
 (0)