Skip to content

Commit

Permalink
fix(snitch): use DirectoryOrCreate for apparmor mount in Snitch
Browse files Browse the repository at this point in the history
AppArmor mount is optional in snitch, we should move to creating the directory to aviod deployment failures

Signed-off-by: daemon1024 <[email protected]>
  • Loading branch information
daemon1024 committed Jun 24, 2024
1 parent 9ce5979 commit 7e9f139
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/KubeArmorOperator/common/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ var ContainerRuntimeSocketMap = map[string][]string{
}

var HostPathDirectory = corev1.HostPathDirectory
var HostPathDirectoryOrCreate = corev1.HostPathDirectoryOrCreate
var HostPathSocket = corev1.HostPathSocket
var HostPathFile = corev1.HostPathFile

Expand Down
5 changes: 2 additions & 3 deletions pkg/KubeArmorOperator/internal/controller/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ func genSnitchServiceAccount() *corev1.ServiceAccount {

func deploySnitch(nodename string, runtime string) *batchv1.Job {
job := batchv1.Job{}
var HostPathDirectoryOrCreate = corev1.HostPathDirectoryOrCreate
job = *addOwnership(&job).(*batchv1.Job)
ttls := int32(100)
job.GenerateName = "kubearmor-snitch-"
Expand Down Expand Up @@ -307,7 +306,7 @@ func deploySnitch(nodename string, runtime string) *batchv1.Job {
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: "/etc/apparmor.d/",
Type: &common.HostPathDirectory,
Type: &common.HostPathDirectoryOrCreate,
},
},
},
Expand All @@ -334,7 +333,7 @@ func deploySnitch(nodename string, runtime string) *batchv1.Job {
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: "/var/lib/kubelet/seccomp",
Type: &HostPathDirectoryOrCreate,
Type: &common.HostPathDirectoryOrCreate,
},
},
},
Expand Down

0 comments on commit 7e9f139

Please sign in to comment.