@@ -293,6 +293,9 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name, opmImg, utilImage, img s
293
293
Args : []string {"/bin/copy-content" , fmt .Sprintf ("%s/copy-content" , utilitiesPath )},
294
294
VolumeMounts : []corev1.VolumeMount {utilitiesVolumeMount },
295
295
TerminationMessagePolicy : corev1 .TerminationMessageFallbackToLogsOnError ,
296
+ SecurityContext : & corev1.SecurityContext {
297
+ ReadOnlyRootFilesystem : ptr .To (true ),
298
+ },
296
299
}, corev1.Container {
297
300
Name : "extract-content" ,
298
301
Image : img ,
@@ -301,8 +304,12 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name, opmImg, utilImage, img s
301
304
Args : extractArgs ,
302
305
VolumeMounts : []corev1.VolumeMount {utilitiesVolumeMount , contentVolumeMount },
303
306
TerminationMessagePolicy : corev1 .TerminationMessageFallbackToLogsOnError ,
307
+ SecurityContext : & corev1.SecurityContext {
308
+ ReadOnlyRootFilesystem : ptr .To (true ),
309
+ },
304
310
})
305
311
312
+ pod .Spec .Containers [0 ].SecurityContext .ReadOnlyRootFilesystem = ptr .To (true )
306
313
pod .Spec .Containers [0 ].Image = opmImg
307
314
pod .Spec .Containers [0 ].Command = []string {"/bin/opm" }
308
315
pod .Spec .Containers [0 ].ImagePullPolicy = image .InferImagePullPolicy (opmImg )
@@ -371,7 +378,6 @@ func addSecurityContext(pod *corev1.Pod, runAsUser int64) {
371
378
pod .Spec .InitContainers [i ].SecurityContext = & corev1.SecurityContext {}
372
379
}
373
380
pod .Spec .InitContainers [i ].SecurityContext .AllowPrivilegeEscalation = ptr .To (false )
374
- pod .Spec .InitContainers [i ].SecurityContext .ReadOnlyRootFilesystem = pod .Spec .SecurityContext .RunAsNonRoot
375
381
pod .Spec .InitContainers [i ].SecurityContext .Capabilities = & corev1.Capabilities {
376
382
Drop : []corev1.Capability {"ALL" },
377
383
}
@@ -381,7 +387,6 @@ func addSecurityContext(pod *corev1.Pod, runAsUser int64) {
381
387
pod .Spec .Containers [i ].SecurityContext = & corev1.SecurityContext {}
382
388
}
383
389
pod .Spec .Containers [i ].SecurityContext .AllowPrivilegeEscalation = ptr .To (false )
384
- pod .Spec .Containers [i ].SecurityContext .ReadOnlyRootFilesystem = pod .Spec .SecurityContext .RunAsNonRoot
385
390
pod .Spec .Containers [i ].SecurityContext .Capabilities = & corev1.Capabilities {
386
391
Drop : []corev1.Capability {"ALL" },
387
392
}
0 commit comments