File tree Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,30 @@ apiVersion: cert-manager.io/v1
4545INSERT_CERTIFICATE_FROM_SECRET
4646{ {- end -} }
4747{ {- end } }
48+
49+ # https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-matchconditions
50+ { {- define " webhook.matchConditions" -} }
51+ matchConditions:
52+ - name: 'has-gmsa-credspec'
53+ expression: |
54+ object.spec.containers.exists(
55+ container,
56+ has(container.securityContext) &&
57+ has(container.securityContext.windowsOptions) &&
58+ has(container.securityContext.windowsOptions.gmsaCredentialSpecName) &&
59+ size(container.securityContext.windowsOptions.gmsaCredentialSpecName) >= 1
60+ )
61+ { {- end -} }
62+
63+ { {- define " kube.versionMinor" -} }
64+ { {- $v := .Capabilities.KubeVersion.Version -} }
65+ { {- if (and .Values.overrideKubeVersion.enabled .Values.overrideKubeVersion.version) -} }
66+ { {- $v = .Values.overrideKubeVersion.version -} }
67+ { {- end -} }
68+ { {- $kubeVersion := $v | replace " v" " " | split " ." -} }
69+ { {- if eq (len $kubeVersion ) 3 -} }
70+ { {- $kubeVersion ._1 -} }
71+ { {- else -} }
72+ { {- fail (printf " Invalid KubeVersion: %s" $v ) -} }
73+ { {- end -} }
74+ { {- end -} }
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ webhooks:
2525 failurePolicy : Fail
2626 admissionReviewVersions : ["v1", "v1beta1"]
2727 sideEffects : None
28+ {{- if ge ((include "kube.versionMinor" .) | int) 30 }}
29+ {{- (include "webhook.matchConditions" .) | nindent 4 }}
30+ {{- end }}
2831 # don't run on ${NAMESPACE}
2932 namespaceSelector :
3033 matchExpressions :
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ webhooks:
2525 failurePolicy : Fail
2626 admissionReviewVersions : ["v1", "v1beta1"]
2727 sideEffects : None
28+ {{- if ge ((include "kube.versionMinor" .) | int) 30 }}
29+ {{- (include "webhook.matchConditions" .) | nindent 4 }}
30+ {{- end }}
2831 # don't run on ${NAMESPACE}
2932 namespaceSelector :
3033 matchExpressions :
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ certificates:
1313
1414credential :
1515 enabled : false
16- hostAccountConfig : {}
16+ hostAccountConfig :
17+ {}
1718 # pluginGUID: "" # CCG Plugin GUID
1819 # portableCcgVersion: "1" # This needs to equal the current version of CCG which right now is '1'
1920 # pluginInput: "" # Format of this field is dependent upon specific CCG Plugin
@@ -56,3 +57,9 @@ tolerations: []
5657qps : 30.0
5758burst : 50
5859randomHostname : false
60+
61+ # override kubernetes server version rather than rely on kubectl / helm Capabilities.KubeVersion.*
62+ # - sometimes client kubectl might be version skewed from target cluster
63+ overrideKubeVersion :
64+ enabled : true
65+ version : v1.29.16
You can’t perform that action at this time.
0 commit comments