Skip to content

Commit 2053bf8

Browse files
committed
feat(helm): Adjust templates for CRD versioning/conversion
1 parent 481d327 commit 2053bf8

4 files changed

Lines changed: 27 additions & 7 deletions

File tree

deploy/helm/opa-operator/templates/deployment.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ spec:
2121
{{- toYaml . | nindent 8 }}
2222
{{- end }}
2323
labels:
24+
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
25+
webhook.stackable.tech/conversion: enabled
26+
{{- end }}
2427
{{- include "operator.selectorLabels" . | nindent 8 }}
2528
spec:
2629
{{- with .Values.image.pullSecrets }}
@@ -74,13 +77,16 @@ spec:
7477
fieldRef:
7578
fieldPath: spec.nodeName
7679

80+
- name: OPA_BUNDLE_BUILDER_CLUSTERROLE
81+
value: {{ include "operator.fullname" . }}-opa-bundle-builder-clusterrole
82+
7783
{{- if .Values.kubernetesClusterDomain }}
7884
- name: KUBERNETES_CLUSTER_DOMAIN
7985
value: {{ .Values.kubernetesClusterDomain | quote }}
8086
{{- end }}
87+
8188
{{- include "telemetry.envVars" . | nindent 12 }}
82-
- name: OPA_BUNDLE_BUILDER_CLUSTERROLE
83-
value: {{ include "operator.fullname" . }}-opa-bundle-builder-clusterrole
89+
{{- include "maintenance.envVars" . | nindent 12 }}
8490
volumes:
8591
- name: config-spec
8692
configMap:

deploy/helm/opa-operator/templates/roles.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ rules:
7878
- customresourcedefinitions
7979
verbs:
8080
- get
81+
# Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's
82+
# generated certificate in the conversion webhook.
83+
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
84+
- create
85+
- patch
86+
{{- end }}
8187
- apiGroups:
8288
- events.k8s.io
8389
resources:

deploy/helm/opa-operator/templates/service.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
21
---
32
apiVersion: v1
43
kind: Service
54
metadata:
6-
# Note(@sbernauer): We could also call the Service something like
7-
# "product-operator-conversion-webhook". However, in the future we will have more webhooks, and
8-
# it seems like an overkill to have a dedicated Service per webhook.
95
name: {{ include "operator.fullname" . }}
106
labels:
117
{{- include "operator.labels" . | nindent 4 }}
128
spec:
139
selector:
14-
{{- include "operator.selectorLabels" . | nindent 6 }}
10+
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
11+
webhook.stackable.tech/conversion: enabled
12+
{{- end }}
13+
{{- include "operator.selectorLabels" . | nindent 4 }}
1514
ports:
1615
- name: conversion-webhook
1716
protocol: TCP

deploy/helm/opa-operator/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ affinity: {}
5252
# See the https://docs.stackable.tech/home/stable/guides/kubernetes-cluster-domain guide for details.
5353
# kubernetesClusterDomain: my-cluster.local
5454

55+
maintenance:
56+
endOfSupportCheck:
57+
enabled: true
58+
# mode: offline
59+
# interval: 24h
60+
61+
customResourceDefinitions:
62+
maintain: true
63+
5564
# See all available options and detailed explanations about the concept here:
5665
# https://docs.stackable.tech/home/stable/concepts/telemetry/
5766
telemetry:

0 commit comments

Comments
 (0)