diff --git a/cmd/operator/main.go b/cmd/operator/main.go index b2f4cd809..dd85b05a3 100644 --- a/cmd/operator/main.go +++ b/cmd/operator/main.go @@ -61,7 +61,7 @@ func init() { flag.StringVar(&baseImage, "baseImage", "upmcenterprises/docker-elasticsearch-kubernetes:6.1.3_0", "Base image to use when spinning up the elasticsearch components.") flag.StringVar(&kubeCfgFile, "kubecfg-file", "", "Location of kubecfg file for access to kubernetes master service; --kube_master_url overrides the URL part of this; if neither this nor --kube_master_url are provided, defaults to service account tokens") flag.StringVar(&masterHost, "masterhost", "http://127.0.0.1:8001", "Full url to k8s api server") - flag.BoolVar(&enableInitDaemonset, "enableInitDaemonset", true, "Set to false to disable the sysctl init daemonset") + flag.BoolVar(&enableInitDaemonset, "enableInitDaemonset", false, "Set to false to disable the sysctl init daemonset") flag.StringVar(&initDaemonsetNamespace, "initDaemonsetNamespace", "default", "Namespace to deploy the sysctl init daemonset into") flag.StringVar(&busyboxImage, "busybox-image", "busybox:1.26.2", "Image to use for sysctl init daemonset") flag.Parse() diff --git a/pkg/k8sutil/deployments.go b/pkg/k8sutil/deployments.go index c5bcc9557..438b52dda 100644 --- a/pkg/k8sutil/deployments.go +++ b/pkg/k8sutil/deployments.go @@ -171,6 +171,16 @@ func (k *K8sutil) CreateClientDeployment(baseImage string, replicas *int32, java }, Spec: v1.PodSpec{ Affinity: &affinity, + InitContainers: []v1.Container{ + { + Name: "sysctl", + Image: "busybox", + Command: []string{ "sysctl", "-w", "vm.max_map_count=262144"}, + SecurityContext: &v1.SecurityContext{ + Privileged: &[]bool{true}[0], + }, + }, + }, Containers: []v1.Container{ v1.Container{ Name: deploymentName, diff --git a/pkg/k8sutil/k8sutil.go b/pkg/k8sutil/k8sutil.go index c1870d6ab..f2b66ad5a 100644 --- a/pkg/k8sutil/k8sutil.go +++ b/pkg/k8sutil/k8sutil.go @@ -506,7 +506,18 @@ func buildStatefulSet(statefulSetName, clusterName, deploymentType, baseImage, s }, }, }, - }}, + }, + }, + InitContainers: []v1.Container{ + { + Name: "sysctl", + Image: "busybox", + Command: []string{ "sysctl", "-w", "vm.max_map_count=262144"}, + SecurityContext: &v1.SecurityContext{ + Privileged: &[]bool{true}[0], + }, + }, + }, Containers: []v1.Container{ v1.Container{ Name: statefulSetName,