Skip to content

Commit

Permalink
Add SELinux options for Bottlerocket (#155)
Browse files Browse the repository at this point in the history
Make SELinux options for the container's context configurable and defaulting to bottlerocket supporting values. Compatibility with bottlerocket depends on currently unreleased changes.
  • Loading branch information
jjkr committed Feb 27, 2024
1 parent 36aa2b8 commit 8d574fe
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
16 changes: 16 additions & 0 deletions charts/aws-mountpoint-s3-csi-driver/templates/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ spec:
initContainers:
- name: install-mountpoint
image: {{ printf "%s%s:%s" (default "" .Values.image.containerRegistry) .Values.image.repository (default (printf "v%s" .Chart.AppVersion) (toString .Values.image.tag)) }}
{{- with .Values.node.seLinuxOptions }}
securityContext:
seLinuxOptions:
user: {{ .user }}
type: {{ .type }}
role: {{ .role }}
level: {{ .level }}
{{- end }}
imagePullPolicy: IfNotPresent
command:
- "/bin/install-mp"
Expand All @@ -58,6 +66,14 @@ spec:
containers:
- name: s3-plugin
image: {{ printf "%s%s:%s" (default "" .Values.image.containerRegistry) .Values.image.repository (default (printf "v%s" .Chart.AppVersion) (toString .Values.image.tag)) }}
{{- with .Values.node.seLinuxOptions }}
securityContext:
seLinuxOptions:
user: {{ .user }}
type: {{ .type }}
role: {{ .role }}
level: {{ .level }}
{{- end }}
imagePullPolicy: IfNotPresent
args:
- --endpoint=$(CSI_ENDPOINT)
Expand Down
7 changes: 5 additions & 2 deletions charts/aws-mountpoint-s3-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ node:
kubeletPath: /var/lib/kubelet
mountpointInstallPath: /opt/mountpoint-s3-csi/bin/ # should end with "/"
logLevel: 4
containerSecurityContext:
privileged: true
seLinuxOptions:
user: system_u
type: super_t
role: system_r
level: s0
serviceAccount:
# Specifies whether a service account should be created
create: true
Expand Down
11 changes: 11 additions & 0 deletions deploy/kubernetes/base/node-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ spec:
tolerationSeconds: 300
initContainers:
- name: install-mountpoint
securityContext:
seLinuxOptions:
user: system_u
type: super_t
role: system_r
level: s0
image: csi-driver
imagePullPolicy: IfNotPresent
command:
Expand All @@ -42,6 +48,11 @@ spec:
- name: s3-plugin
securityContext:
privileged: false
seLinuxOptions:
user: system_u
type: super_t
role: system_r
level: s0
image: csi-driver
imagePullPolicy: IfNotPresent
args:
Expand Down

0 comments on commit 8d574fe

Please sign in to comment.