@@ -70,10 +70,6 @@ func (r *LightrunJavaAgentReconciler) patchDeployment(lightrunJavaAgent *agentv1
7070 if err != nil {
7171 return err
7272 }
73- deploymentApplyConfig .Spec .Template .Spec .WithSecurityContext (
74- corev1ac .PodSecurityContext ().
75- WithFSGroup (1000 ),
76- )
7773 return nil
7874}
7975
@@ -157,10 +153,17 @@ func (r *LightrunJavaAgentReconciler) addInitContainer(deploymentApplyConfig *ap
157153 WithEnv (envVars ... ).
158154 WithSecurityContext (
159155 corev1ac .SecurityContext ().
160- WithReadOnlyRootFilesystem (true ).
161- WithAllowPrivilegeEscalation (false ).
156+ WithCapabilities (
157+ corev1ac .Capabilities ().
158+ WithDrop (corev1 .Capability ("ALL" )),
159+ ).
162160 WithRunAsNonRoot (true ).
163- WithRunAsUser (1000 ),
161+ WithAllowPrivilegeEscalation (false ).
162+ WithReadOnlyRootFilesystem (true ).
163+ WithSeccompProfile (
164+ corev1ac .SeccompProfile ().
165+ WithType (corev1 .SeccompProfileTypeRuntimeDefault ),
166+ ),
164167 ).
165168 WithResources (
166169 corev1ac .ResourceRequirements ().
@@ -359,10 +362,17 @@ func (r *LightrunJavaAgentReconciler) addInitContainerToStatefulSet(statefulSetA
359362 WithEnv (envVars ... ).
360363 WithSecurityContext (
361364 corev1ac .SecurityContext ().
362- WithReadOnlyRootFilesystem (true ).
363- WithAllowPrivilegeEscalation (false ).
365+ WithCapabilities (
366+ corev1ac .Capabilities ().
367+ WithDrop (corev1 .Capability ("ALL" )),
368+ ).
364369 WithRunAsNonRoot (true ).
365- WithRunAsUser (1000 ),
370+ WithAllowPrivilegeEscalation (false ).
371+ WithReadOnlyRootFilesystem (true ).
372+ WithSeccompProfile (
373+ corev1ac .SeccompProfile ().
374+ WithType (corev1 .SeccompProfileTypeRuntimeDefault ),
375+ ),
366376 ).
367377 WithResources (
368378 corev1ac .ResourceRequirements ().
@@ -392,7 +402,7 @@ func (r *LightrunJavaAgentReconciler) patchStatefulSetAppContainers(lightrunJava
392402 WithName (container .Name ).
393403 WithImage (container .Image ).
394404 WithVolumeMounts (
395- corev1ac .VolumeMount ().WithName (lightrunJavaAgent .Spec .InitContainer .SharedVolumeName ). WithMountPath (lightrunJavaAgent .Spec .InitContainer .SharedVolumeMountPath ),
405+ corev1ac .VolumeMount ().WithMountPath (lightrunJavaAgent .Spec .InitContainer .SharedVolumeMountPath ). WithName (lightrunJavaAgent .Spec .InitContainer .SharedVolumeName ),
396406 ),
397407 )
398408 }
0 commit comments