Introduce named volumes in Helm chart (#6972)
This commit is contained in:
@@ -179,6 +179,27 @@ Usage:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Converts a Kubernetes quantity like "256Mi" or "2G" to a float64 in base units,
|
||||||
|
handling both binary (Ki, Mi, Gi) and decimal (m, k, M) suffixes; numeric inputs
|
||||||
|
Usage:
|
||||||
|
{{ include "common.resource-quantity" "10Gi" }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.resource-quantity" -}}
|
||||||
|
{{- $value := . -}}
|
||||||
|
{{- $unit := 1.0 -}}
|
||||||
|
{{- if typeIs "string" . -}}
|
||||||
|
{{- $base2 := dict "Ki" 0x1p10 "Mi" 0x1p20 "Gi" 0x1p30 "Ti" 0x1p40 "Pi" 0x1p50 "Ei" 0x1p60 -}}
|
||||||
|
{{- $base10 := dict "m" 1e-3 "k" 1e3 "M" 1e6 "G" 1e9 "T" 1e12 "P" 1e15 "E" 1e18 -}}
|
||||||
|
{{- range $k, $v := merge $base2 $base10 -}}
|
||||||
|
{{- if hasSuffix $k $ -}}
|
||||||
|
{{- $value = trimSuffix $k $ -}}
|
||||||
|
{{- $unit = $v -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- mulf (float64 $value) $unit -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
getOrGeneratePassword will check if a password exists in a secret and return it,
|
getOrGeneratePassword will check if a password exists in a secret and return it,
|
||||||
@@ -198,25 +219,3 @@ or generate a new random password if it doesn't exist.
|
|||||||
{{- randAlphaNum $length -}}
|
{{- randAlphaNum $length -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- /*
|
|
||||||
Render a component’s topologySpreadConstraints exactly as given in values,
|
|
||||||
respecting string vs. list, and providing the component name for tpl lookups.
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
{{ include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "filer") | nindent 8 }}
|
|
||||||
*/ -}}
|
|
||||||
{{- define "seaweedfs.topologySpreadConstraints" -}}
|
|
||||||
{{- $vals := .Values -}}
|
|
||||||
{{- $comp := .component -}}
|
|
||||||
{{- $section := index $vals $comp | default dict -}}
|
|
||||||
{{- $tsp := index $section "topologySpreadConstraints" -}}
|
|
||||||
{{- with $tsp }}
|
|
||||||
topologySpreadConstraints:
|
|
||||||
{{- if kindIs "string" $tsp }}
|
|
||||||
{{ tpl $tsp (dict "Values" $vals "component" $comp) }}
|
|
||||||
{{- else }}
|
|
||||||
{{ toYaml $tsp }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -50,7 +50,8 @@ spec:
|
|||||||
{{ tpl .Values.allInOne.affinity . | nindent 8 | trim }}
|
{{ tpl .Values.allInOne.affinity . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.allInOne.topologySpreadConstraints }}
|
{{- if .Values.allInOne.topologySpreadConstraints }}
|
||||||
{{- include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "all-in-one") | nindent 6 }}
|
topologySpreadConstraints:
|
||||||
|
{{ tpl .Values.allInOne.topologySpreadConstraint . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.allInOne.tolerations }}
|
{{- if .Values.allInOne.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ spec:
|
|||||||
{{ tpl .Values.cosi.affinity . | nindent 8 | trim }}
|
{{ tpl .Values.cosi.affinity . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.cosi.topologySpreadConstraints }}
|
{{- if .Values.cosi.topologySpreadConstraints }}
|
||||||
{{- include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "objectstorage-provisioner") | nindent 6 }}
|
topologySpreadConstraints:
|
||||||
|
{{ tpl .Values.cosi.topologySpreadConstraint . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.cosi.tolerations }}
|
{{- if .Values.cosi.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.filer.topologySpreadConstraints }}
|
{{- if .Values.filer.topologySpreadConstraints }}
|
||||||
topologySpreadConstraints:
|
topologySpreadConstraints:
|
||||||
{{- include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "filer") | nindent 6 }}
|
{{ tpl .Values.filer.topologySpreadConstraints . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.filer.tolerations }}
|
{{- if .Values.filer.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ spec:
|
|||||||
{{ tpl .Values.master.affinity . | nindent 8 | trim }}
|
{{ tpl .Values.master.affinity . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.master.topologySpreadConstraints }}
|
{{- if .Values.master.topologySpreadConstraints }}
|
||||||
{{- include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "master") | nindent 6 }}
|
topologySpreadConstraints:
|
||||||
|
{{ tpl .Values.master.topologySpreadConstraints . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.master.tolerations }}
|
{{- if .Values.master.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ spec:
|
|||||||
{{ tpl .Values.s3.affinity . | nindent 8 | trim }}
|
{{ tpl .Values.s3.affinity . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.s3.topologySpreadConstraints }}
|
{{- if .Values.s3.topologySpreadConstraints }}
|
||||||
{{- include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "s3") | nindent 6 }}
|
topologySpreadConstraints:
|
||||||
|
{{ tpl .Values.s3.topologySpreadConstraints . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.s3.tolerations }}
|
{{- if .Values.s3.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ spec:
|
|||||||
{{ tpl .Values.sftp.affinity . | nindent 8 | trim }}
|
{{ tpl .Values.sftp.affinity . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.sftp.topologySpreadConstraints }}
|
{{- if .Values.sftp.topologySpreadConstraints }}
|
||||||
{{- include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "sftp") | nindent 6 }}
|
topologySpreadConstraints:
|
||||||
|
{{ tpl .Values.sftp.topologySpreadConstraint . | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.sftp.tolerations }}
|
{{- if .Values.sftp.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
|
|||||||
@@ -1,40 +1,54 @@
|
|||||||
{{- if and .Values.volume.enabled .Values.volume.resizeHook.enabled }}
|
|
||||||
{{- $seaweedfsName := include "seaweedfs.name" $ }}
|
{{- $seaweedfsName := include "seaweedfs.name" $ }}
|
||||||
{{- $replicas := int .Values.volume.replicas -}}
|
{{- $volumes := deepCopy .Values.volumes | mergeOverwrite (dict "" .Values.volume) }}
|
||||||
{{- $statefulsetName := printf "%s-volume" $seaweedfsName -}}
|
|
||||||
{{- $statefulset := (lookup "apps/v1" "StatefulSet" .Release.Namespace $statefulsetName) -}}
|
|
||||||
|
|
||||||
{{/* Check for changes in volumeClaimTemplates */}}
|
|
||||||
{{- $templateChangesRequired := false -}}
|
|
||||||
{{- if $statefulset -}}
|
|
||||||
{{- range $dir := .Values.volume.dataDirs -}}
|
|
||||||
{{- if eq .type "persistentVolumeClaim" -}}
|
|
||||||
{{- $desiredSize := .size -}}
|
|
||||||
{{- range $statefulset.spec.volumeClaimTemplates -}}
|
|
||||||
{{- if and (eq .metadata.name $dir.name) (ne .spec.resources.requests.storage $desiredSize) -}}
|
|
||||||
{{- $templateChangesRequired = true -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{/* Check for the need for patching existing PVCs */}}
|
{{- if .Values.volume.resizeHook.enabled }}
|
||||||
{{- $pvcChangesRequired := false -}}
|
{{- $commands := list }}
|
||||||
{{- range $dir := .Values.volume.dataDirs -}}
|
{{- range $vname, $volume := $volumes }}
|
||||||
{{- if eq .type "persistentVolumeClaim" -}}
|
{{- $volumeName := trimSuffix "-" (printf "volume-%s" $vname) }}
|
||||||
{{- $desiredSize := .size -}}
|
{{- $volume := mergeOverwrite (deepCopy $.Values.volume) (dict "enabled" true) $volume }}
|
||||||
{{- range $i, $e := until $replicas }}
|
|
||||||
{{- $pvcName := printf "%s-%s-volume-%d" $dir.name $seaweedfsName $e -}}
|
|
||||||
{{- $currentPVC := (lookup "v1" "PersistentVolumeClaim" $.Release.Namespace $pvcName) -}}
|
|
||||||
{{- if and $currentPVC (ne ($currentPVC.spec.resources.requests.storage | toString) $desiredSize) -}}
|
|
||||||
{{- $pvcChangesRequired = true -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- if or $templateChangesRequired $pvcChangesRequired }}
|
{{- if $volume.enabled }}
|
||||||
|
{{- $replicas := int $volume.replicas -}}
|
||||||
|
{{- $statefulsetName := printf "%s-%s" $seaweedfsName $volumeName -}}
|
||||||
|
{{- $statefulset := (lookup "apps/v1" "StatefulSet" $.Release.Namespace $statefulsetName) -}}
|
||||||
|
|
||||||
|
{{/* Check for changes in volumeClaimTemplates */}}
|
||||||
|
{{- if $statefulset }}
|
||||||
|
{{- range $dir := $volume.dataDirs }}
|
||||||
|
{{- if eq .type "persistentVolumeClaim" }}
|
||||||
|
{{- $desiredSize := .size }}
|
||||||
|
{{- range $statefulset.spec.volumeClaimTemplates }}
|
||||||
|
{{- if and (eq .metadata.name $dir.name) (ne .spec.resources.requests.storage $desiredSize) }}
|
||||||
|
{{- $commands = append $commands (printf "kubectl delete statefulset %s --cascade=orphan" $statefulsetName) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Check for the need for patching existing PVCs */}}
|
||||||
|
{{- range $dir := $volume.dataDirs }}
|
||||||
|
{{- if eq .type "persistentVolumeClaim" }}
|
||||||
|
{{- $desiredSize := .size }}
|
||||||
|
{{- range $i, $e := until $replicas }}
|
||||||
|
{{- $pvcName := printf "%s-%s-%s-%d" $dir.name $seaweedfsName $volumeName $e }}
|
||||||
|
{{- $currentPVC := (lookup "v1" "PersistentVolumeClaim" $.Release.Namespace $pvcName) }}
|
||||||
|
{{- if and $currentPVC }}
|
||||||
|
{{- $oldSize := include "common.resource-quantity" $currentPVC.spec.resources.requests.storage }}
|
||||||
|
{{- $newSize := include "common.resource-quantity" $desiredSize }}
|
||||||
|
{{- if gt $newSize $oldSize }}
|
||||||
|
{{- $commands = append $commands (printf "kubectl patch pvc %s-%s-%s-%d -p '{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"%s\"}}}}'" $dir.name $seaweedfsName $volumeName $e $desiredSize) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if $commands }}
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
@@ -45,6 +59,9 @@ metadata:
|
|||||||
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
|
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
|
||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
policy.cozystack.io/allow-to-apiserver: "true"
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: {{ $seaweedfsName }}-volume-resize-hook
|
serviceAccountName: {{ $seaweedfsName }}-volume-resize-hook
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
@@ -55,21 +72,9 @@ spec:
|
|||||||
command: ["sh", "-xec"]
|
command: ["sh", "-xec"]
|
||||||
args:
|
args:
|
||||||
- |
|
- |
|
||||||
{{- if $pvcChangesRequired -}}
|
{{- range $commands }}
|
||||||
{{- range $dir := .Values.volume.dataDirs -}}
|
{{ . }}
|
||||||
{{- if eq .type "persistentVolumeClaim" -}}
|
|
||||||
{{- $desiredSize := .size -}}
|
|
||||||
{{- range $i, $e := until $replicas }}
|
|
||||||
kubectl patch pvc {{ printf "%s-%s-volume-%d" $dir.name $seaweedfsName $e }} -p '{"spec":{"resources":{"requests":{"storage":"{{ $desiredSize }}"}}}}'
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- if $templateChangesRequired }}
|
|
||||||
kubectl delete statefulset {{ $statefulsetName }} --cascade=orphan
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
@@ -111,4 +116,5 @@ roleRef:
|
|||||||
kind: Role
|
kind: Role
|
||||||
name: {{ $seaweedfsName }}-volume-resize-hook
|
name: {{ $seaweedfsName }}-volume-resize-hook
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -1,37 +1,44 @@
|
|||||||
{{- if .Values.volume.enabled }}
|
{{ $volumes := deepCopy .Values.volumes | mergeOverwrite (dict "" .Values.volume) }}
|
||||||
|
{{- range $vname, $volume := $volumes }}
|
||||||
|
{{- $volumeName := trimSuffix "-" (printf "volume-%s" $vname) }}
|
||||||
|
{{- $volume := mergeOverwrite (deepCopy $.Values.volume) (dict "enabled" true) $volume }}
|
||||||
|
|
||||||
|
{{- if $volume.enabled }}
|
||||||
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "seaweedfs.name" . }}-volume
|
name: {{ template "seaweedfs.name" $ }}-{{ $volumeName }}
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ $.Release.Namespace }}
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
|
||||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
app.kubernetes.io/managed-by: {{ $.Release.Service }}
|
||||||
{{- if .Values.volume.annotations }}
|
{{- if $volume.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml .Values.volume.annotations | nindent 4 }}
|
{{- toYaml $volume.annotations | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
clusterIP: None
|
clusterIP: None
|
||||||
internalTrafficPolicy: {{ .Values.volume.internalTrafficPolicy | default "Cluster" }}
|
internalTrafficPolicy: {{ $volume.internalTrafficPolicy | default "Cluster" }}
|
||||||
ports:
|
ports:
|
||||||
- name: "swfs-volume"
|
- name: "swfs-volume"
|
||||||
port: {{ .Values.volume.port }}
|
port: {{ $volume.port }}
|
||||||
targetPort: {{ .Values.volume.port }}
|
targetPort: {{ $volume.port }}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- name: "swfs-volume-18080"
|
- name: "swfs-volume-18080"
|
||||||
port: {{ .Values.volume.grpcPort }}
|
port: {{ $volume.grpcPort }}
|
||||||
targetPort: {{ .Values.volume.grpcPort }}
|
targetPort: {{ $volume.grpcPort }}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
{{- if .Values.volume.metricsPort }}
|
{{- if $volume.metricsPort }}
|
||||||
- name: "metrics"
|
- name: "metrics"
|
||||||
port: {{ .Values.volume.metricsPort }}
|
port: {{ $volume.metricsPort }}
|
||||||
targetPort: {{ .Values.volume.metricsPort }}
|
targetPort: {{ $volume.metricsPort }}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
{{- end }}
|
{{- end }}
|
||||||
selector:
|
selector:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
{{- if .Values.volume.enabled }}
|
{{ $volumes := deepCopy .Values.volumes | mergeOverwrite (dict "" .Values.volume) }}
|
||||||
{{- if .Values.volume.metricsPort }}
|
{{- range $vname, $volume := $volumes }}
|
||||||
{{- if .Values.global.monitoring.enabled }}
|
{{- $volumeName := trimSuffix "-" (printf "volume-%s" $vname) }}
|
||||||
|
{{- $volume := mergeOverwrite (deepCopy $.Values.volume) (dict "enabled" true) $volume }}
|
||||||
|
|
||||||
|
{{- if $volume.enabled }}
|
||||||
|
{{- if $volume.metricsPort }}
|
||||||
|
{{- if $.Values.global.monitoring.enabled }}
|
||||||
|
---
|
||||||
apiVersion: monitoring.coreos.com/v1
|
apiVersion: monitoring.coreos.com/v1
|
||||||
kind: ServiceMonitor
|
kind: ServiceMonitor
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "seaweedfs.name" . }}-volume
|
name: {{ template "seaweedfs.name" $ }}-{{ $volumeName }}
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ $.Release.Namespace }}
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
||||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
|
||||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
app.kubernetes.io/managed-by: {{ $.Release.Service }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ $.Release.Name }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
{{- with .Values.global.monitoring.additionalLabels }}
|
{{- with $.Values.global.monitoring.additionalLabels }}
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.annotations }}
|
{{- if .Values.volume.annotations }}
|
||||||
@@ -26,8 +32,9 @@ spec:
|
|||||||
scrapeTimeout: 5s
|
scrapeTimeout: 5s
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -1,98 +1,108 @@
|
|||||||
{{- if .Values.volume.enabled }}
|
{{ $volumes := deepCopy .Values.volumes | mergeOverwrite (dict "" .Values.volume) }}
|
||||||
|
{{- range $vname, $volume := $volumes }}
|
||||||
|
{{- $volumeName := trimSuffix "-" (printf "volume-%s" $vname) }}
|
||||||
|
{{- $volume := mergeOverwrite (deepCopy $.Values.volume) (dict "enabled" true) $volume }}
|
||||||
|
|
||||||
|
{{- if $volume.enabled }}
|
||||||
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ template "seaweedfs.name" . }}-volume
|
name: {{ template "seaweedfs.name" $ }}-{{ $volumeName }}
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ $.Release.Namespace }}
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
||||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
|
||||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
app.kubernetes.io/managed-by: {{ $.Release.Service }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ $.Release.Name }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
{{- if .Values.volume.annotations }}
|
{{- if $volume.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml .Values.volume.annotations | nindent 4 }}
|
{{- toYaml $volume.annotations | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
serviceName: {{ template "seaweedfs.name" . }}-volume
|
persistentVolumeClaimRetentionPolicy:
|
||||||
replicas: {{ .Values.volume.replicas }}
|
whenDeleted: Delete
|
||||||
podManagementPolicy: {{ .Values.volume.podManagementPolicy }}
|
whenScaled: Delete
|
||||||
|
serviceName: {{ template "seaweedfs.name" $ }}-{{ $volumeName }}
|
||||||
|
replicas: {{ $volume.replicas }}
|
||||||
|
podManagementPolicy: {{ $volume.podManagementPolicy }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ $.Release.Name }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
|
||||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ $.Release.Name }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
{{ with .Values.podLabels }}
|
{{ with $.Values.podLabels }}
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.volume.podLabels }}
|
{{- with $volume.podLabels }}
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ with .Values.podAnnotations }}
|
{{ with $.Values.podAnnotations }}
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.volume.podAnnotations }}
|
{{- with $volume.podAnnotations }}
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
{{- if .Values.volume.affinity }}
|
{{- if $volume.affinity }}
|
||||||
affinity:
|
affinity:
|
||||||
{{ tpl .Values.volume.affinity . | nindent 8 | trim }}
|
{{ tpl (printf "{{ $volumeName := \"%s\" }}%s" $volumeName $volume.affinity) $ | indent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.topologySpreadConstraints }}
|
{{- if $volume.topologySpreadConstraints }}
|
||||||
{{- include "seaweedfs.topologySpreadConstraints" (dict "Values" .Values "component" "volume") | nindent 6 }}
|
topologySpreadConstraints:
|
||||||
|
{{ tpl (printf "{{ $volumeName := \"%s\" }}%s" $volumeName $volume.topologySpreadConstraints) $ | nindent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
restartPolicy: {{ default .Values.global.restartPolicy .Values.volume.restartPolicy }}
|
restartPolicy: {{ default $.Values.global.restartPolicy $volume.restartPolicy }}
|
||||||
{{- if .Values.volume.tolerations }}
|
{{- if $volume.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
{{ tpl .Values.volume.tolerations . | nindent 8 | trim }}
|
{{ tpl (printf "{{ $volumeName := \"%s\" }}%s" $volumeName $volume.tolerations) $ | indent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- include "seaweedfs.imagePullSecrets" . | nindent 6 }}
|
{{- include "seaweedfs.imagePullSecrets" $ | nindent 6 }}
|
||||||
terminationGracePeriodSeconds: 150
|
terminationGracePeriodSeconds: 150
|
||||||
{{- if .Values.volume.priorityClassName }}
|
{{- if $volume.priorityClassName }}
|
||||||
priorityClassName: {{ .Values.volume.priorityClassName | quote }}
|
priorityClassName: {{ $volume.priorityClassName | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
enableServiceLinks: false
|
enableServiceLinks: false
|
||||||
{{- if .Values.global.createClusterRole }}
|
{{- if $.Values.global.createClusterRole }}
|
||||||
serviceAccountName: {{ .Values.volume.serviceAccountName | default .Values.global.serviceAccountName | quote }} # for deleting statefulset pods after migration
|
serviceAccountName: {{ $volume.serviceAccountName | default $.Values.global.serviceAccountName | quote }} # for deleting statefulset pods after migration
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $initContainers_exists := include "volume.initContainers_exists" . -}}
|
{{- $initContainers_exists := include "volume.initContainers_exists" $ -}}
|
||||||
{{- if $initContainers_exists }}
|
{{- if $initContainers_exists }}
|
||||||
initContainers:
|
initContainers:
|
||||||
{{- if .Values.volume.idx }}
|
{{- if $volume.idx }}
|
||||||
- name: seaweedfs-vol-move-idx
|
- name: seaweedfs-vol-move-idx
|
||||||
image: {{ template "volume.image" . }}
|
image: {{ template "volume.image" $ }}
|
||||||
imagePullPolicy: {{ .Values.global.imagePullPolicy | default "IfNotPresent" }}
|
imagePullPolicy: {{ $.Values.global.imagePullPolicy | default "IfNotPresent" }}
|
||||||
command: [ '/bin/sh', '-c' ]
|
command: [ '/bin/sh', '-c' ]
|
||||||
args: [ '{{range $dir := .Values.volume.dataDirs }}if ls /{{$dir.name}}/*.idx >/dev/null 2>&1; then mv /{{$dir.name}}/*.idx /idx/ ; fi; {{end}}' ]
|
args: [ '{{range $dir := $volume.dataDirs }}if ls /{{$dir.name}}/*.idx >/dev/null 2>&1; then mv /{{$dir.name}}/*.idx /idx/ ; fi; {{end}}' ]
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: idx
|
- name: idx
|
||||||
mountPath: /idx
|
mountPath: /idx
|
||||||
{{- range $dir := .Values.volume.dataDirs }}
|
{{- range $dir := $volume.dataDirs }}
|
||||||
- name: {{ $dir.name }}
|
- name: {{ $dir.name }}
|
||||||
mountPath: /{{ $dir.name }}
|
mountPath: /{{ $dir.name }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.initContainers }}
|
{{- if $volume.initContainers }}
|
||||||
{{ tpl .Values.volume.initContainers . | nindent 8 | trim }}
|
{{ tpl (printf "{{ $volumeName := \"%s\" }}%s" $volumeName $volume.initContainers) $ | indent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.podSecurityContext.enabled }}
|
{{- if $volume.podSecurityContext.enabled }}
|
||||||
securityContext: {{- omit .Values.volume.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
securityContext: {{- omit $volume.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: seaweedfs
|
- name: seaweedfs
|
||||||
image: {{ template "volume.image" . }}
|
image: {{ template "volume.image" $ }}
|
||||||
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
|
imagePullPolicy: {{ default "IfNotPresent" $.Values.global.imagePullPolicy }}
|
||||||
env:
|
env:
|
||||||
- name: POD_NAME
|
- name: POD_NAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@@ -107,9 +117,9 @@ spec:
|
|||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: status.hostIP
|
fieldPath: status.hostIP
|
||||||
- name: SEAWEEDFS_FULLNAME
|
- name: SEAWEEDFS_FULLNAME
|
||||||
value: "{{ template "seaweedfs.name" . }}"
|
value: "{{ template "seaweedfs.name" $ }}"
|
||||||
{{- if .Values.volume.extraEnvironmentVars }}
|
{{- if $volume.extraEnvironmentVars }}
|
||||||
{{- range $key, $value := .Values.volume.extraEnvironmentVars }}
|
{{- range $key, $value := $volume.extraEnvironmentVars }}
|
||||||
- name: {{ $key }}
|
- name: {{ $key }}
|
||||||
{{- if kindIs "string" $value }}
|
{{- if kindIs "string" $value }}
|
||||||
value: {{ $value | quote }}
|
value: {{ $value | quote }}
|
||||||
@@ -119,8 +129,8 @@ spec:
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.global.extraEnvironmentVars }}
|
{{- if $.Values.global.extraEnvironmentVars }}
|
||||||
{{- range $key, $value := .Values.global.extraEnvironmentVars }}
|
{{- range $key, $value := $.Values.global.extraEnvironmentVars }}
|
||||||
- name: {{ $key }}
|
- name: {{ $key }}
|
||||||
{{- if kindIs "string" $value }}
|
{{- if kindIs "string" $value }}
|
||||||
value: {{ $value | quote }}
|
value: {{ $value | quote }}
|
||||||
@@ -135,77 +145,77 @@ spec:
|
|||||||
- "-ec"
|
- "-ec"
|
||||||
- |
|
- |
|
||||||
exec /usr/bin/weed \
|
exec /usr/bin/weed \
|
||||||
{{- if .Values.volume.logs }}
|
{{- if $volume.logs }}
|
||||||
-logdir=/logs \
|
-logdir=/logs \
|
||||||
{{- else }}
|
{{- else }}
|
||||||
-logtostderr=true \
|
-logtostderr=true \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.loggingOverrideLevel }}
|
{{- if $volume.loggingOverrideLevel }}
|
||||||
-v={{ .Values.volume.loggingOverrideLevel }} \
|
-v={{ $volume.loggingOverrideLevel }} \
|
||||||
{{- else }}
|
{{- else }}
|
||||||
-v={{ .Values.global.loggingLevel }} \
|
-v={{ $.Values.global.loggingLevel }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volume \
|
volume \
|
||||||
-port={{ .Values.volume.port }} \
|
-port={{ $volume.port }} \
|
||||||
{{- if .Values.volume.metricsPort }}
|
{{- if $volume.metricsPort }}
|
||||||
-metricsPort={{ .Values.volume.metricsPort }} \
|
-metricsPort={{ $volume.metricsPort }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.metricsIp }}
|
{{- if $volume.metricsIp }}
|
||||||
-metricsIp={{ .Values.volume.metricsIp }} \
|
-metricsIp={{ $volume.metricsIp }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
-dir {{range $index, $dir := .Values.volume.dataDirs }}{{if ne $index 0}},{{end}}/{{$dir.name}}{{end}} \
|
-dir {{range $index, $dir := $volume.dataDirs }}{{if ne $index 0}},{{end}}/{{$dir.name}}{{end}} \
|
||||||
{{- if .Values.volume.idx }}
|
{{- if $volume.idx }}
|
||||||
-dir.idx=/idx \
|
-dir.idx=/idx \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
-max {{range $index, $dir := .Values.volume.dataDirs }}{{if ne $index 0}},{{end}}
|
-max {{range $index, $dir := $volume.dataDirs }}{{if ne $index 0}},{{end}}
|
||||||
{{- if eq ($dir.maxVolumes | toString) "0" }}0{{ else if not $dir.maxVolumes }}7{{ else }}{{$dir.maxVolumes}}{{ end }}
|
{{- if eq ($dir.maxVolumes | toString) "0" }}0{{ else if not $dir.maxVolumes }}7{{ else }}{{$dir.maxVolumes}}{{ end }}
|
||||||
{{- end }} \
|
{{- end }} \
|
||||||
{{- if .Values.volume.rack }}
|
{{- if $volume.rack }}
|
||||||
-rack={{ .Values.volume.rack }} \
|
-rack={{ $volume.rack }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.dataCenter }}
|
{{- if $volume.dataCenter }}
|
||||||
-dataCenter={{ .Values.volume.dataCenter }} \
|
-dataCenter={{ $volume.dataCenter }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
-ip.bind={{ .Values.volume.ipBind }} \
|
-ip.bind={{ $volume.ipBind }} \
|
||||||
-readMode={{ .Values.volume.readMode }} \
|
-readMode={{ $volume.readMode }} \
|
||||||
{{- if .Values.volume.whiteList }}
|
{{- if $volume.whiteList }}
|
||||||
-whiteList={{ .Values.volume.whiteList }} \
|
-whiteList={{ $volume.whiteList }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.imagesFixOrientation }}
|
{{- if $volume.imagesFixOrientation }}
|
||||||
-images.fix.orientation \
|
-images.fix.orientation \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.pulseSeconds }}
|
{{- if $volume.pulseSeconds }}
|
||||||
-pulseSeconds={{ .Values.volume.pulseSeconds }} \
|
-pulseSeconds={{ $volume.pulseSeconds }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.index }}
|
{{- if $volume.index }}
|
||||||
-index={{ .Values.volume.index }} \
|
-index={{ $volume.index }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.fileSizeLimitMB }}
|
{{- if $volume.fileSizeLimitMB }}
|
||||||
-fileSizeLimitMB={{ .Values.volume.fileSizeLimitMB }} \
|
-fileSizeLimitMB={{ $volume.fileSizeLimitMB }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
-minFreeSpacePercent={{ .Values.volume.minFreeSpacePercent }} \
|
-minFreeSpacePercent={{ $volume.minFreeSpacePercent }} \
|
||||||
-ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-volume.{{ .Release.Namespace }} \
|
-ip=${POD_NAME}.${SEAWEEDFS_FULLNAME}-{{ $volumeName }}.{{ $.Release.Namespace }} \
|
||||||
-compactionMBps={{ .Values.volume.compactionMBps }} \
|
-compactionMBps={{ $volume.compactionMBps }} \
|
||||||
-mserver={{ if .Values.global.masterServer }}{{.Values.global.masterServer}}{{ else }}{{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master.{{ $.Release.Namespace }}:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }}{{ end }} \
|
-mserver={{ if $.Values.global.masterServer }}{{ $.Values.global.masterServer}}{{ else }}{{ range $index := until ($.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master.{{ $.Release.Namespace }}:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }}{{ end }}
|
||||||
{{- range .Values.volume.extraArgs }}
|
{{- range $volume.extraArgs }}
|
||||||
{{ . }} \
|
{{ . }} \
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
{{- range $dir := .Values.volume.dataDirs }}
|
{{- range $dir := $volume.dataDirs }}
|
||||||
{{- if not ( eq $dir.type "custom" ) }}
|
{{- if not ( eq $dir.type "custom" ) }}
|
||||||
- name: {{ $dir.name }}
|
- name: {{ $dir.name }}
|
||||||
mountPath: "/{{ $dir.name }}/"
|
mountPath: "/{{ $dir.name }}/"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.logs }}
|
{{- if $volume.logs }}
|
||||||
- name: logs
|
- name: logs
|
||||||
mountPath: "/logs/"
|
mountPath: "/logs/"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.idx }}
|
{{- if $volume.idx }}
|
||||||
- name: idx
|
- name: idx
|
||||||
mountPath: "/idx/"
|
mountPath: "/idx/"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.global.enableSecurity }}
|
{{- if $.Values.global.enableSecurity }}
|
||||||
- name: security-config
|
- name: security-config
|
||||||
readOnly: true
|
readOnly: true
|
||||||
mountPath: /etc/seaweedfs/security.toml
|
mountPath: /etc/seaweedfs/security.toml
|
||||||
@@ -226,53 +236,53 @@ spec:
|
|||||||
readOnly: true
|
readOnly: true
|
||||||
mountPath: /usr/local/share/ca-certificates/client/
|
mountPath: /usr/local/share/ca-certificates/client/
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{ tpl .Values.volume.extraVolumeMounts . | nindent 12 | trim }}
|
{{ tpl (printf "{{ $volumeName := \"%s\" }}%s" $volumeName $volume.extraVolumeMounts) $ | indent 12 | trim }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ .Values.volume.port }}
|
- containerPort: {{ $volume.port }}
|
||||||
name: swfs-vol
|
name: swfs-vol
|
||||||
{{- if .Values.volume.metricsPort }}
|
{{- if $volume.metricsPort }}
|
||||||
- containerPort: {{ .Values.volume.metricsPort }}
|
- containerPort: {{ $volume.metricsPort }}
|
||||||
name: metrics
|
name: metrics
|
||||||
{{- end }}
|
{{- end }}
|
||||||
- containerPort: {{ .Values.volume.grpcPort }}
|
- containerPort: {{ $volume.grpcPort }}
|
||||||
name: swfs-vol-grpc
|
name: swfs-vol-grpc
|
||||||
{{- if .Values.volume.readinessProbe.enabled }}
|
{{- if $volume.readinessProbe.enabled }}
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: {{ .Values.volume.readinessProbe.httpGet.path }}
|
path: {{ $volume.readinessProbe.httpGet.path }}
|
||||||
port: {{ .Values.volume.port }}
|
port: {{ $volume.port }}
|
||||||
scheme: {{ .Values.volume.readinessProbe.scheme }}
|
scheme: {{ $volume.readinessProbe.scheme }}
|
||||||
initialDelaySeconds: {{ .Values.volume.readinessProbe.initialDelaySeconds }}
|
initialDelaySeconds: {{ $volume.readinessProbe.initialDelaySeconds }}
|
||||||
periodSeconds: {{ .Values.volume.readinessProbe.periodSeconds }}
|
periodSeconds: {{ $volume.readinessProbe.periodSeconds }}
|
||||||
successThreshold: {{ .Values.volume.readinessProbe.successThreshold }}
|
successThreshold: {{ $volume.readinessProbe.successThreshold }}
|
||||||
failureThreshold: {{ .Values.volume.readinessProbe.failureThreshold }}
|
failureThreshold: {{ $volume.readinessProbe.failureThreshold }}
|
||||||
timeoutSeconds: {{ .Values.volume.readinessProbe.timeoutSeconds }}
|
timeoutSeconds: {{ $volume.readinessProbe.timeoutSeconds }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.livenessProbe.enabled }}
|
{{- if $volume.livenessProbe.enabled }}
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: {{ .Values.volume.livenessProbe.httpGet.path }}
|
path: {{ $volume.livenessProbe.httpGet.path }}
|
||||||
port: {{ .Values.volume.port }}
|
port: {{ $volume.port }}
|
||||||
scheme: {{ .Values.volume.livenessProbe.scheme }}
|
scheme: {{ $volume.livenessProbe.scheme }}
|
||||||
initialDelaySeconds: {{ .Values.volume.livenessProbe.initialDelaySeconds }}
|
initialDelaySeconds: {{ $volume.livenessProbe.initialDelaySeconds }}
|
||||||
periodSeconds: {{ .Values.volume.livenessProbe.periodSeconds }}
|
periodSeconds: {{ $volume.livenessProbe.periodSeconds }}
|
||||||
successThreshold: {{ .Values.volume.livenessProbe.successThreshold }}
|
successThreshold: {{ $volume.livenessProbe.successThreshold }}
|
||||||
failureThreshold: {{ .Values.volume.livenessProbe.failureThreshold }}
|
failureThreshold: {{ $volume.livenessProbe.failureThreshold }}
|
||||||
timeoutSeconds: {{ .Values.volume.livenessProbe.timeoutSeconds }}
|
timeoutSeconds: {{ $volume.livenessProbe.timeoutSeconds }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.volume.resources }}
|
{{- with $volume.resources }}
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml . | nindent 12 }}
|
{{- toYaml . | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.containerSecurityContext.enabled }}
|
{{- if $volume.containerSecurityContext.enabled }}
|
||||||
securityContext: {{- omit .Values.volume.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
securityContext: {{- omit $volume.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.sidecars }}
|
{{- if $volume.sidecars }}
|
||||||
{{- include "common.tplvalues.render" (dict "value" .Values.volume.sidecars "context" $) | nindent 8 }}
|
{{- include "common.tplvalues.render" (dict "value" (printf "{{ $volumeName := \"%s\" }}%s" $volumeName $volume.sidecars) "context" $) | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumes:
|
volumes:
|
||||||
|
|
||||||
{{- range $dir := .Values.volume.dataDirs }}
|
{{- range $dir := $volume.dataDirs }}
|
||||||
|
|
||||||
{{- if eq $dir.type "hostPath" }}
|
{{- if eq $dir.type "hostPath" }}
|
||||||
- name: {{ $dir.name }}
|
- name: {{ $dir.name }}
|
||||||
@@ -292,70 +302,70 @@ spec:
|
|||||||
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if .Values.volume.idx }}
|
{{- if $volume.idx }}
|
||||||
{{- if eq .Values.volume.idx.type "hostPath" }}
|
{{- if eq $volume.idx.type "hostPath" }}
|
||||||
- name: idx
|
- name: idx
|
||||||
hostPath:
|
hostPath:
|
||||||
path: {{ .Values.volume.idx.hostPathPrefix }}/seaweedfs-volume-idx/
|
path: {{ $volume.idx.hostPathPrefix }}/seaweedfs-volume-idx/
|
||||||
type: DirectoryOrCreate
|
type: DirectoryOrCreate
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .Values.volume.idx.type "existingClaim" }}
|
{{- if eq $volume.idx.type "existingClaim" }}
|
||||||
- name: idx
|
- name: idx
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ .Values.volume.idx.claimName }}
|
claimName: {{ $volume.idx.claimName }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .Values.volume.idx.type "emptyDir" }}
|
{{- if eq $volume.idx.type "emptyDir" }}
|
||||||
- name: idx
|
- name: idx
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if .Values.volume.logs }}
|
{{- if $volume.logs }}
|
||||||
{{- if eq .Values.volume.logs.type "hostPath" }}
|
{{- if eq $volume.logs.type "hostPath" }}
|
||||||
- name: logs
|
- name: logs
|
||||||
hostPath:
|
hostPath:
|
||||||
path: {{ .Values.volume.logs.hostPathPrefix }}/logs/seaweedfs/volume
|
path: {{ $volume.logs.hostPathPrefix }}/logs/seaweedfs/volume
|
||||||
type: DirectoryOrCreate
|
type: DirectoryOrCreate
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .Values.volume.logs.type "existingClaim" }}
|
{{- if eq $volume.logs.type "existingClaim" }}
|
||||||
- name: logs
|
- name: logs
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ .Values.volume.logs.claimName }}
|
claimName: {{ $volume.logs.claimName }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .Values.volume.logs.type "emptyDir" }}
|
{{- if eq $volume.logs.type "emptyDir" }}
|
||||||
- name: logs
|
- name: logs
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.global.enableSecurity }}
|
{{- if $.Values.global.enableSecurity }}
|
||||||
- name: security-config
|
- name: security-config
|
||||||
configMap:
|
configMap:
|
||||||
name: {{ template "seaweedfs.name" . }}-security-config
|
name: {{ template "seaweedfs.name" $ }}-security-config
|
||||||
- name: ca-cert
|
- name: ca-cert
|
||||||
secret:
|
secret:
|
||||||
secretName: {{ template "seaweedfs.name" . }}-ca-cert
|
secretName: {{ template "seaweedfs.name" $ }}-ca-cert
|
||||||
- name: master-cert
|
- name: master-cert
|
||||||
secret:
|
secret:
|
||||||
secretName: {{ template "seaweedfs.name" . }}-master-cert
|
secretName: {{ template "seaweedfs.name" $ }}-master-cert
|
||||||
- name: volume-cert
|
- name: volume-cert
|
||||||
secret:
|
secret:
|
||||||
secretName: {{ template "seaweedfs.name" . }}-volume-cert
|
secretName: {{ template "seaweedfs.name" $ }}-volume-cert
|
||||||
- name: filer-cert
|
- name: filer-cert
|
||||||
secret:
|
secret:
|
||||||
secretName: {{ template "seaweedfs.name" . }}-filer-cert
|
secretName: {{ template "seaweedfs.name" $ }}-filer-cert
|
||||||
- name: client-cert
|
- name: client-cert
|
||||||
secret:
|
secret:
|
||||||
secretName: {{ template "seaweedfs.name" . }}-client-cert
|
secretName: {{ template "seaweedfs.name" $ }}-client-cert
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.extraVolumes }}
|
{{- if $volume.extraVolumes }}
|
||||||
{{ tpl .Values.volume.extraVolumes . | indent 8 | trim }}
|
{{ tpl $volume.extraVolumes $ | indent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.volume.nodeSelector }}
|
{{- if $volume.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{ tpl .Values.volume.nodeSelector . | indent 8 | trim }}
|
{{ tpl (printf "{{ $volumeName := \"%s\" }}%s" $volumeName $volume.nodeSelector) $ | indent 8 | trim }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumeClaimTemplates:
|
volumeClaimTemplates:
|
||||||
{{- range $dir := .Values.volume.dataDirs }}
|
{{- range $dir := $volume.dataDirs }}
|
||||||
{{- if eq $dir.type "persistentVolumeClaim" }}
|
{{- if eq $dir.type "persistentVolumeClaim" }}
|
||||||
- apiVersion: v1
|
- apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
@@ -374,36 +384,37 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if and .Values.volume.idx (eq .Values.volume.idx.type "persistentVolumeClaim") }}
|
{{- if and $volume.idx (eq $volume.idx.type "persistentVolumeClaim") }}
|
||||||
- apiVersion: v1
|
- apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: idx
|
name: idx
|
||||||
{{- with .Values.volume.idx.annotations }}
|
{{- with $volume.idx.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml . | nindent 10 }}
|
{{- toYaml . | nindent 10 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
storageClassName: {{ .Values.volume.idx.storageClass }}
|
storageClassName: {{ $volume.idx.storageClass }}
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: {{ .Values.volume.idx.size }}
|
storage: {{ $volume.idx.size }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and .Values.volume.logs (eq .Values.volume.logs.type "persistentVolumeClaim") }}
|
{{- if and $volume.logs (eq $volume.logs.type "persistentVolumeClaim") }}
|
||||||
- apiVersion: v1
|
- apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: logs
|
name: logs
|
||||||
{{- with .Values.volume.logs.annotations }}
|
{{- with $volume.logs.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml . | nindent 10 }}
|
{{- toYaml . | nindent 10 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
storageClassName: {{ .Values.volume.logs.storageClass }}
|
storageClassName: {{ $volume.logs.storageClass }}
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: {{ .Values.volume.logs.size }}
|
storage: {{ $volume.logs.size }}
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ master:
|
|||||||
# Topology Spread Constraints Settings
|
# Topology Spread Constraints Settings
|
||||||
# This should map directly to the value of the topologySpreadConstraints
|
# This should map directly to the value of the topologySpreadConstraints
|
||||||
# for a PodSpec. By Default no constraints are set.
|
# for a PodSpec. By Default no constraints are set.
|
||||||
topologySpreadConstraints: null
|
topologySpreadConstraints: ""
|
||||||
|
|
||||||
# Toleration Settings for master pods
|
# Toleration Settings for master pods
|
||||||
# This should be a multi-line string matching the Toleration array
|
# This should be a multi-line string matching the Toleration array
|
||||||
@@ -456,13 +456,13 @@ volume:
|
|||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
app.kubernetes.io/component: volume
|
app.kubernetes.io/component: {{ $volumeName }}
|
||||||
topologyKey: kubernetes.io/hostname
|
topologyKey: kubernetes.io/hostname
|
||||||
|
|
||||||
# Topology Spread Constraints Settings
|
# Topology Spread Constraints Settings
|
||||||
# This should map directly to the value of the topologySpreadConstraints
|
# This should map directly to the value of the topologySpreadConstraints
|
||||||
# for a PodSpec. By Default no constraints are set.
|
# for a PodSpec. By Default no constraints are set.
|
||||||
topologySpreadConstraints: null
|
topologySpreadConstraints: ""
|
||||||
|
|
||||||
# Resource requests, limits, etc. for the server cluster placement. This
|
# Resource requests, limits, etc. for the server cluster placement. This
|
||||||
# should map directly to the value of the resources field for a PodSpec,
|
# should map directly to the value of the resources field for a PodSpec,
|
||||||
@@ -538,6 +538,31 @@ volume:
|
|||||||
failureThreshold: 100
|
failureThreshold: 100
|
||||||
timeoutSeconds: 30
|
timeoutSeconds: 30
|
||||||
|
|
||||||
|
# Map of named volume groups for topology-aware deployments.
|
||||||
|
# Each key inherits all fields from the `volume` section but can override
|
||||||
|
# them locally—for example, replicas, nodeSelector, dataCenter, etc.
|
||||||
|
# To switch entirely to this scheme, set `volume.enabled: false`
|
||||||
|
# and define one entry per zone/data-center under `volumes`.
|
||||||
|
#
|
||||||
|
# volumes:
|
||||||
|
# dc1:
|
||||||
|
# replicas: 2
|
||||||
|
# dataCenter: "dc1"
|
||||||
|
# nodeSelector: |
|
||||||
|
# topology.kubernetes.io/zone: dc1
|
||||||
|
# dc2:
|
||||||
|
# replicas: 2
|
||||||
|
# dataCenter: "dc2"
|
||||||
|
# nodeSelector: |
|
||||||
|
# topology.kubernetes.io/zone: dc2
|
||||||
|
# dc3:
|
||||||
|
# replicas: 2
|
||||||
|
# dataCenter: "dc3"
|
||||||
|
# nodeSelector: |
|
||||||
|
# topology.kubernetes.io/zone: dc3
|
||||||
|
#
|
||||||
|
volumes: {}
|
||||||
|
|
||||||
filer:
|
filer:
|
||||||
enabled: true
|
enabled: true
|
||||||
imageOverride: null
|
imageOverride: null
|
||||||
@@ -690,7 +715,7 @@ filer:
|
|||||||
# Topology Spread Constraints Settings
|
# Topology Spread Constraints Settings
|
||||||
# This should map directly to the value of the topologySpreadConstraints
|
# This should map directly to the value of the topologySpreadConstraints
|
||||||
# for a PodSpec. By Default no constraints are set.
|
# for a PodSpec. By Default no constraints are set.
|
||||||
topologySpreadConstraints: null
|
topologySpreadConstraints: ""
|
||||||
|
|
||||||
# updatePartition is used to control a careful rolling update of SeaweedFS
|
# updatePartition is used to control a careful rolling update of SeaweedFS
|
||||||
# masters.
|
# masters.
|
||||||
@@ -1146,7 +1171,7 @@ allInOne:
|
|||||||
# Topology Spread Constraints Settings
|
# Topology Spread Constraints Settings
|
||||||
# This should map directly to the value of the topologySpreadConstraints
|
# This should map directly to the value of the topologySpreadConstraints
|
||||||
# for a PodSpec. By Default no constraints are set.
|
# for a PodSpec. By Default no constraints are set.
|
||||||
topologySpreadConstraints: null
|
topologySpreadConstraints: ""
|
||||||
|
|
||||||
# Toleration Settings for master pods
|
# Toleration Settings for master pods
|
||||||
# This should be a multi-line string matching the Toleration array
|
# This should be a multi-line string matching the Toleration array
|
||||||
|
|||||||
Reference in New Issue
Block a user