Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

es-operator + elasticsearch helm charts nodeSelector for k8s mixed clusters #316

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

.PHONY: all build container push clean test

TAG ?= 0.4.0
PREFIX ?= upmcenterprises
TAG ?= 0.4.1
pkgs = $(shell go list ./... | grep -v /vendor/ | grep -v /test/)
# go source files, ignore vendor directory
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Following parameters are available to customize the elastic cluster:
- image: Image to use (Note: Using [custom image](https://github.com/upmc-enterprises/kibana-docker) since upstream has x-pack installed and causes issues)
- cerebro: Deploy [cerebro](https://github.com/lmenezes/cerebro) to cluster and automatically reference certs from secret
- image: Image to use (Note: Using [custom image](https://github.com/upmc-enterprises/cerebro-docker) since upstream has no docker images available)
- nodeSelector: list of k8s NodeSelectors which are applied to the Master Nodes and Data Nodes
- nodeSelector: list of k8s NodeSelectors which are applied to the master, data, and client nodes
- `key: value`
- tolerations: list of k8s Tolerations which are applied to the Master Nodes and Data Nodes
- tolerations: list of k8s Tolerations which are applied to the master, data, and client nodes
- `- effect:` eg: NoSchedule, NoExecute
`key:` eg: somekey
`operator:` eg: exists
Expand Down
Binary file added charts/elasticsearch-0.1.6.tgz
Binary file not shown.
Binary file added charts/elasticsearch-0.1.7.tgz
Binary file not shown.
Binary file added charts/elasticsearch-operator-0.1.4.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion charts/elasticsearch-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart for Elasticsearch operator
name: elasticsearch-operator
version: 0.1.3
version: 0.1.4
sources:
- https://github.com/upmc-enterprises/elasticsearch-operator
maintainers:
Expand Down
4 changes: 4 additions & 0 deletions charts/elasticsearch-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ spec:
timeoutSeconds: 5
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.image.pullSecret }}
imagePullSecrets:
- name: {{ .Values.image.pullSecret }}
Expand Down
2 changes: 2 additions & 0 deletions charts/elasticsearch-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ resources:
memory: 128Mi
rbac:
enabled: false
nodeSelector:
beta.kubernetes.io/os: linux
2 changes: 1 addition & 1 deletion charts/elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart for Elasticsearch cluster
name: elasticsearch
version: 0.1.5
version: 0.1.7
sources:
- https://github.com/upmc-enterprises/elasticsearch-operator
maintainers:
Expand Down
3 changes: 3 additions & 0 deletions charts/elasticsearch/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
{{- else }}
zones: []
{{- end }}
master-volume-size: {{ .Values.masterVolumeSize }}
data-volume-size: {{ .Values.dataVolumeSize }}
java-options: {{ .Values.javaOpts }}
{{- if .Values.image.pullSecret }}
Expand Down Expand Up @@ -57,3 +58,5 @@ spec:
{{- end }}
resources:
{{ toYaml .Values.resources | indent 4 }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 4 }}
3 changes: 3 additions & 0 deletions charts/elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ resources:
limits:
memory: 1024Mi
cpu: '1'

nodeSelector:
beta.kubernetes.io/os: linux
66 changes: 54 additions & 12 deletions charts/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,37 @@ apiVersion: v1
entries:
elasticsearch:
- apiVersion: v1
created: 2018-10-16T10:12:02.694717502+02:00
created: "2019-08-09T11:48:21.462343+01:00"
description: A Helm chart for Elasticsearch cluster
digest: b9f9f433a766156b870cff56d81657159376029d10024ffd4df57f2d1954291c
digest: 643d5c803963b18edfe18b15d557cc71d4e3e0e9cf988c6426d7972714638c5b
maintainers:
- email: [email protected]
name: komljen
url: https://akomljen.com
name: elasticsearch
sources:
- https://github.com/upmc-enterprises/elasticsearch-operator
urls:
- elasticsearch-0.1.7.tgz
version: 0.1.7
- apiVersion: v1
created: "2019-08-09T11:48:21.46212+01:00"
description: A Helm chart for Elasticsearch cluster
digest: caebb410909e560ec9664d1d7f2af6be57532b4c3eebbaad6c5a837f8344985d
maintainers:
- email: [email protected]
name: komljen
url: https://akomljen.com
name: elasticsearch
sources:
- https://github.com/upmc-enterprises/elasticsearch-operator
urls:
- elasticsearch-0.1.6.tgz
version: 0.1.6
- apiVersion: v1
created: "2019-08-09T11:48:21.461535+01:00"
description: A Helm chart for Elasticsearch cluster
digest: 9920b21e981186f20195c4c8871da7d3872527df269d990ab57fffcec3014cf1
maintainers:
- email: [email protected]
name: komljen
Expand All @@ -16,7 +44,7 @@ entries:
- elasticsearch-0.1.5.tgz
version: 0.1.5
- apiVersion: v1
created: 2018-10-16T10:12:02.694270824+02:00
created: "2019-08-09T11:48:21.461231+01:00"
description: A Helm chart for Elasticsearch cluster
digest: 3437e67980b4369ae18d10bbb64ad62b9e6af6da0d11dc79628d39ce00ba06fa
maintainers:
Expand All @@ -30,7 +58,7 @@ entries:
- elasticsearch-0.1.4.tgz
version: 0.1.4
- apiVersion: v1
created: 2018-10-16T10:12:02.692837786+02:00
created: "2019-08-09T11:48:21.460186+01:00"
description: A Helm chart for Elasticsearch cluster
digest: 2dee389105b87cfaf0150f4215f927bcb79c22f877e801850419a17284191343
maintainers:
Expand All @@ -44,7 +72,7 @@ entries:
- elasticsearch-0.1.3.tgz
version: 0.1.3
- apiVersion: v1
created: 2018-10-16T10:12:02.69122185+02:00
created: "2019-08-09T11:48:21.459669+01:00"
description: A Helm chart for Elasticsearch cluster
digest: 398bcb148fe08fe7ae0d5918af25efd28fe60fd77f47ae2760f1347643d76aab
maintainers:
Expand All @@ -58,7 +86,7 @@ entries:
- elasticsearch-0.1.2.tgz
version: 0.1.2
- apiVersion: v1
created: 2018-10-16T10:12:02.68975502+02:00
created: "2019-08-09T11:48:21.459067+01:00"
description: A Helm chart for Elasticsearch cluster
digest: de2209bffb7a05c436354b2514abadacb83007dd0d59941cb78b340c6db9cc52
maintainers:
Expand All @@ -72,7 +100,7 @@ entries:
- elasticsearch-0.1.1.tgz
version: 0.1.1
- apiVersion: v1
created: 2018-10-16T10:12:02.688211831+02:00
created: "2019-08-09T11:48:21.458516+01:00"
description: A Helm chart for Elasticsearch cluster
digest: 37bc0b51a58e73e29221062df665ce7234f36689dc7051164141680b6c0096bd
maintainers:
Expand All @@ -86,7 +114,21 @@ entries:
version: 0.1.0
elasticsearch-operator:
- apiVersion: v1
created: 2018-10-16T10:12:02.698275452+02:00
created: "2019-08-09T11:48:21.464539+01:00"
description: A Helm chart for Elasticsearch operator
digest: b0097f1f8f70d7dc5230ab9f75569eb6894198ac0b9dd6ef3fc668cec9b1cb7e
maintainers:
- email: [email protected]
name: komljen
url: https://akomljen.com
name: elasticsearch-operator
sources:
- https://github.com/upmc-enterprises/elasticsearch-operator
urls:
- elasticsearch-operator-0.1.4.tgz
version: 0.1.4
- apiVersion: v1
created: "2019-08-09T11:48:21.464283+01:00"
description: A Helm chart for Elasticsearch operator
digest: 07a48f24d2a1e86e41acfb427a4e479b35067042a48385bd4df2caa7b38d9787
maintainers:
Expand All @@ -100,7 +142,7 @@ entries:
- elasticsearch-operator-0.1.3.tgz
version: 0.1.3
- apiVersion: v1
created: 2018-10-16T10:12:02.698057822+02:00
created: "2019-08-09T11:48:21.463831+01:00"
description: A Helm chart for Elasticsearch operator
digest: bf9e1bf0f857acdbb281ac2480add1f5a9d33b303e3cba4fffdc6921cbf27f5f
maintainers:
Expand All @@ -114,7 +156,7 @@ entries:
- elasticsearch-operator-0.1.2.tgz
version: 0.1.2
- apiVersion: v1
created: 2018-10-16T10:12:02.697636392+02:00
created: "2019-08-09T11:48:21.463377+01:00"
description: A Helm chart for Elasticsearch operator
digest: 65b48cf707f5bd8170a22f4827236c36591dde215712b29a8df0136e64d57a49
maintainers:
Expand All @@ -128,7 +170,7 @@ entries:
- elasticsearch-operator-0.1.1.tgz
version: 0.1.1
- apiVersion: v1
created: 2018-10-16T10:12:02.69527483+02:00
created: "2019-08-09T11:48:21.462871+01:00"
description: A Helm chart for Elasticsearch operator
digest: 1c21e32521c3843f04e38892ea432a2529d819019f7bb919cc48bedf9a629400
maintainers:
Expand All @@ -140,4 +182,4 @@ entries:
urls:
- elasticsearch-operator-0.1.0.tgz
version: 0.1.0
generated: 2018-10-16T10:12:02.683509122+02:00
generated: "2019-08-09T11:48:21.457456+01:00"
2 changes: 1 addition & 1 deletion cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import (
)

var (
appVersion = "0.4.0"
appVersion = "0.4.1"

printVersion bool
baseImage string
Expand Down
6 changes: 6 additions & 0 deletions pkg/k8sutil/daemonsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ func (k *K8sutil) CreateNodeInitDaemonset() error {
NodeSelector: map[string]string{
"beta.kubernetes.io/os": "linux",
},
Tolerations: []v1.Toleration{
{
Effect: "NoSchedule",
Operator: "Exists",
},
},
Containers: []v1.Container{
v1.Container{
Name: "sysctl-conf",
Expand Down
10 changes: 9 additions & 1 deletion pkg/k8sutil/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (k *K8sutil) DeleteDeployment(clusterName, namespace, deploymentType string

// CreateClientDeployment creates the client deployment
func (k *K8sutil) CreateClientDeployment(baseImage string, replicas *int32, javaOptions, clientJavaOptions string,
resources myspec.Resources, imagePullSecrets []myspec.ImagePullSecrets, imagePullPolicy, serviceAccountName, clusterName, statsdEndpoint, networkHost, namespace string, useSSL *bool, affinity v1.Affinity, annotations map[string]string) error {
resources myspec.Resources, imagePullSecrets []myspec.ImagePullSecrets, imagePullPolicy, serviceAccountName, clusterName, statsdEndpoint, networkHost, namespace string, useSSL *bool, affinity v1.Affinity, annotations map[string]string, nodeSelector map[string]string, tolerations []v1.Toleration) error {

component := fmt.Sprintf("elasticsearch-%s", clusterName)
discoveryServiceNameCluster := fmt.Sprintf("%s-%s", discoveryServiceName, clusterName)
Expand Down Expand Up @@ -171,6 +171,8 @@ func (k *K8sutil) CreateClientDeployment(baseImage string, replicas *int32, java
Annotations: annotations,
},
Spec: v1.PodSpec{
Tolerations: tolerations,
NodeSelector: nodeSelector,
Affinity: &affinity,
Containers: []v1.Container{
v1.Container{
Expand Down Expand Up @@ -405,6 +407,9 @@ func (k *K8sutil) CreateKibanaDeployment(baseImage, clusterName, namespace strin
},
},
Spec: v1.PodSpec{
NodeSelector: map[string]string{
"beta.kubernetes.io/os": "linux",
},
Containers: []v1.Container{
v1.Container{
Name: deploymentName,
Expand Down Expand Up @@ -538,6 +543,9 @@ func (k *K8sutil) CreateCerebroDeployment(baseImage, clusterName, namespace, cer
},
},
Spec: v1.PodSpec{
NodeSelector: map[string]string{
"beta.kubernetes.io/os": "linux",
},
Containers: []v1.Container{
{
Name: deploymentName,
Expand Down
4 changes: 2 additions & 2 deletions pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (p *Processor) refreshClusters() error {
DataNodeReplicas: cluster.Spec.DataNodeReplicas,
Zones: cluster.Spec.Zones,
DataDiskSize: cluster.Spec.DataDiskSize,
MasterDiskSize: cluster.Spec.MasterDiskSize,
MasterDiskSize: cluster.Spec.MasterDiskSize,
JavaOptions: cluster.Spec.JavaOptions,
ClientJavaOptions: cluster.Spec.ClientJavaOptions,
DataJavaOptions: cluster.Spec.DataJavaOptions,
Expand Down Expand Up @@ -375,7 +375,7 @@ func (p *Processor) processElasticSearchCluster(c *myspec.ElasticsearchCluster)
}

if err := p.k8sclient.CreateClientDeployment(baseImage, &c.Spec.ClientNodeReplicas, c.Spec.JavaOptions, c.Spec.ClientJavaOptions,
c.Spec.Resources, c.Spec.ImagePullSecrets, c.Spec.ImagePullPolicy, c.Spec.ServiceAccountName, c.ObjectMeta.Name, c.Spec.Instrumentation.StatsdHost, c.Spec.NetworkHost, c.ObjectMeta.Namespace, c.Spec.UseSSL, c.Spec.Affinity, c.Spec.Annotations); err != nil {
c.Spec.Resources, c.Spec.ImagePullSecrets, c.Spec.ImagePullPolicy, c.Spec.ServiceAccountName, c.ObjectMeta.Name, c.Spec.Instrumentation.StatsdHost, c.Spec.NetworkHost, c.ObjectMeta.Namespace, c.Spec.UseSSL, c.Spec.Affinity, c.Spec.Annotations, c.Spec.NodeSelector, c.Spec.Tolerations); err != nil {
logrus.Error("Error creating client deployment ", err)
return err
}
Expand Down