@@ -16,7 +16,8 @@ Return the target Kubernetes version
16
16
Return the appropriate apiVersion for poddisruptionbudget.
17
17
*/} }
18
18
{ {- define " common.capabilities.policy.apiVersion" -} }
19
- { {- if semverCompare " <1.21-0" (include " common.capabilities.kubeVersion" .) -} }
19
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
20
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.21-0" $kubeVersion ) -} }
20
21
{ {- print " policy/v1beta1" -} }
21
22
{ {- else -} }
22
23
{ {- print " policy/v1" -} }
@@ -27,7 +28,8 @@ Return the appropriate apiVersion for poddisruptionbudget.
27
28
Return the appropriate apiVersion for networkpolicy.
28
29
*/} }
29
30
{ {- define " common.capabilities.networkPolicy.apiVersion" -} }
30
- { {- if semverCompare " <1.7-0" (include " common.capabilities.kubeVersion" .) -} }
31
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
32
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.7-0" $kubeVersion ) -} }
31
33
{ {- print " extensions/v1beta1" -} }
32
34
{ {- else -} }
33
35
{ {- print " networking.k8s.io/v1" -} }
@@ -38,7 +40,8 @@ Return the appropriate apiVersion for networkpolicy.
38
40
Return the appropriate apiVersion for cronjob.
39
41
*/} }
40
42
{ {- define " common.capabilities.cronjob.apiVersion" -} }
41
- { {- if semverCompare " <1.21-0" (include " common.capabilities.kubeVersion" .) -} }
43
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
44
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.21-0" $kubeVersion ) -} }
42
45
{ {- print " batch/v1beta1" -} }
43
46
{ {- else -} }
44
47
{ {- print " batch/v1" -} }
@@ -49,7 +52,8 @@ Return the appropriate apiVersion for cronjob.
49
52
Return the appropriate apiVersion for daemonset.
50
53
*/} }
51
54
{ {- define " common.capabilities.daemonset.apiVersion" -} }
52
- { {- if semverCompare " <1.14-0" (include " common.capabilities.kubeVersion" .) -} }
55
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
56
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.14-0" $kubeVersion ) -} }
53
57
{ {- print " extensions/v1beta1" -} }
54
58
{ {- else -} }
55
59
{ {- print " apps/v1" -} }
@@ -60,7 +64,8 @@ Return the appropriate apiVersion for daemonset.
60
64
Return the appropriate apiVersion for deployment.
61
65
*/} }
62
66
{ {- define " common.capabilities.deployment.apiVersion" -} }
63
- { {- if semverCompare " <1.14-0" (include " common.capabilities.kubeVersion" .) -} }
67
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
68
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.14-0" $kubeVersion ) -} }
64
69
{ {- print " extensions/v1beta1" -} }
65
70
{ {- else -} }
66
71
{ {- print " apps/v1" -} }
@@ -71,7 +76,8 @@ Return the appropriate apiVersion for deployment.
71
76
Return the appropriate apiVersion for statefulset.
72
77
*/} }
73
78
{ {- define " common.capabilities.statefulset.apiVersion" -} }
74
- { {- if semverCompare " <1.14-0" (include " common.capabilities.kubeVersion" .) -} }
79
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
80
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.14-0" $kubeVersion ) -} }
75
81
{ {- print " apps/v1beta1" -} }
76
82
{ {- else -} }
77
83
{ {- print " apps/v1" -} }
@@ -82,30 +88,24 @@ Return the appropriate apiVersion for statefulset.
82
88
Return the appropriate apiVersion for ingress.
83
89
*/} }
84
90
{ {- define " common.capabilities.ingress.apiVersion" -} }
85
- { {- if .Values.ingress -} }
86
- { {- if .Values.ingress.apiVersion -} }
91
+ { {- $ kubeVersion := include " common.capabilities.kubeVersion " . -} }
92
+ { {- if ( .Values.ingress) .apiVersion -} }
87
93
{ {- .Values.ingress.apiVersion -} }
88
- { {- else if semverCompare " <1.14-0" ( include " common.capabilities. kubeVersion" . ) -} }
94
+ { {- else if and ( not (empty $ kubeVersion )) ( semverCompare " <1.14-0" $ kubeVersion ) -} }
89
95
{ {- print " extensions/v1beta1" -} }
90
- { {- else if semverCompare " <1.19-0" ( include " common.capabilities. kubeVersion" . ) -} }
96
+ { {- else if and ( not (empty $ kubeVersion )) ( semverCompare " <1.19-0" $ kubeVersion ) -} }
91
97
{ {- print " networking.k8s.io/v1beta1" -} }
92
98
{ {- else -} }
93
99
{ {- print " networking.k8s.io/v1" -} }
94
100
{ {- end } }
95
- { {- else if semverCompare " <1.14-0" (include " common.capabilities.kubeVersion" .) -} }
96
- { {- print " extensions/v1beta1" -} }
97
- { {- else if semverCompare " <1.19-0" (include " common.capabilities.kubeVersion" .) -} }
98
- { {- print " networking.k8s.io/v1beta1" -} }
99
- { {- else -} }
100
- { {- print " networking.k8s.io/v1" -} }
101
- { {- end -} }
102
101
{ {- end -} }
103
102
104
103
{ {/*
105
104
Return the appropriate apiVersion for RBAC resources.
106
105
*/} }
107
106
{ {- define " common.capabilities.rbac.apiVersion" -} }
108
- { {- if semverCompare " <1.17-0" (include " common.capabilities.kubeVersion" .) -} }
107
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
108
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.17-0" $kubeVersion ) -} }
109
109
{ {- print " rbac.authorization.k8s.io/v1beta1" -} }
110
110
{ {- else -} }
111
111
{ {- print " rbac.authorization.k8s.io/v1" -} }
@@ -116,7 +116,8 @@ Return the appropriate apiVersion for RBAC resources.
116
116
Return the appropriate apiVersion for CRDs.
117
117
*/} }
118
118
{ {- define " common.capabilities.crd.apiVersion" -} }
119
- { {- if semverCompare " <1.19-0" (include " common.capabilities.kubeVersion" .) -} }
119
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
120
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.19-0" $kubeVersion ) -} }
120
121
{ {- print " apiextensions.k8s.io/v1beta1" -} }
121
122
{ {- else -} }
122
123
{ {- print " apiextensions.k8s.io/v1" -} }
@@ -127,7 +128,8 @@ Return the appropriate apiVersion for CRDs.
127
128
Return the appropriate apiVersion for APIService.
128
129
*/} }
129
130
{ {- define " common.capabilities.apiService.apiVersion" -} }
130
- { {- if semverCompare " <1.10-0" (include " common.capabilities.kubeVersion" .) -} }
131
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
132
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.10-0" $kubeVersion ) -} }
131
133
{ {- print " apiregistration.k8s.io/v1beta1" -} }
132
134
{ {- else -} }
133
135
{ {- print " apiregistration.k8s.io/v1" -} }
@@ -138,7 +140,8 @@ Return the appropriate apiVersion for APIService.
138
140
Return the appropriate apiVersion for Horizontal Pod Autoscaler.
139
141
*/} }
140
142
{ {- define " common.capabilities.hpa.apiVersion" -} }
141
- { {- if semverCompare " <1.23-0" (include " common.capabilities.kubeVersion" .context) -} }
143
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" .context -} }
144
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.23-0" $kubeVersion ) -} }
142
145
{ {- if .beta2 -} }
143
146
{ {- print " autoscaling/v2beta2" -} }
144
147
{ {- else -} }
@@ -153,7 +156,8 @@ Return the appropriate apiVersion for Horizontal Pod Autoscaler.
153
156
Return the appropriate apiVersion for Vertical Pod Autoscaler.
154
157
*/} }
155
158
{ {- define " common.capabilities.vpa.apiVersion" -} }
156
- { {- if semverCompare " <1.23-0" (include " common.capabilities.kubeVersion" .context) -} }
159
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" .context -} }
160
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.23-0" $kubeVersion ) -} }
157
161
{ {- if .beta2 -} }
158
162
{ {- print " autoscaling/v2beta2" -} }
159
163
{ {- else -} }
@@ -168,7 +172,8 @@ Return the appropriate apiVersion for Vertical Pod Autoscaler.
168
172
Returns true if PodSecurityPolicy is supported
169
173
*/} }
170
174
{ {- define " common.capabilities.psp.supported" -} }
171
- { {- if semverCompare " <1.25-0" (include " common.capabilities.kubeVersion" .) -} }
175
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
176
+ { {- if or (empty $kubeVersion ) (semverCompare " <1.25-0" $kubeVersion ) -} }
172
177
{ {- true -} }
173
178
{ {- end -} }
174
179
{ {- end -} }
@@ -177,7 +182,8 @@ Returns true if PodSecurityPolicy is supported
177
182
Returns true if AdmissionConfiguration is supported
178
183
*/} }
179
184
{ {- define " common.capabilities.admissionConfiguration.supported" -} }
180
- { {- if semverCompare " >=1.23-0" (include " common.capabilities.kubeVersion" .) -} }
185
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
186
+ { {- if or (empty $kubeVersion ) (not (semverCompare " <1.23-0" $kubeVersion )) -} }
181
187
{ {- true -} }
182
188
{ {- end -} }
183
189
{ {- end -} }
@@ -186,9 +192,10 @@ Returns true if AdmissionConfiguration is supported
186
192
Return the appropriate apiVersion for AdmissionConfiguration.
187
193
*/} }
188
194
{ {- define " common.capabilities.admissionConfiguration.apiVersion" -} }
189
- { {- if semverCompare " <1.23-0" (include " common.capabilities.kubeVersion" .) -} }
195
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
196
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.23-0" $kubeVersion ) -} }
190
197
{ {- print " apiserver.config.k8s.io/v1alpha1" -} }
191
- { {- else if semverCompare " <1.25-0" ( include " common.capabilities. kubeVersion" . ) -} }
198
+ { {- else if and ( not (empty $ kubeVersion )) ( semverCompare " <1.25-0" $ kubeVersion ) -} }
192
199
{ {- print " apiserver.config.k8s.io/v1beta1" -} }
193
200
{ {- else -} }
194
201
{ {- print " apiserver.config.k8s.io/v1" -} }
@@ -199,9 +206,10 @@ Return the appropriate apiVersion for AdmissionConfiguration.
199
206
Return the appropriate apiVersion for PodSecurityConfiguration.
200
207
*/} }
201
208
{ {- define " common.capabilities.podSecurityConfiguration.apiVersion" -} }
202
- { {- if semverCompare " <1.23-0" (include " common.capabilities.kubeVersion" .) -} }
209
+ { {- $kubeVersion := include " common.capabilities.kubeVersion" . -} }
210
+ { {- if and (not (empty $kubeVersion )) (semverCompare " <1.23-0" $kubeVersion ) -} }
203
211
{ {- print " pod-security.admission.config.k8s.io/v1alpha1" -} }
204
- { {- else if semverCompare " <1.25-0" ( include " common.capabilities. kubeVersion" . ) -} }
212
+ { {- else if and ( not (empty $ kubeVersion )) ( semverCompare " <1.25-0" $ kubeVersion ) -} }
205
213
{ {- print " pod-security.admission.config.k8s.io/v1beta1" -} }
206
214
{ {- else -} }
207
215
{ {- print " pod-security.admission.config.k8s.io/v1" -} }
0 commit comments