Skip to content

Commit 538bd23

Browse files
authored
OADP-5275 init plugin containers to have read only fs (#1752)
This adds ReadOnlyRootFilesystem to the init containers (plugins) Also additional security context flags are applied to ensure the init containers are using: - Privileged: false - AllowPrivilegeEscalation: false - ReadOnlyRootFilesystem: true Signed-off-by: Michal Pryc <[email protected]>
1 parent 7bfc030 commit 538bd23

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

internal/controller/velero.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,11 @@ func (r *DataProtectionApplicationReconciler) appendPluginSpecificSpecs(veleroDe
464464
Name: "plugins",
465465
},
466466
},
467+
SecurityContext: &corev1.SecurityContext{
468+
ReadOnlyRootFilesystem: ptr.To(true),
469+
Privileged: ptr.To(false),
470+
AllowPrivilegeEscalation: ptr.To(false),
471+
},
467472
})
468473

469474
pluginNeedsCheck := providerNeedsDefaultCreds[pluginSpecificMap.ProviderName]
@@ -529,6 +534,11 @@ func (r *DataProtectionApplicationReconciler) appendPluginSpecificSpecs(veleroDe
529534
Name: "plugins",
530535
},
531536
},
537+
SecurityContext: &corev1.SecurityContext{
538+
ReadOnlyRootFilesystem: ptr.To(true),
539+
Privileged: ptr.To(false),
540+
AllowPrivilegeEscalation: ptr.To(false),
541+
},
532542
})
533543
}
534544
}

internal/controller/velero_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ var _ = ginkgo.Describe("Test ReconcileVeleroDeployment function", func() {
323323

324324
func pluginContainer(name, image string) corev1.Container {
325325
container := baseContainer
326+
container.SecurityContext = &corev1.SecurityContext{
327+
ReadOnlyRootFilesystem: ptr.To(true),
328+
Privileged: ptr.To(false),
329+
AllowPrivilegeEscalation: ptr.To(false),
330+
}
326331
container.Name = name
327332
container.Image = image
328333
return container

0 commit comments

Comments
 (0)