Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helm flag to enable/disable installation of valwebhook #1327

Merged
merged 3 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions helm/kanister-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ spec:
{{ include "kanister-operator.helmLabels" . | indent 8}}
spec:
serviceAccountName: {{ template "kanister-operator.serviceAccountName" . }}
{{- if .Values.bpValidatingWebhook.enabled }}
volumes:
- name: webhook-certs
secret:
secretName: kanister-webhook-certs
{{- end }}
containers:
- name: {{ template "kanister-operator.fullname" . }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.bpValidatingWebhook.enabled }}
volumeMounts:
- name: webhook-certs
mountPath: /var/run/webhook/serving-cert
{{- end }}
env:
- name: CREATEORUPDATE_CRDS
value: {{ .Values.controller.updateCRDs | quote }}
Expand Down
2 changes: 2 additions & 0 deletions helm/kanister-operator/templates/validating-webhook.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.bpValidatingWebhook.enabled -}}
{{ $altNames := list ( printf "%s.%s" ( include "kanister-operator.fullname" . ) .Release.Namespace ) ( printf "%s.%s.svc" ( include "kanister-operator.fullname" . ) .Release.Namespace ) }}
# generate ca cert with 365 days of validity
{{ $ca := genCA ( printf "%s-ca" ( include "kanister-operator.fullname" . ) ) 365 }}
Expand Down Expand Up @@ -34,3 +35,4 @@ webhooks:
admissionReviewVersions: ["v1", "v1beta1"]
sideEffects: None
timeoutSeconds: 5
{{- end -}}
2 changes: 2 additions & 0 deletions helm/kanister-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ controller:
# false : CRDs would be created by helm
# true : CRDs would be created by kanister controller
updateCRDs: true
bpValidatingWebhook:
enabled: true
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand Down
7 changes: 5 additions & 2 deletions pkg/testing/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ func (h *HelmTestSuite) SetUpSuite(c *C) {

h.deploymentName = fmt.Sprintf("%s-%s", kanisterName, "kanister-operator")

helmValues := make(map[string]string)
helmValues := map[string]string{
"bpValidatingWebhook.enabled": "false",
}

kanisterApp, err := NewHelmApp(helmValues, kanisterName, "kanister/kanister-operator", kanisterName, "", false)
c.Assert(err, IsNil)
Expand All @@ -80,7 +82,8 @@ func (h *HelmTestSuite) TestUpgrade(c *C) {
c.Log("Upgrading the kanister release with local chart and updated image")
// upgrade the installed application
updatedValues := map[string]string{
"image.tag": "v9.99.9-dev",
"image.tag": "v9.99.9-dev",
"bpValidatingWebhook.enabled": "false",
}
c.Assert(h.helmApp.Upgrade("../../../helm/kanister-operator", updatedValues), IsNil)

Expand Down