@@ -103,80 +103,8 @@ tasks:
103103 sync-crd-to-helm :
104104 desc : Sync generated CRD into Helm chart template (wraps CRD with Helm conditionals)
105105 deps : [manifests]
106- vars :
107- CRD_SOURCE : config/crd/bases/dataflow.dataflow.io_dataflows.yaml
108- HELM_TARGET : ../helm-charts/charts/dataflow-operator/templates/crd.yaml
109- CRON_CRD_SOURCE : config/crd/bases/dataflow.dataflow.io_dataflowcrons.yaml
110- CRON_HELM_TARGET : ../helm-charts/charts/dataflow-operator/templates/crd-dataflowcrons.yaml
111106 cmds :
112- - |
113- HEADER='{{- if .Values.crds.install }}'
114- FOOTER='{{- end }}'
115- LABELS_BLOCK=' labels:
116- {{- include "dataflow-operator.labels" . | nindent 4 }}'
117- KEEP_BLOCK=' {{- if .Values.crds.keep }}
118- "helm.sh/resource-policy": keep
119- {{- end }}'
120-
121- {
122- echo "$HEADER"
123- awk '
124- /^---$/ { next }
125- /^metadata:$/ {
126- print
127- getline
128- # annotations block
129- if ($0 ~ /^ annotations:/) {
130- print
131- # print existing annotations
132- while (getline > 0 && $0 ~ /^ [^ ]/) {
133- print
134- }
135- # insert keep annotation block
136- printf "%s\n", "'"$KEEP_BLOCK"'"
137- # insert labels block
138- printf "%s\n", "'"$LABELS_BLOCK"'"
139- print
140- }
141- next
142- }
143- { print }
144- ' "{{.CRD_SOURCE}}"
145- echo "$FOOTER"
146- } > "{{.HELM_TARGET}}"
147- echo "Synced CRD to {{.HELM_TARGET}}"
148- - |
149- HEADER='{{- if .Values.crds.install }}'
150- FOOTER='{{- end }}'
151- LABELS_BLOCK=' labels:
152- {{- include "dataflow-operator.labels" . | nindent 4 }}'
153- KEEP_BLOCK=' {{- if .Values.crds.keep }}
154- "helm.sh/resource-policy": keep
155- {{- end }}'
156-
157- {
158- echo "$HEADER"
159- awk '
160- /^---$/ { next }
161- /^metadata:$/ {
162- print
163- getline
164- if ($0 ~ /^ annotations:/) {
165- print
166- while (getline > 0 && $0 ~ /^ [^ ]/) {
167- print
168- }
169- printf "%s\n", "'"$KEEP_BLOCK"'"
170- printf "%s\n", "'"$LABELS_BLOCK"'"
171- print
172- }
173- next
174- }
175- { print }
176- ' "{{.CRON_CRD_SOURCE}}"
177- echo "$FOOTER"
178- } > "{{.CRON_HELM_TARGET}}"
179- echo "Synced CRD to {{.CRON_HELM_TARGET}}"
107+ - bash scripts/sync-crd-to-helm.sh
180108
181109 # Deployment tasks
182110 install :
0 commit comments