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

Apply node selector and tolerations to client nodes, and tolerate NoS… #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
4 changes: 3 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
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