From a309423324a3f5cfcdb1a46d488248e103709432 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Mon, 27 May 2019 09:09:42 +0200 Subject: [PATCH] Create SecurityContext if nil --- pkg/k8sops/statefulset.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/k8sops/statefulset.go b/pkg/k8sops/statefulset.go index 6c872d42..815e10ba 100644 --- a/pkg/k8sops/statefulset.go +++ b/pkg/k8sops/statefulset.go @@ -93,6 +93,9 @@ func NewBaseStatefulSet(ssName, isolationGroup string, cluster *myspec.M3DBClust // Add SYS_RESOURCE security capability if not set (required to raise // rlimit nofile from the process in container) specSecurityCtx := cluster.Spec.SecurityContext + if specSecurityCtx == nil { + specSecurityCtx = &v1.SecurityContext{} + } if specSecurityCtx.Capabilities == nil { specSecurityCtx.Capabilities = &v1.Capabilities{} }