File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,18 @@ func reconcilePodSpec(
299299 sidecarConfig .Image = viper .GetString ("sidecar-image" )
300300 sidecarConfig .ImagePullPolicy = cluster .Spec .ImagePullPolicy
301301 sidecarConfig .StartupProbe = baseProbe .DeepCopy ()
302+ sidecarConfig .SecurityContext = & corev1.SecurityContext {
303+ AllowPrivilegeEscalation : ptr .To (false ),
304+ RunAsNonRoot : ptr .To (true ),
305+ Privileged : ptr .To (false ),
306+ ReadOnlyRootFilesystem : ptr .To (true ),
307+ SeccompProfile : & corev1.SeccompProfile {
308+ Type : corev1 .SeccompProfileTypeRuntimeDefault ,
309+ },
310+ Capabilities : & corev1.Capabilities {
311+ Drop : []corev1.Capability {"ALL" },
312+ },
313+ }
302314
303315 // merge the main container envs if they aren't already set
304316 for _ , container := range spec .Containers {
Original file line number Diff line number Diff line change 1616 labels :
1717 app : barman-cloud
1818 spec :
19+ securityContext :
20+ runAsNonRoot : true
21+ seccompProfile :
22+ type : RuntimeDefault
1923 serviceAccountName : plugin-barman-cloud
2024 containers :
2125 - image : plugin-barman-cloud:latest
4852 - mountPath : /client
4953 name : client
5054 resources : {}
55+ securityContext :
56+ allowPrivilegeEscalation : false
57+ capabilities :
58+ drop :
59+ - ALL
60+ readOnlyRootFilesystem : true
61+ runAsGroup : 10001
62+ runAsUser : 10001
63+ seccompProfile :
64+ type : RuntimeDefault
5165 volumes :
5266 - name : server
5367 secret :
Original file line number Diff line number Diff line change @@ -871,11 +871,25 @@ spec:
871871 tcpSocket :
872872 port : 9090
873873 resources : {}
874+ securityContext :
875+ allowPrivilegeEscalation : false
876+ capabilities :
877+ drop :
878+ - ALL
879+ readOnlyRootFilesystem : true
880+ runAsGroup : 10001
881+ runAsUser : 10001
882+ seccompProfile :
883+ type : RuntimeDefault
874884 volumeMounts :
875885 - mountPath : /server
876886 name : server
877887 - mountPath : /client
878888 name : client
889+ securityContext :
890+ runAsNonRoot : true
891+ seccompProfile :
892+ type : RuntimeDefault
879893 serviceAccountName : plugin-barman-cloud
880894 volumes :
881895 - name : server
You can’t perform that action at this time.
0 commit comments