@@ -21,8 +21,13 @@ help: ## Display this help.
2121 @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
2222
2323.PHONY : manifests
24- manifests : controller-gen # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
24+ manifests : controller-gen kustomize yq # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
25+ rm -rf charts/ofen/templates/generated/
26+ mkdir -p charts/ofen/templates/generated/crds/
2527 $(CONTROLLER_GEN ) rbac:roleName=imageprefetch-controller-role crd paths=" ./..." output:crd:artifacts:config=config/crd/bases
28+ echo ' {{- if .Values.crds.enabled }}' > charts/ofen/templates/generated/crds/ofen_crds.yaml
29+ $(KUSTOMIZE ) build config/crd | $(YQ ) e " ." - >> charts/ofen/templates/generated/crds/ofen_crds.yaml
30+ echo ' {{- end }}' >> charts/ofen/templates/generated/crds/ofen_crds.yaml
2631
2732.PHONY : generate
2833generate : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -138,6 +143,7 @@ GINKGO = $(LOCALBIN)/ginkgo
138143APPLYCONFIGURATION_GEN = $(LOCALBIN ) /applyconfiguration-gen
139144MODELS_SCHEMA = $(LOCALBIN ) /models-schema
140145KAPTEST ?= $(LOCALBIN ) /kaptest
146+ YQ ?= $(LOCALBIN ) /yq
141147
142148# # Tool Versions
143149KUSTOMIZE_VERSION ?= v5.6.0
@@ -148,6 +154,7 @@ GINKGO_VERSION ?= v2.23.4
148154CODE_GENERATOR_VERSION ?= v0.31.1
149155MODELS_SCHEMA_VERSION ?= v1.31.1
150156KAPTEST_VERSION ?= v0.1.2
157+ YQ_VERSION ?= v4.47.1
151158
152159.PHONY : kustomize
153160kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
@@ -196,6 +203,15 @@ $(KAPTEST): $(LOCALBIN)
196203 tar -xzf kaptest_Linux_x86_64.tar.gz -C $(LOCALBIN ) kaptest && \
197204 rm -f kaptest_Linux_x86_64.tar.gz
198205
206+ .PHONY : yq
207+ yq : $(YQ ) # # Download yq locally if necessary.
208+ $(YQ ) : $(LOCALBIN )
209+ curl -sLO " https://github.com/mikefarah/yq/releases/download/$( YQ_VERSION) /yq_linux_amd64.tar.gz" && \
210+ tar -xzf yq_linux_amd64.tar.gz ./yq_linux_amd64 && \
211+ mv yq_linux_amd64 $(YQ ) && \
212+ chmod +x $(YQ ) && \
213+ rm -f yq_linux_amd64.tar.gz
214+
199215# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
200216# $1 - target path with name of binary
201217# $2 - package url which can be installed
0 commit comments