aboutsummaryrefslogtreecommitdiff
path: root/k8s/charts
diff options
context:
space:
mode:
authorJohnny Cederholm <johnny.k.cederholm@gmail.com>2024-05-17 22:06:00 +0200
committerGitHub <noreply@github.com>2024-05-17 13:06:00 -0700
commit8c59348d2824cfe7abfd9b1ef5dd509c2d5162b8 (patch)
tree0b8e0654a43311c233560f7852458b07cd07cbf5 /k8s/charts
parentf6e8a9bf9ce3072cfd1d27157cc2a83f91d669df (diff)
downloadseaweedfs-8c59348d2824cfe7abfd9b1ef5dd509c2d5162b8.tar.xz
seaweedfs-8c59348d2824cfe7abfd9b1ef5dd509c2d5162b8.zip
Add ability to configure security context for the different components (#5600)
Diffstat (limited to 'k8s/charts')
-rw-r--r--k8s/charts/seaweedfs/templates/filer-statefulset.yaml6
-rw-r--r--k8s/charts/seaweedfs/templates/master-statefulset.yaml6
-rw-r--r--k8s/charts/seaweedfs/templates/post-install-bucket-hook.yaml6
-rw-r--r--k8s/charts/seaweedfs/templates/s3-deployment.yaml6
-rw-r--r--k8s/charts/seaweedfs/templates/volume-statefulset.yaml6
-rw-r--r--k8s/charts/seaweedfs/values.yaml76
6 files changed, 106 insertions, 0 deletions
diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
index 30f2da537..d83d3a639 100644
--- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
@@ -62,6 +62,9 @@ spec:
initContainers:
{{ tpl .Values.filer.initContainers . | nindent 8 | trim }}
{{- end }}
+ {{- if .Values.filer.podSecurityContext.enabled }}
+ securityContext: {{- omit .Values.filer.podSecurityContext "enabled" | toYaml | nindent 8 }}
+ {{- end }}
containers:
- name: seaweedfs
image: {{ template "filer.image" . }}
@@ -264,6 +267,9 @@ spec:
resources:
{{ tpl .Values.filer.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.filer.containerSecurityContext.enabled }}
+ securityContext: {{- omit .Values.filer.containerSecurityContext "enabled" | toYaml | nindent 12 }}
+ {{- end }}
{{- if .Values.filer.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.filer.sidecars "context" $) | nindent 8 }}
{{- end }}
diff --git a/k8s/charts/seaweedfs/templates/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master-statefulset.yaml
index 61252c5a3..1f196fb9c 100644
--- a/k8s/charts/seaweedfs/templates/master-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/master-statefulset.yaml
@@ -61,6 +61,9 @@ spec:
initContainers:
{{ tpl .Values.master.initContainers . | nindent 8 | trim }}
{{- end }}
+ {{- if .Values.master.podSecurityContext.enabled }}
+ securityContext: {{- omit .Values.master.podSecurityContext "enabled" | toYaml | nindent 8 }}
+ {{- end }}
containers:
- name: seaweedfs
image: {{ template "master.image" . }}
@@ -222,6 +225,9 @@ spec:
resources:
{{ tpl .Values.master.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.master.containerSecurityContext.enabled }}
+ securityContext: {{- omit .Values.master.containerSecurityContext "enabled" | toYaml | nindent 12 }}
+ {{- end }}
{{- if .Values.master.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.master.sidecars "context" $) | nindent 8 }}
{{- end }}
diff --git a/k8s/charts/seaweedfs/templates/post-install-bucket-hook.yaml b/k8s/charts/seaweedfs/templates/post-install-bucket-hook.yaml
index d9f7e6bcf..2260bd84a 100644
--- a/k8s/charts/seaweedfs/templates/post-install-bucket-hook.yaml
+++ b/k8s/charts/seaweedfs/templates/post-install-bucket-hook.yaml
@@ -22,6 +22,9 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name | quote }}
spec:
restartPolicy: Never
+ {{- if .Values.filer.podSecurityContext.enabled }}
+ securityContext: {{- omit .Values.filer.podSecurityContext "enabled" | toYaml | nindent 8 }}
+ {{- end }}
containers:
- name: post-install-job
image: {{ template "master.image" . }}
@@ -80,6 +83,9 @@ spec:
{{- end }}
- containerPort: {{ .Values.master.grpcPort }}
#name: swfs-master-grpc
+ {{- if .Values.filer.containerSecurityContext.enabled }}
+ securityContext: {{- omit .Values.filer.containerSecurityContext "enabled" | toYaml | nindent 12 }}
+ {{- end }}
{{- if .Values.filer.s3.enableAuth }}
volumes:
- name: config-users
diff --git a/k8s/charts/seaweedfs/templates/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3-deployment.yaml
index 2882e863e..7a02524a0 100644
--- a/k8s/charts/seaweedfs/templates/s3-deployment.yaml
+++ b/k8s/charts/seaweedfs/templates/s3-deployment.yaml
@@ -50,6 +50,9 @@ spec:
initContainers:
{{ tpl .Values.s3.initContainers . | nindent 8 | trim }}
{{- end }}
+ {{- if .Values.s3.podSecurityContext.enabled }}
+ securityContext: {{- omit .Values.s3.podSecurityContext "enabled" | toYaml | nindent 8 }}
+ {{- end }}
containers:
- name: seaweedfs
image: {{ template "s3.image" . }}
@@ -199,6 +202,9 @@ spec:
resources:
{{ tpl .Values.s3.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.s3.containerSecurityContext.enabled }}
+ securityContext: {{- omit .Values.s3.containerSecurityContext "enabled" | toYaml | nindent 12 }}
+ {{- end }}
{{- if .Values.s3.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.s3.sidecars "context" $) | nindent 8 }}
{{- end }}
diff --git a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
index 688b4cb16..b691f3045 100644
--- a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
@@ -72,6 +72,9 @@ spec:
{{ tpl .Values.volume.initContainers . | nindent 8 | trim }}
{{- end }}
{{- end }}
+ {{- if .Values.volume.podSecurityContext.enabled }}
+ securityContext: {{- omit .Values.volume.podSecurityContext "enabled" | toYaml | nindent 8 }}
+ {{- end }}
containers:
- name: seaweedfs
image: {{ template "volume.image" . }}
@@ -237,6 +240,9 @@ spec:
resources:
{{ tpl .Values.volume.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.volume.containerSecurityContext.enabled }}
+ securityContext: {{- omit .Values.volume.containerSecurityContext "enabled" | toYaml | nindent 12 }}
+ {{- end }}
{{- if .Values.volume.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.volume.sidecars "context" $) | nindent 8 }}
{{- end }}
diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml
index 576b7da22..8962e8d34 100644
--- a/k8s/charts/seaweedfs/values.yaml
+++ b/k8s/charts/seaweedfs/values.yaml
@@ -167,6 +167,25 @@ master:
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
serviceAccountName: ""
+ # Configure security context for Pod
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # podSecurityContext:
+ # enabled: true
+ # runAsUser: 1000
+ # runAsGroup: 3000
+ # fsGroup: 2000
+ podSecurityContext: {}
+
+ # Configure security context for Container
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # containerSecurityContext:
+ # enabled: true
+ # runAsUser: 2000
+ # allowPrivilegeEscalation: false
+ containerSecurityContext: {}
+
ingress:
enabled: false
className: "nginx"
@@ -378,6 +397,25 @@ volume:
extraEnvironmentVars:
+ # Configure security context for Pod
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # podSecurityContext:
+ # enabled: true
+ # runAsUser: 1000
+ # runAsGroup: 3000
+ # fsGroup: 2000
+ podSecurityContext: {}
+
+ # Configure security context for Container
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # containerSecurityContext:
+ # enabled: true
+ # runAsUser: 2000
+ # allowPrivilegeEscalation: false
+ containerSecurityContext: {}
+
# used to configure livenessProbe on volume-server containers
#
livenessProbe:
@@ -536,6 +574,25 @@ filer:
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
serviceAccountName: ""
+ # Configure security context for Pod
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # podSecurityContext:
+ # enabled: true
+ # runAsUser: 1000
+ # runAsGroup: 3000
+ # fsGroup: 2000
+ podSecurityContext: {}
+
+ # Configure security context for Container
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # containerSecurityContext:
+ # enabled: true
+ # runAsUser: 2000
+ # allowPrivilegeEscalation: false
+ containerSecurityContext: {}
+
ingress:
enabled: false
className: "nginx"
@@ -707,6 +764,25 @@ s3:
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
serviceAccountName: ""
+ # Configure security context for Pod
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # podSecurityContext:
+ # enabled: true
+ # runAsUser: 1000
+ # runAsGroup: 3000
+ # fsGroup: 2000
+ podSecurityContext: {}
+
+ # Configure security context for Container
+ # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+ # Example:
+ # containerSecurityContext:
+ # enabled: true
+ # runAsUser: 2000
+ # allowPrivilegeEscalation: false
+ containerSecurityContext: {}
+
logs:
type: "hostPath"
size: ""