@@ -35,7 +35,7 @@ import (
3535
3636const (
3737 // ServiceCommand -
38- ServiceCommand = "/usr/local/bin/kolla_set_configs && /usr/local/bin/ kolla_start"
38+ ServiceCommand = "/usr/local/bin/kolla_start"
3939 // CentralHCScript is the path to the central health check script
4040 CentralHCScript = "/var/lib/openstack/bin/centralhealth.py"
4141 // NotificationHCScript is the path to the notification health check script
@@ -49,7 +49,7 @@ func StatefulSet(
4949 labels map [string ]string ,
5050 topology * topologyv1.Topology ,
5151) (* appsv1.StatefulSet , error ) {
52- runAsUser := int64 (0 )
52+ ceilometerUser := int64 (CeilometerUserID )
5353
5454 // container probes
5555 sgRootEndpointCurl := corev1.HTTPGetAction {
@@ -141,13 +141,10 @@ func StatefulSet(
141141 Command : []string {
142142 "/bin/bash" ,
143143 },
144- Args : args ,
145- Image : instance .Spec .CentralImage ,
146- Name : "ceilometer-central-agent" ,
147- Env : env .MergeEnvs ([]corev1.EnvVar {}, envVarsCentral ),
148- SecurityContext : & corev1.SecurityContext {
149- RunAsUser : & runAsUser ,
150- },
144+ Args : args ,
145+ Image : instance .Spec .CentralImage ,
146+ Name : "ceilometer-central-agent" ,
147+ Env : env .MergeEnvs ([]corev1.EnvVar {}, envVarsCentral ),
151148 VolumeMounts : centralVolumeMounts ,
152149 LivenessProbe : centralLivenessProbe ,
153150 }
@@ -156,32 +153,31 @@ func StatefulSet(
156153 Command : []string {
157154 "/bin/bash" ,
158155 },
159- Args : args ,
160- Image : instance .Spec .NotificationImage ,
161- Name : "ceilometer-notification-agent" ,
162- Env : env .MergeEnvs ([]corev1.EnvVar {}, envVarsNotification ),
163- SecurityContext : & corev1.SecurityContext {
164- RunAsUser : & runAsUser ,
165- },
156+ Args : args ,
157+ Image : instance .Spec .NotificationImage ,
158+ Name : "ceilometer-notification-agent" ,
159+ Env : env .MergeEnvs ([]corev1.EnvVar {}, envVarsNotification ),
166160 VolumeMounts : notificationVolumeMounts ,
167161 LivenessProbe : notificationLivenessProbe ,
168162 }
169163 sgCoreContainer := corev1.Container {
170164 ImagePullPolicy : corev1 .PullAlways ,
171165 Image : instance .Spec .SgCoreImage ,
172166 Name : "sg-core" ,
167+ VolumeMounts : getSgCoreVolumeMounts (),
173168 SecurityContext : & corev1.SecurityContext {
174- RunAsUser : & runAsUser ,
169+ AllowPrivilegeEscalation : ptr .To (false ),
170+ Capabilities : & corev1.Capabilities {
171+ Drop : []corev1.Capability {
172+ "ALL" ,
173+ },
174+ },
175175 },
176- VolumeMounts : getSgCoreVolumeMounts (),
177176 }
178177 proxyContainer := corev1.Container {
179178 ImagePullPolicy : corev1 .PullAlways ,
180179 Image : instance .Spec .ProxyImage ,
181180 Name : "proxy-httpd" ,
182- SecurityContext : & corev1.SecurityContext {
183- RunAsUser : & runAsUser ,
184- },
185181 Ports : []corev1.ContainerPort {{
186182 ContainerPort : int32 (CeilometerPrometheusPort ),
187183 Name : "proxy-httpd" ,
@@ -191,6 +187,14 @@ func StatefulSet(
191187 LivenessProbe : sgLivenessProbe ,
192188 Command : []string {"/usr/sbin/httpd" },
193189 Args : []string {"-DFOREGROUND" },
190+ SecurityContext : & corev1.SecurityContext {
191+ AllowPrivilegeEscalation : ptr .To (false ),
192+ Capabilities : & corev1.Capabilities {
193+ Drop : []corev1.Capability {
194+ "ALL" ,
195+ },
196+ },
197+ },
194198 }
195199
196200 pod := corev1.PodTemplateSpec {
@@ -207,6 +211,12 @@ func StatefulSet(
207211 sgCoreContainer ,
208212 proxyContainer ,
209213 },
214+ SecurityContext : & corev1.PodSecurityContext {
215+ RunAsUser : & ceilometerUser ,
216+ RunAsGroup : & ceilometerUser ,
217+ RunAsNonRoot : ptr .To (true ),
218+ FSGroup : & ceilometerUser ,
219+ },
210220 },
211221 }
212222
0 commit comments