- Add securityContext.pod/container values with hardened defaults; the dockur/samba image requires root and a writable root filesystem, so the remaining deviations from the baseline are documented in values.yaml (caps reduced to CHOWN, DAC_OVERRIDE, FOWNER, NET_BIND_SERVICE, SETGID, SETUID; allowPrivilegeEscalation: false) - Make the NodePorts configurable (samba.smbNodePort/netbiosNodePort, defaults 30445/30139 as published before) - Rename secrets.sambaUsersRef to secrets.sambaUsersSecretRef (breaking) - Rename the ConfigMap from -config-cfm to -configmap - Add the tpl-rendered env value convention (value, secretKeyRef, configMapKeyRef forms) - Fix the CI users.conf fixture to the username:uid:groupname:gid:password format the pinned image actually parses - Bump chart to 4.0.0+up4.23.10 Part of #32
98 lines
3.6 KiB
YAML
98 lines
3.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
spec:
|
|
replicas: {{ include "samba.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.samba.replicas) }}
|
|
serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service
|
|
selector:
|
|
matchLabels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
template:
|
|
metadata:
|
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
labels:
|
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
spec:
|
|
containers:
|
|
- name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
|
image: "ghcr.io/dockur/samba:{{ .Chart.AppVersion }}"
|
|
imagePullPolicy: IfNotPresent
|
|
{{- with .Values.samba.env }}
|
|
env:
|
|
{{- range $value := . }}
|
|
{{- if $value.value }}
|
|
- name: {{ $value.name }}
|
|
value: {{ tpl $value.value $ | quote }}
|
|
{{- else if $value.valueFrom }}
|
|
{{- if $value.valueFrom.secretKeyRef }}
|
|
- name: {{ $value.name }}
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ tpl $value.valueFrom.secretKeyRef.name $ | quote }}
|
|
key: {{ tpl $value.valueFrom.secretKeyRef.key $ | quote }}
|
|
{{- else if $value.valueFrom.configMapKeyRef }}
|
|
- name: {{ $value.name }}
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: {{ tpl $value.valueFrom.configMapKeyRef.name $ | quote }}
|
|
key: {{ tpl $value.valueFrom.configMapKeyRef.key $ | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
ports:
|
|
- containerPort: 445
|
|
protocol: TCP
|
|
- containerPort: 139
|
|
protocol: TCP
|
|
volumeMounts:
|
|
- name: smb-config
|
|
mountPath: "/etc/samba/smb.conf"
|
|
readOnly: true
|
|
subPath: smb.conf
|
|
- name: smb-users
|
|
mountPath: "/etc/samba/users.conf"
|
|
readOnly: true
|
|
subPath: users.conf
|
|
{{- range $index, $value := .Values.samba.shares }}
|
|
|
|
- name: "{{ $value.name }}"
|
|
mountPath: "/shares/{{ $value.name }}"
|
|
{{- end }}
|
|
livenessProbe:
|
|
{{- toYaml .Values.samba.livenessProbe | nindent 12 }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.samba.readinessProbe | nindent 12 }}
|
|
startupProbe:
|
|
{{- toYaml .Values.samba.startupProbe | nindent 12 }}
|
|
resources:
|
|
{{- include "samba.resources" .Values.samba.resources | nindent 12 }}
|
|
securityContext:
|
|
{{- toYaml .Values.samba.securityContext.container | nindent 12 }}
|
|
restartPolicy: Always
|
|
automountServiceAccountToken: false
|
|
securityContext:
|
|
{{- toYaml .Values.samba.securityContext.pod | nindent 8 }}
|
|
volumes:
|
|
- name: smb-config
|
|
configMap:
|
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-configmap
|
|
items:
|
|
- key: smb.conf
|
|
path: smb.conf
|
|
- name: smb-users
|
|
secret:
|
|
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-users-secret
|
|
items:
|
|
- key: users.conf
|
|
path: users.conf
|
|
{{- range $index, $value := .Values.samba.shares }}
|
|
|
|
- name: "{{ $value.name }}"
|
|
persistentVolumeClaim:
|
|
claimName: "{{ $.Release.Name }}-{{ $value.name }}-volume-claim"
|
|
{{- end }}
|