|
18 | 18 | {{- end -}}
|
19 | 19 |
|
20 | 20 | {{/* Bump $defaultTag value whenever k8s version is bumped */}}
|
21 |
| -{{- define "vcluster.k8s.controllerManager.image.tag" -}} |
| 21 | +{{- define "vcluster.k8s.image.tag" -}} |
22 | 22 | {{- $defaultTag := "v1.32.1" -}}
|
23 |
| -{{- if and (not (empty .Values.controlPlane.distro.k8s.version)) (eq .Values.controlPlane.distro.k8s.controllerManager.image.tag $defaultTag) -}} |
| 23 | +{{- if and (not (empty .Values.controlPlane.distro.k8s.version)) (eq .Values.controlPlane.distro.k8s.image.tag $defaultTag) -}} |
24 | 24 | {{ .Values.controlPlane.distro.k8s.version }}
|
25 | 25 | {{- else -}}
|
26 |
| -{{- if not (eq .Values.controlPlane.distro.k8s.controllerManager.image.tag $defaultTag) -}} |
27 |
| -{{ .Values.controlPlane.distro.k8s.controllerManager.image.tag }} |
| 26 | +{{- if not (eq .Values.controlPlane.distro.k8s.image.tag $defaultTag) -}} |
| 27 | +{{ .Values.controlPlane.distro.k8s.image.tag }} |
28 | 28 | {{- else if not (empty (include "vcluster.k8s.capabilities.version" .)) -}}
|
29 | 29 | {{ include "vcluster.k8s.capabilities.version" . }}
|
30 | 30 | {{- else -}}
|
31 |
| -{{ .Values.controlPlane.distro.k8s.controllerManager.image.tag }} |
32 |
| -{{- end -}} |
33 |
| -{{- end -}} |
34 |
| -{{- end -}} |
35 |
| - |
36 |
| -{{/* Bump $defaultTag value whenever k8s version is bumped */}} |
37 |
| -{{- define "vcluster.k8s.apiServer.image.tag" -}} |
38 |
| -{{- $defaultTag := "v1.32.1" -}} |
39 |
| -{{- if and (not (empty .Values.controlPlane.distro.k8s.version)) (eq .Values.controlPlane.distro.k8s.apiServer.image.tag $defaultTag) -}} |
40 |
| -{{ .Values.controlPlane.distro.k8s.version}} |
41 |
| -{{- else -}} |
42 |
| -{{- if not (eq .Values.controlPlane.distro.k8s.apiServer.image.tag $defaultTag) -}} |
43 |
| -{{ .Values.controlPlane.distro.k8s.apiServer.image.tag }} |
44 |
| -{{- else if not (empty (include "vcluster.k8s.capabilities.version" .)) -}} |
45 |
| -{{ include "vcluster.k8s.capabilities.version" . }} |
46 |
| -{{- else -}} |
47 |
| -{{ .Values.controlPlane.distro.k8s.apiServer.image.tag }} |
48 |
| -{{- end -}} |
49 |
| -{{- end -}} |
50 |
| -{{- end -}} |
51 |
| - |
52 |
| - |
53 |
| -{{/* Bump $defaultTag value whenever k8s version is bumped */}} |
54 |
| -{{- define "vcluster.k8s.scheduler.image.tag" -}} |
55 |
| -{{- $defaultTag := "v1.32.1" -}} |
56 |
| -{{- if and (not (empty .Values.controlPlane.distro.k8s.version)) (eq .Values.controlPlane.distro.k8s.scheduler.image.tag $defaultTag) -}} |
57 |
| -{{ .Values.controlPlane.distro.k8s.version}} |
58 |
| -{{- else -}} |
59 |
| -{{- if not (eq .Values.controlPlane.distro.k8s.scheduler.image.tag $defaultTag) -}} |
60 |
| -{{ .Values.controlPlane.distro.k8s.scheduler.image.tag }} |
61 |
| -{{- else if not (empty (include "vcluster.k8s.capabilities.version" .)) -}} |
62 |
| -{{ include "vcluster.k8s.capabilities.version" . }} |
63 |
| -{{- else -}} |
64 |
| -{{ .Values.controlPlane.distro.k8s.scheduler.image.tag }} |
| 31 | +{{ .Values.controlPlane.distro.k8s.image.tag }} |
65 | 32 | {{- end -}}
|
66 | 33 | {{- end -}}
|
67 | 34 | {{- end -}}
|
68 | 35 |
|
69 | 36 | {{- define "vcluster.k8s.initContainers" -}}
|
70 | 37 | {{- include "vcluster.oldPlugins.initContainers" . }}
|
71 | 38 | {{- include "vcluster.plugins.initContainers" . }}
|
72 |
| -# this is needed because the k8s containers are distroless and thus we don't have any |
73 |
| -# way of copying the binaries otherwise |
74 |
| -- name: vcluster-copy |
75 |
| - image: {{ include "vcluster.controlPlane.image" . | quote }} |
76 |
| - volumeMounts: |
77 |
| - - mountPath: /binaries |
78 |
| - name: binaries |
79 |
| - command: |
80 |
| - - /bin/sh |
81 |
| - args: |
82 |
| - - -c |
83 |
| - - "cp /vcluster /binaries/vcluster" |
84 |
| - {{- if .Values.controlPlane.statefulSet.imagePullPolicy }} |
85 |
| - imagePullPolicy: {{ .Values.controlPlane.statefulSet.imagePullPolicy }} |
86 |
| - {{- end }} |
87 |
| - securityContext: |
88 |
| -{{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }} |
89 |
| - resources: |
90 |
| -{{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }} |
91 |
| -{{- if .Values.controlPlane.distro.k8s.controllerManager.enabled }} |
92 |
| -- name: kube-controller-manager |
93 |
| - image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k8s.controllerManager.image.registry "repository" .Values.controlPlane.distro.k8s.controllerManager.image.repository "tag" (include "vcluster.k8s.controllerManager.image.tag" .)) }}" |
| 39 | +- name: kubernetes |
| 40 | + image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k8s.image.registry "repository" .Values.controlPlane.distro.k8s.image.repository "tag" (include "vcluster.k8s.image.tag" .)) }}" |
94 | 41 | volumeMounts:
|
95 | 42 | - mountPath: /binaries
|
96 | 43 | name: binaries
|
97 | 44 | command:
|
98 |
| - - /binaries/vcluster |
99 |
| - args: |
100 | 45 | - cp
|
101 |
| - - /usr/local/bin/kube-controller-manager |
102 |
| - - /binaries/kube-controller-manager |
103 |
| - {{- if .Values.controlPlane.distro.k8s.controllerManager.imagePullPolicy }} |
104 |
| - imagePullPolicy: {{ .Values.controlPlane.distro.k8s.controllerManager.imagePullPolicy }} |
105 |
| - {{- end }} |
106 |
| - securityContext: |
107 |
| -{{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }} |
108 |
| - resources: |
109 |
| -{{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }} |
110 |
| -{{- end }} |
111 |
| -{{- if .Values.controlPlane.advanced.virtualScheduler.enabled }} |
112 |
| -- name: kube-scheduler-manager |
113 |
| - image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k8s.scheduler.image.registry "repository" .Values.controlPlane.distro.k8s.scheduler.image.repository "tag" (include "vcluster.k8s.scheduler.image.tag" .)) }}" |
114 |
| - volumeMounts: |
115 |
| - - mountPath: /binaries |
116 |
| - name: binaries |
117 |
| - command: |
118 |
| - - /binaries/vcluster |
119 | 46 | args:
|
120 |
| - - cp |
121 |
| - - /usr/local/bin/kube-scheduler |
122 |
| - - /binaries/kube-scheduler |
123 |
| - {{- if .Values.controlPlane.distro.k8s.scheduler.imagePullPolicy }} |
124 |
| - imagePullPolicy: {{ .Values.controlPlane.distro.k8s.scheduler.imagePullPolicy }} |
125 |
| - {{- end }} |
126 |
| - securityContext: |
127 |
| -{{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }} |
128 |
| - resources: |
129 |
| -{{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }} |
130 |
| -{{- end }} |
131 |
| -{{- if .Values.controlPlane.distro.k8s.apiServer.enabled }} |
132 |
| -- name: kube-apiserver |
133 |
| - image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.k8s.apiServer.image.registry "repository" .Values.controlPlane.distro.k8s.apiServer.image.repository "tag" (include "vcluster.k8s.apiServer.image.tag" .)) }}" |
134 |
| - volumeMounts: |
135 |
| - - mountPath: /binaries |
136 |
| - name: binaries |
137 |
| - command: |
138 |
| - - /binaries/vcluster |
139 |
| - args: |
140 |
| - - cp |
141 |
| - - /usr/local/bin/kube-apiserver |
142 |
| - - /binaries/kube-apiserver |
143 |
| - {{- if .Values.controlPlane.distro.k8s.apiServer.imagePullPolicy }} |
144 |
| - imagePullPolicy: {{ .Values.controlPlane.distro.k8s.apiServer.imagePullPolicy }} |
| 47 | + - -a |
| 48 | + - /kubernetes/. |
| 49 | + - /binaries/ |
| 50 | + {{- if .Values.controlPlane.distro.k8s.imagePullPolicy }} |
| 51 | + imagePullPolicy: {{ .Values.controlPlane.distro.k8s.imagePullPolicy }} |
145 | 52 | {{- end }}
|
146 | 53 | securityContext:
|
147 | 54 | {{ toYaml .Values.controlPlane.distro.k8s.securityContext | indent 4 }}
|
148 | 55 | resources:
|
149 | 56 | {{ toYaml .Values.controlPlane.distro.k8s.resources | indent 4 }}
|
150 |
| -{{- end }} |
151 | 57 | {{- end -}}
|
152 | 58 |
|
153 | 59 | {{- define "vcluster.k3s.initContainers" -}}
|
|
0 commit comments