@@ -148,21 +148,24 @@ helm-chart-generate: kustomize helm kubectl-slice yq charts
148
148
for file in charts/$(CHART_NAME)/raw-files/*rolebinding*; do\
149
149
$(YQ) -i '.subjects[0].namespace = "{{ .Release.Namespace }}"' $${file};\
150
150
done
151
- # Add .spec.replicas for the controller-manager deployment
152
- for file in charts/$(CHART_NAME)/raw-files/deployment-*-controller-manager.yaml; do\
153
- $(YQ) -i '.spec.replicas = "{{ (.Values.Operator).replicas | default 1 }}"' $${file};\
154
- done
151
+
155
152
# Correct .metadata.name for cluster scoped resources
156
153
cluster_scoped_files="charts/$(CHART_NAME)/raw-files/clusterrolebinding-awx-operator-proxy-rolebinding.yaml charts/$(CHART_NAME)/raw-files/clusterrole-awx-operator-metrics-reader.yaml charts/$(CHART_NAME)/raw-files/clusterrole-awx-operator-proxy-role.yaml";\
157
154
for file in $${cluster_scoped_files}; do\
158
155
$(YQ) -i '.metadata.name += "-{{ .Release.Name }}"' $${file};\
159
156
done
160
157
# Correct the reference for the clusterrolebinding
161
158
$(YQ) -i '.roleRef.name += "-{{ .Release.Name }}"' 'charts/$(CHART_NAME)/raw-files/clusterrolebinding-awx-operator-proxy-rolebinding.yaml'
162
- # Correct .spec.replicas type for the controller-manager deployment
159
+
160
+ # Feed controller deployment file into template to allow for override from values
163
161
for file in charts/$(CHART_NAME)/raw-files/deployment-*-controller-manager.yaml; do\
164
- $(SED_I) "s/'{{ (.Values.Operator).replicas | default 1 }}'/{{ (.Values.Operator).replicas | default 1 }}/g" $${file};\
162
+ cat $${file} >> charts/$(CHART_NAME)/templates/controller/_controller.tpl;\
163
+ echo "\n---" >> charts/$(CHART_NAME)/templates/controller/_controller.tpl;\
164
+ rm -f $${file} ;\
165
165
done
166
+ echo '{{- end -}}' >> charts/$(CHART_NAME)/templates/controller/_controller.tpl
167
+
168
+
166
169
# move all custom resource definitions to crds folder
167
170
mkdir charts/$(CHART_NAME)/crds
168
171
mv charts/$(CHART_NAME)/raw-files/customresourcedefinition*.yaml charts/$(CHART_NAME)/crds/.
0 commit comments