diff --git a/Makefile b/Makefile index 89144042..87065f6b 100644 --- a/Makefile +++ b/Makefile @@ -202,6 +202,12 @@ TAG ?= dev ARCH ?= $(shell go env GOARCH) ALL_ARCH = amd64 arm arm64 ppc64le s390x +# Allow overriding manifest generation destination directory +MANIFEST_ROOT ?= config +CRD_ROOT ?= $(MANIFEST_ROOT)/crd/bases +WEBHOOK_ROOT ?= $(MANIFEST_ROOT)/webhook +RBAC_ROOT ?= $(MANIFEST_ROOT)/rbac + # Allow overriding the imagePullPolicy PULL_POLICY ?= Always @@ -234,8 +240,17 @@ generate: ## Run all generate-* targets .PHONY: generate-manifests generate-manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) ## Generate manifests e.g. CRD, RBAC etc. for core - # $(MAKE) clean-generated-yaml SRC_DIRS="./config/crd/bases" - $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases + $(CONTROLLER_GEN) \ + paths=./api/... \ + crd:crdVersions=v1 \ + rbac:roleName=manager-role \ + output:crd:dir=$(CRD_ROOT) \ + output:webhook:dir=$(WEBHOOK_ROOT) \ + webhook + $(CONTROLLER_GEN) \ + paths=./controllers/... \ + output:rbac:dir=$(RBAC_ROOT) \ + rbac:roleName=manager-role .PHONY: generate-go generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(KUSTOMIZE) ## Generate manifests e.g. CRD, RBAC etc. for core @@ -561,7 +576,6 @@ set-manifest-image: .PHONY: clean clean: ## Remove generated binaries, GitBook files, Helm charts, and Tilt build files $(MAKE) clean-bin - $(MAKE) clean-book $(MAKE) clean-charts $(MAKE) clean-tilt diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 67f1c82d..e4e8b123 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -19,6 +19,9 @@ patchesStrategicMerge: - patches/cainjection_in_helmreleaseproxies.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch +# Adds clusterctl move hierarchy label to HelmChartProxies so they can be discovered by clusterctl move. +- patches/clusterctl_move_label_in_helmchartproxies.yaml + # the following config is for teaching kustomize how to do kustomization for CRDs. configurations: - kustomizeconfig.yaml diff --git a/config/crd/patches/clusterctl_move_label_in_helmchartproxies.yaml b/config/crd/patches/clusterctl_move_label_in_helmchartproxies.yaml new file mode 100644 index 00000000..0754059e --- /dev/null +++ b/config/crd/patches/clusterctl_move_label_in_helmchartproxies.yaml @@ -0,0 +1,8 @@ +# The following patch adds the `clusterctl.cluster.x-k8s.io/move-hierarchy` label to the HelmChartProxy CRD type. +# Note that this label will be present on the HelmChartProxy kind, not HelmChartProxy objects themselves. +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + labels: + clusterctl.cluster.x-k8s.io/move-hierarchy: "true" + name: helmchartproxies.addons.cluster.x-k8s.io