@@ -65,28 +65,53 @@ help: ## Display this help.
6565# ## CRD manifests (one per API group)
6666.PHONY : manifests-bootstrap manifests-controlplane manifests-infrastructure manifests-k0smotron
6767manifests-bootstrap : $(CONTROLLER_GEN ) # # Generate CRDs for bootstrap.cluster.x-k8s.io
68- $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
69- paths=" ./..." \
70- output:crd:artifacts:config=config/crd/bases/bootstrap
71- find ./config/crd/bases/bootstrap -type f ! -name " bootstrap*" ! -name " kustomization.yaml" -print0 | xargs -0 rm
68+ $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true \
69+ paths=" ./api/bootstrap/v1beta1/..." \
70+ paths=./internal/controller/bootstrap/... \
71+ output:crd:artifacts:config=config/clusterapi/bootstrap/crd \
72+ output:rbac:dir=config/clusterapi/bootstrap/rbac
7273
7374manifests-controlplane : $(CONTROLLER_GEN ) # # Generate CRDs for controlplane.cluster.x-k8s.io
7475 $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
75- paths=" ./..." \
76- output:crd:artifacts:config=config/crd/bases/controlplane
77- find ./config/crd/bases/controlplane -type f ! -name " controlplane*" ! -name " kustomization.yaml" -print0 | xargs -0 rm
76+ paths=" ./api/controlplane/v1beta1/..." \
77+ paths=" ./api/k0smotron.io/v1beta1/..." \
78+ paths=./internal/controller/controlplane/... \
79+ paths=./internal/controller/k0smotron.io/... \
80+ output:crd:artifacts:config=config/clusterapi/controlplane/crd \
81+ output:rbac:dir=config/clusterapi/controlplane/rbac \
82+ output:webhook:dir=config/clusterapi/controlplane/webhook
7883
7984manifests-infrastructure : $(CONTROLLER_GEN ) # # Generate CRDs for infrastructure.cluster.x-k8s.io
85+ $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true \
86+ paths=" ./api/infrastructure/v1beta1/..." \
87+ paths=./internal/controller/infrastructure/... \
88+ output:crd:artifacts:config=config/clusterapi/infrastructure/crd \
89+ output:rbac:dir=config/clusterapi/infrastructure/rbac
90+
91+ manifests-standalone : $(CONTROLLER_GEN ) # # Generate CRDs for k0smotron.io standalone
8092 $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
81- paths=" ./..." \
82- output:crd:artifacts:config=config/crd/bases/infrastructure
83- find ./config/crd/bases/infrastructure -type f ! -name " infrastructure*" ! -name " kustomization.yaml" -print0 | xargs -0 rm
93+ paths=" ./api/k0smotron.io/v1beta1/..." \
94+ paths=./internal/controller/k0smotron.io/... \
95+ output:crd:artifacts:config=config/standalone/crd \
96+ output:rbac:dir=config/standalone/rbac \
97+ output:webhook:dir=config/standalone/webhook
8498
85- manifests-k0smotron : $(CONTROLLER_GEN ) # # Generate CRDs for k0smotron.io
99+ .PHONY : manifests-capi-integration
100+ manifests-capi-integration : manifests manifests-capi-integration-without-crd
101+
102+ .PHONY : manifests-capi-integration-without-crd
103+ manifests-capi-integration-without-crd : $(CONTROLLER_GEN ) # Generate RBAC and webhook manifests for all controllers except CRDs in order to reuse them from each config/clusterapi/{provider}
86104 $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook \
87- paths=" ./..." \
88- output:crd:artifacts:config=config/crd/bases/k0smotron.io
89- find ./config/crd/bases/k0smotron.io -type f ! -name " k0smotron.io*" ! -name " kustomization.yaml" -print0 | xargs -0 rm
105+ paths=" ./api/bootstrap/v1beta1/..." \
106+ paths=./internal/controller/bootstrap/... \
107+ paths=" ./api/controlplane/v1beta1/..." \
108+ paths=" ./api/k0smotron.io/v1beta1/..." \
109+ paths=./internal/controller/controlplane/... \
110+ paths=./internal/controller/k0smotron.io/... \
111+ paths=" ./api/infrastructure/v1beta1/..." \
112+ paths=./internal/controller/infrastructure/... \
113+ output:rbac:dir=config/clusterapi/all/rbac \
114+ output:webhook:dir=config/clusterapi/all/webhook
90115
91116.PHONY : manifests
92117manifests : manifests-bootstrap manifests-controlplane manifests-infrastructure manifests-k0smotron # # Generate all CRD YAMLs per group
@@ -99,7 +124,7 @@ generate_targets += api/infrastructure/v1beta1/zz_generated.deepcopy.go
99124$(generate_targets ) : $(CONTROLLER_GEN )
100125 $(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
101126
102- generate : $(generate_targets ) clusterapi- manifests # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
127+ generate : $(generate_targets ) manifests # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
103128
104129
105130GO_PKGS =$(shell go list ./...)
@@ -149,10 +174,6 @@ e2e-aws:
149174build :
150175 go build -o bin/manager cmd/main.go
151176
152- .PHONY : run
153- run : manifests generate fmt vet # # Run a controller from your host.
154- go run ./cmd/main.go
155-
156177# If you wish built the manager image targeting other platforms you can use the --platform flag.
157178# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
158179# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
@@ -193,49 +214,43 @@ ifndef ignore-not-found
193214 ignore-not-found = false
194215endif
195216
196- .PHONY : install
197- install : manifests kustomize # # Install CRDs into the K8s cluster specified in ~/.kube/config.
198- $(KUSTOMIZE ) build config/crd | kubectl create -f -
199-
200- .PHONY : uninstall
201- uninstall : manifests kustomize # # Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
202- $(KUSTOMIZE ) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found ) -f -
203-
204217.PHONY : deploy
205218deploy : manifests kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
206- cd config/manager && $(KUSTOMIZE ) edit set image k0s/k0smotron=${IMG}
207- $(KUSTOMIZE ) build config/default | kubectl create -f -
219+ cd config/clusterapi/all/manager && $(KUSTOMIZE ) edit set image k0s/k0smotron=${IMG}
220+ $(KUSTOMIZE ) build config/clusterapi/all | kubectl create -f -
221+ git checkout config/clusterapi/all/manager/kustomization.yaml
208222
209223.PHONY : undeploy
210224undeploy : # # Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
211- $(KUSTOMIZE ) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found ) -f -
225+ $(KUSTOMIZE ) build config/clusterapi/all | kubectl delete --ignore-not-found=$(ignore-not-found ) -f -
212226
213227.PHONY : release
214- release : manifests kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
215- cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
216- $(KUSTOMIZE ) build config/default > install.yaml
217- git checkout config/manager/kustomization.yaml
218-
219- clusterapi-manifests :
220- $( CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths= " ./api/bootstrap/... " output:crd:artifacts:config=config/clusterapi/bootstrap/bases
221- $( CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths= " ./api/controlplane/... " output:crd:artifacts:config=config/clusterapi/controlplane/bases
222- $(CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths= " ./api/infrastructure/... " output:crd:artifacts:config=config/clusterapi/infrastructure/bases
223- $( CONTROLLER_GEN ) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths= " ./api/k0smotron.io/... " output:crd:artifacts: config=config/clusterapi/k0smotron.io/bases
224-
225- bootstrap-components.yaml : $(CONTROLLER_GEN ) clusterapi- manifests kustomize
226- cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
228+ release : manifests-capi-integration kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
229+ cd config/clusterapi/all/ manager && $(KUSTOMIZE ) edit set image controller=${IMG}
230+ $(KUSTOMIZE ) build config/clusterapi/all > install.yaml
231+ git checkout config/clusterapi/all/ manager/kustomization.yaml
232+
233+ .PHONY : release-standalone
234+ release-standalone : manifests-standalone kustomize # # Generate install yaml for standalone mode
235+ cd config/standalone/manager && $( KUSTOMIZE ) edit set image controller= ${IMG}
236+ $(KUSTOMIZE ) build config/standalone > install-standalone.yaml
237+ git checkout config/standalone/manager/kustomization.yaml
238+
239+ bootstrap-components.yaml : $(CONTROLLER_GEN ) manifests-infrastructure kustomize
240+ cd config/clusterapi/bootstrap/ manager && $(KUSTOMIZE ) edit set image controller=${IMG}
227241 $(KUSTOMIZE ) build config/clusterapi/bootstrap/ > bootstrap-components.yaml
228- git checkout config/manager/kustomization.yaml
242+ git checkout config/clusterapi/bootstrap/ manager/kustomization.yaml
229243
230- control-plane-components.yaml : $(CONTROLLER_GEN ) clusterapi- manifests kustomize
231- cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
244+ control-plane-components.yaml : $(CONTROLLER_GEN ) manifests-controlplane kustomize
245+ cd config/clusterapi/controlplane/ manager && $(KUSTOMIZE ) edit set image controller=${IMG}
232246 $(KUSTOMIZE ) build config/clusterapi/controlplane/ > control-plane-components.yaml
233- git checkout config/manager/kustomization.yaml
247+ git checkout config/clusterapi/controlplane/ manager/kustomization.yaml
234248
235- infrastructure-components.yaml : $(CONTROLLER_GEN ) clusterapi- manifests kustomize
236- cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
249+ infrastructure-components.yaml : $(CONTROLLER_GEN ) manifests-infrastructure kustomize
250+ cd config/clusterapi/infrastructure/ manager && $(KUSTOMIZE ) edit set image controller=${IMG}
237251 $(KUSTOMIZE ) build config/clusterapi/infrastructure/ > infrastructure-components.yaml
238- git checkout config/manager/kustomization.yaml
252+ git checkout config/clusterapi/infrastructure/manager/kustomization.yaml
253+
239254# #@ Build Dependencies
240255
241256kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
@@ -270,23 +285,23 @@ $(CRDOC): Makefile.variables | $(LOCALBIN)
270285
271286.PHONY : docs-generate-bootstrap docs-generate-controlplane docs-generate-infrastructure docs-generate-k0smotron docs-generate-reference
272287docs-generate-bootstrap : $(CRDOC ) # # Generate docs for bootstrap CRDs
273- $(CRDOC ) --resources config/crd/bases/ bootstrap --output docs/resource-reference/bootstrap.cluster.x-k8s.io-v1beta1.md
288+ $(CRDOC ) --resources config/clusterapi/ bootstrap/crd --output docs/resource-reference/bootstrap.cluster.x-k8s.io-v1beta1.md
274289
275290docs-generate-controlplane : $(CRDOC ) # # Generate docs for controlplane CRDs
276- $(CRDOC ) --resources config/crd/bases/ controlplane --output docs/resource-reference/controlplane.cluster.x-k8s.io-v1beta1.md
291+ $(CRDOC ) --resources config/clusterapi/ controlplane/crd --output docs/resource-reference/controlplane.cluster.x-k8s.io-v1beta1.md
277292
278293docs-generate-infrastructure : $(CRDOC ) # # Generate docs for infrastructure CRDs
279- $(CRDOC ) --resources config/crd/bases/ infrastructure --output docs/resource-reference/infrastructure.cluster.x-k8s.io-v1beta1.md
294+ $(CRDOC ) --resources config/clusterapi/ infrastructure/crd --output docs/resource-reference/infrastructure.cluster.x-k8s.io-v1beta1.md
280295
281296docs-generate-k0smotron : $(CRDOC ) # # Generate docs for k0smotron CRDs
282- $(CRDOC ) --resources config/crd/bases/k0smotron.io --output docs/resource-reference/k0smotron.io-v1beta1.md
297+ $(CRDOC ) --resources config/standalone/crd --output docs/resource-reference/k0smotron.io-v1beta1.md
283298
284299# Generate docs for all CRDs apis
285300docs-generate-reference : docs-generate-bootstrap docs-generate-controlplane docs-generate-infrastructure docs-generate-k0smotron
286301
287302# # Generate all code, manifests, documentation, and release artifacts
288303.PHONY : generate-all
289- generate-all : clean generate manifests clusterapi-manifests docs-generate-reference release
304+ generate-all : clean generate docs-generate-reference release
290305
291306.PHONY : $(smoketests )
292307$(smoketests ) : release k0smotron-image-bundle.tar
@@ -338,7 +353,7 @@ kind-deploy-capi:
338353
339354.PHONY : kind-deploy-k0smotron
340355kind-deploy-k0smotron : release k0smotron-image-bundle.tar
341- kind load image-archive k0smotron-image-bundle.tar --name k0smotron
356+ kind load image-archive k0smotron-image-bundle.tar
342357 kubectl apply --server-side=true -f install.yaml
343358 kubectl rollout restart -n k0smotron deployment/k0smotron-controller-manager
344359
0 commit comments