Skip to content

Commit

Permalink
Merge pull request #1432 from anurag-rajawat/fix-containerd-volmnts
Browse files Browse the repository at this point in the history
fix(operator): Fix containerd socket and storage volumemounts
  • Loading branch information
daemon1024 authored Sep 22, 2023
2 parents 9b61da7 + b3560c6 commit b5524fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/KubeArmorOperator/common/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ var RuntimeStorageLocation = map[string]string{
"cri-o": "/var/lib/containers/storage",
}

var RuntimeSocketLocation = map[string]string{
"docker": "/var/run/docker.sock",
"containerd": "/var/run/containerd/containerd.sock",
"cri-o": "/var/run/crio/crio.sock",
}

func ShortSHA(s string) string {
sBytes := []byte(s)

Expand Down
3 changes: 2 additions & 1 deletion pkg/KubeArmorOperator/internal/controller/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func generateDaemonset(name, enforcer, runtime, socket, runtimeStorage, btfPrese
daemonset.Spec.Template.Spec.Volumes = vols
daemonset.Spec.Template.Spec.InitContainers[0].VolumeMounts = commonVolMnts
daemonset.Spec.Template.Spec.Containers[0].VolumeMounts = volMnts
daemonset.Spec.Template.Spec.Containers[0].Args = append(daemonset.Spec.Template.Spec.Containers[0].Args, "-criSocket=unix:///"+strings.ReplaceAll(socket, "_", "/"))
// update images
daemonset.Spec.Template.Spec.Containers[0].Image = common.GetApplicationImage(common.KubeArmorName)
daemonset.Spec.Template.Spec.Containers[0].ImagePullPolicy = corev1.PullPolicy(common.KubeArmorImagePullPolicy)
Expand Down Expand Up @@ -106,6 +105,8 @@ func genRuntimeVolumes(runtime, runtimeSocket, runtimeStorage string) (vol []cor
},
},
})

socket = common.RuntimeSocketLocation[runtime]
volMnt = append(volMnt, corev1.VolumeMount{
Name: runtime + "-socket",
MountPath: socket,
Expand Down

0 comments on commit b5524fb

Please sign in to comment.