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

Replaced daemonset with initContainers #304

Open
wants to merge 2 commits 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
2 changes: 1 addition & 1 deletion cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 10 additions & 0 deletions pkg/k8sutil/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 12 additions & 1 deletion pkg/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down