aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavidsod <31387318+Davidsod@users.noreply.github.com>2023-12-21 01:04:44 +0200
committerGitHub <noreply@github.com>2023-12-20 15:04:44 -0800
commit3ec2a898b8ec2f2e07d12fbde74d2d303a686ec4 (patch)
tree8694668953cce78d8f71dbbf80a661a864c9a7aa
parent7e95fcc963d235f323800d2c13eff40087e1ab8a (diff)
downloadseaweedfs-3ec2a898b8ec2f2e07d12fbde74d2d303a686ec4.tar.xz
seaweedfs-3ec2a898b8ec2f2e07d12fbde74d2d303a686ec4.zip
#5122 Add support for sidecar containers (#5125)
-rw-r--r--k8s/charts/seaweedfs/templates/_helpers.tpl19
-rw-r--r--k8s/charts/seaweedfs/templates/filer-statefulset.yaml3
-rw-r--r--k8s/charts/seaweedfs/templates/master-statefulset.yaml3
-rw-r--r--k8s/charts/seaweedfs/templates/s3-deployment.yaml3
-rw-r--r--k8s/charts/seaweedfs/templates/volume-statefulset.yaml3
-rw-r--r--k8s/charts/seaweedfs/values.yaml52
6 files changed, 79 insertions, 4 deletions
diff --git a/k8s/charts/seaweedfs/templates/_helpers.tpl b/k8s/charts/seaweedfs/templates/_helpers.tpl
index dd118c86b..e9f35447d 100644
--- a/k8s/charts/seaweedfs/templates/_helpers.tpl
+++ b/k8s/charts/seaweedfs/templates/_helpers.tpl
@@ -163,3 +163,22 @@ imagePullSecrets:
{{- end }}
{{- end }}
{{- end -}}
+
+{{/*
+Renders a value that contains template perhaps with scope if the scope is present.
+Usage:
+{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }}
+{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }}
+*/}}
+{{- define "common.tplvalues.render" -}}
+{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
+{{- if contains "{{" (toJson .value) }}
+ {{- if .scope }}
+ {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
+ {{- else }}
+ {{- tpl $value .context }}
+ {{- end }}
+{{- else }}
+ {{- $value }}
+{{- end }}
+{{- end -}}
diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
index a92d3cdd1..6ee847b91 100644
--- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
@@ -258,6 +258,9 @@ spec:
resources:
{{ tpl .Values.filer.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.filer.sidecars }}
+ {{- include "common.tplvalues.render" (dict "value" .Values.filer.sidecars "context" $) | nindent 8 }}
+ {{- end }}
volumes:
{{- if eq .Values.filer.logs.type "hostPath" }}
- name: seaweedfs-filer-log-volume
diff --git a/k8s/charts/seaweedfs/templates/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master-statefulset.yaml
index 19c30f07d..6e432450a 100644
--- a/k8s/charts/seaweedfs/templates/master-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/master-statefulset.yaml
@@ -212,6 +212,9 @@ spec:
resources:
{{ tpl .Values.master.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.master.sidecars }}
+ {{- include "common.tplvalues.render" (dict "value" .Values.master.sidecars "context" $) | nindent 8 }}
+ {{- end }}
volumes:
{{- if eq .Values.master.logs.type "hostPath" }}
- name: seaweedfs-master-log-volume
diff --git a/k8s/charts/seaweedfs/templates/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3-deployment.yaml
index c08873fa5..45b0d394b 100644
--- a/k8s/charts/seaweedfs/templates/s3-deployment.yaml
+++ b/k8s/charts/seaweedfs/templates/s3-deployment.yaml
@@ -183,6 +183,9 @@ spec:
resources:
{{ tpl .Values.s3.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.s3.sidecars }}
+ {{- include "common.tplvalues.render" (dict "value" .Values.s3.sidecars "context" $) | nindent 8 }}
+ {{- end }}
volumes:
{{- if .Values.s3.enableAuth }}
- name: config-users
diff --git a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
index 1b8c9267e..5375a4b7c 100644
--- a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
@@ -218,6 +218,9 @@ spec:
resources:
{{ tpl .Values.volume.resources . | nindent 12 | trim }}
{{- end }}
+ {{- if .Values.volume.sidecars }}
+ {{- include "common.tplvalues.render" (dict "value" .Values.volume.sidecars "context" $) | nindent 8 }}
+ {{- end }}
volumes:
{{- if eq .Values.volume.data.type "hostPath" }}
- name: data
diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml
index 7a2b04d64..a0138d15c 100644
--- a/k8s/charts/seaweedfs/values.yaml
+++ b/k8s/charts/seaweedfs/values.yaml
@@ -98,7 +98,18 @@ master:
size: ""
storageClass: ""
hostPathPrefix: /storage
-
+
+ ## @param master.sidecars Add additional sidecar containers to the master pod(s)
+ ## e.g:
+ ## sidecars:
+ ## - name: your-image-name
+ ## image: your-image
+ ## imagePullPolicy: Always
+ ## ports:
+ ## - name: portname
+ ## containerPort: 1234
+ ##
+ sidecars: []
initContainers: ""
extraVolumes: ""
@@ -286,7 +297,18 @@ volume:
# Adjust jpg orientation when uploading.
imagesFixOrientation: false
-
+
+ ## @param volume.sidecars Add additional sidecar containers to the volume pod(s)
+ ## e.g:
+ ## sidecars:
+ ## - name: your-image-name
+ ## image: your-image
+ ## imagePullPolicy: Always
+ ## ports:
+ ## - name: portname
+ ## containerPort: 1234
+ ##
+ sidecars: []
initContainers: ""
extraVolumes: ""
@@ -429,7 +451,18 @@ filer:
size: ""
storageClass: ""
hostPathPrefix: /storage
-
+
+ ## @param filer.sidecars Add additional sidecar containers to the filer pod(s)
+ ## e.g:
+ ## sidecars:
+ ## - name: your-image-name
+ ## image: your-image
+ ## imagePullPolicy: Always
+ ## ports:
+ ## - name: portname
+ ## containerPort: 1234
+ ##
+ sidecars: []
initContainers: ""
extraVolumes: ""
@@ -611,7 +644,18 @@ s3:
# Suffix of the host name, {bucket}.{domainName}
domainName: ""
-
+
+ ## @param s3.sidecars Add additional sidecar containers to the s3 pod(s)
+ ## e.g:
+ ## sidecars:
+ ## - name: your-image-name
+ ## image: your-image
+ ## imagePullPolicy: Always
+ ## ports:
+ ## - name: portname
+ ## containerPort: 1234
+ ##
+ sidecars: []
initContainers: ""
extraVolumes: ""