rancher-charts/charts/rancher-wins-upgrader/100.0.0+up0.0.1/templates/daemonset.yaml

72 lines
2.7 KiB
YAML

{{- range .Values.winsConfigs }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ template "winsUpgrader.name" $ }}-{{ required "Must provide name for .Values.winsConfigs[].name" .name }}
namespace: {{ template "winsUpgrader.namespace" $ }}
labels: {{ include "winsUpgrader.labels" $ | nindent 4 }}
spec:
selector:
matchLabels: {{ include "winsUpgrader.labels" $ | nindent 6 }}
template:
metadata:
labels: {{ include "winsUpgrader.labels" $ | nindent 8 }}
spec:
nodeSelector: {{ include "winsUpgrader.nodeSelector" $ | nindent 8 }}
{{- if .nodeSelector }}
{{ toYaml .nodeSelector | indent 8 }}
{{- end }}
{{- if .tolerations }}
tolerations: {{ .tolerations | toYaml | nindent 8 }}
{{- else }}
tolerations: {{ include "winsUpgrader.tolerations" $ | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "winsUpgrader.name" $ }}
containers:
- name: noop
image: {{ template "system_default_registry" $ }}{{ required "Must provide name for .Values.winsConfigs[].image.repository" .image.repository }}:{{ required "Must provide name for .Values.winsConfigs[].tag" .image.tag }}
command: ["pwsh", "-f", "c:/scripts/noop.ps1"]
volumeMounts:
- name: upgrade-scripts
mountPath: c:/scripts
initContainers:
- name: wins-upgrader
image: {{ template "system_default_registry" $ }}{{ .image.repository }}:{{ .image.tag }}
command: ["pwsh", "-f", "c:/scripts/upgrade.ps1"]
volumeMounts:
- name: wins-pipe
mountPath: \\.\pipe\rancher_wins
- name: wins
mountPath: c:/host/etc/rancher/wins
- name: upgrade-scripts
mountPath: c:/scripts
env:
- name: HELM_REVISION_NUMBER
value: {{ $.Release.Revision | quote }}
- name: CATTLE_PREFIX_PATH
value: {{ default "c:\\" $.Values.global.cattle.rkeWindowsPathPrefix | replace "/" "\\" }}
{{- if $.Values.masquerade.enabled }}
- name: WINS_UPGRADE_PATH
value: {{ include "winsUpgrader.winsMasqueradePath" $ }}
{{- end }}
volumes:
- name: wins-pipe
hostPath:
path: \\.\pipe\rancher_wins
- name: wins
hostPath:
{{- if $.Values.masquerade.enabled }}
path: {{ include "winsUpgrader.winsMasqueradeHostPath" $ }}
type: DirectoryOrCreate
{{- else }}
path: {{ include "winsUpgrader.winsHostPath" $ }}
type: DirectoryOrCreate
{{- end }}
- name: upgrade-scripts
configMap:
name: {{ template "winsUpgrader.name" $ }}-{{ .name }}
---
{{- end }}
{{- if not .Values.winsConfigs }}
{{- fail "Cannot install chart unless at least one config is provided in .Values.winsConfigs" }}
{{- end }}