diff --git a/README.md b/README.md index b91a5691b..c45ecf15b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pkg/k8sutil/daemonsets.go b/pkg/k8sutil/daemonsets.go index e9af17882..ae693a104 100644 --- a/pkg/k8sutil/daemonsets.go +++ b/pkg/k8sutil/daemonsets.go @@ -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", diff --git a/pkg/k8sutil/deployments.go b/pkg/k8sutil/deployments.go index 0a1b21882..d369a2fa8 100644 --- a/pkg/k8sutil/deployments.go +++ b/pkg/k8sutil/deployments.go @@ -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) @@ -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{ diff --git a/pkg/processor/processor.go b/pkg/processor/processor.go index be65e2d3d..8ce329287 100644 --- a/pkg/processor/processor.go +++ b/pkg/processor/processor.go @@ -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, @@ -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 }