@@ -61,6 +61,7 @@ TOOLS_DIR := hack/tools
61
61
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR ) /$(BIN_DIR ) )
62
62
E2E_FRAMEWORK_DIR := $(TEST_DIR ) /framework
63
63
CAPD_DIR := $(TEST_DIR ) /infrastructure/docker
64
+ CAPIM_DIR := $(TEST_DIR ) /infrastructure/inmemory
64
65
TEST_EXTENSION_DIR := $(TEST_DIR ) /extension
65
66
GO_INSTALL := ./scripts/go_install.sh
66
67
OBSERVABILITY_DIR := hack/observability
@@ -200,6 +201,10 @@ KUBEADM_CONTROL_PLANE_CONTROLLER_IMG ?= $(REGISTRY)/$(KUBEADM_CONTROL_PLANE_IMAG
200
201
CAPD_IMAGE_NAME ?= capd-manager
201
202
CAPD_CONTROLLER_IMG ?= $(REGISTRY ) /$(CAPD_IMAGE_NAME )
202
203
204
+ # capim
205
+ CAPIM_IMAGE_NAME ?= capim-manager
206
+ CAPIM_CONTROLLER_IMG ?= $(REGISTRY ) /$(CAPIM_IMAGE_NAME )
207
+
203
208
# clusterctl
204
209
CLUSTERCTL_MANIFEST_DIR := cmd/clusterctl/config
205
210
CLUSTERCTL_IMAGE_NAME ?= clusterctl
@@ -234,15 +239,15 @@ LDFLAGS := $(shell hack/version.sh)
234
239
all : test managers clusterctl
235
240
236
241
help : # Display this help
237
- @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9A-Za-z_-]+:.*?##/ { printf " \033[36m%-45s \033[0m %s\n", $$1, $$2 } /^\$$\([0-9A-Za-z_-]+\):.*?##/ { gsub("_","-", $$1); printf " \033[36m%-45s \033[0m %s\n", tolower(substr($$1, 3, length($$1)-7)), $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
242
+ @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9A-Za-z_-]+:.*?##/ { printf " \033[36m%-50s \033[0m %s\n", $$1, $$2 } /^\$$\([0-9A-Za-z_-]+\):.*?##/ { gsub("_","-", $$1); printf " \033[36m%-50s \033[0m %s\n", tolower(substr($$1, 3, length($$1)-7)), $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
238
243
239
244
# # --------------------------------------
240
245
# # Generate / Manifests
241
246
# # --------------------------------------
242
247
243
248
# #@ generate:
244
249
245
- ALL_GENERATE_MODULES = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure
250
+ ALL_GENERATE_MODULES = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure in-memory-infrastructure
246
251
247
252
.PHONY : generate
248
253
generate : # # Run all generate-manifests-*, generate-go-deepcopy-*, generate-go-conversions-* and generate-go-openapi targets
@@ -318,6 +323,19 @@ generate-manifests-docker-infrastructure: $(CONTROLLER_GEN) ## Generate manifest
318
323
output:webhook:dir=./config/webhook \
319
324
webhook
320
325
326
+
327
+ .PHONY : generate-manifests-in-memory-infrastructure
328
+ generate-manifests-in-memory-infrastructure : $(CONTROLLER_GEN ) # # Generate manifests e.g. CRD, RBAC etc. for in-memory infrastructure provider
329
+ $(MAKE ) clean-generated-yaml SRC_DIRS=" $( CAPIM_DIR) /config/crd/bases"
330
+ cd $(CAPIM_DIR ) ; $(CONTROLLER_GEN ) \
331
+ paths=./api/... \
332
+ paths=./internal/controllers/... \
333
+ crd:crdVersions=v1 \
334
+ rbac:roleName=manager-role \
335
+ output:crd:dir=./config/crd/bases \
336
+ output:webhook:dir=./config/webhook \
337
+ webhook
338
+
321
339
.PHONY : generate-go-deepcopy
322
340
generate-go-deepcopy : # # Run all generate-go-deepcopy-* targets
323
341
$(MAKE ) $(addprefix generate-go-deepcopy-,$(ALL_GENERATE_MODULES ) )
@@ -360,6 +378,14 @@ generate-go-deepcopy-docker-infrastructure: $(CONTROLLER_GEN) ## Generate deepco
360
378
paths=./api/... \
361
379
paths=./$(EXP_DIR ) /api/...
362
380
381
+ .PHONY : generate-go-deepcopy-in-memory-infrastructure
382
+ generate-go-deepcopy-in-memory-infrastructure : $(CONTROLLER_GEN ) # # Generate deepcopy go code for in-memory infrastructure provider
383
+ $(MAKE ) clean-generated-deepcopy SRC_DIRS=" $( CAPIM_DIR) /api,$( CAPIM_DIR) /internal/cloud/api"
384
+ cd $(CAPIM_DIR ) ; $(CONTROLLER_GEN ) \
385
+ object:headerFile=../../../hack/boilerplate/boilerplate.generatego.txt \
386
+ paths=./api/... \
387
+ paths =./internal/cloud/api/...
388
+
363
389
.PHONY : generate-go-conversions
364
390
generate-go-conversions : # # Run all generate-go-conversions-* targets
365
391
$(MAKE ) $(addprefix generate-go-conversions-,$(ALL_GENERATE_MODULES ) )
@@ -450,6 +476,10 @@ generate-go-conversions-docker-infrastructure: $(CONVERSION_GEN) ## Generate con
450
476
--output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE_CAPD ) \
451
477
--go-header-file=../../../hack/boilerplate/boilerplate.generatego.txt
452
478
479
+ .PHONY : generate-go-conversions-in-memory-infrastructure
480
+ generate-go-conversions-in-memory-infrastructure : $(CONVERSION_GEN ) # # Generate conversions go code for in-memory infrastructure provider
481
+ cd $(CAPIM_DIR )
482
+
453
483
# The tmp/sigs.k8s.io/cluster-api symlink is a workaround to make this target run outside of GOPATH
454
484
.PHONY : generate-go-openapi
455
485
generate-go-openapi : $(OPENAPI_GEN ) $(CONTROLLER_GEN ) # # Generate openapi go code for runtime SDK
@@ -627,7 +657,7 @@ verify-container-images: ## Verify container images
627
657
clusterctl : # # Build the clusterctl binary
628
658
go build -trimpath -ldflags " $( LDFLAGS) " -o $(BIN_DIR ) /clusterctl sigs.k8s.io/cluster-api/cmd/clusterctl
629
659
630
- ALL_MANAGERS = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure
660
+ ALL_MANAGERS = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure in-memory-infrastructure
631
661
632
662
.PHONY : managers
633
663
managers : $(addprefix manager-,$(ALL_MANAGERS ) ) # # Run all manager-* targets
@@ -648,6 +678,10 @@ manager-kubeadm-control-plane: ## Build the kubeadm control plane manager binary
648
678
manager-docker-infrastructure : # # Build the docker infrastructure manager binary into the ./bin folder
649
679
cd $(CAPD_DIR ) ; go build -trimpath -ldflags " $( LDFLAGS) " -o ../../../$(BIN_DIR ) /capd-manager sigs.k8s.io/cluster-api/test/infrastructure/docker
650
680
681
+ .PHONY : manager-in-memory-infrastructure
682
+ manager-in-memory-infrastructure : # # Build the in-memory-infrastructure infrastructure manager binary into the ./bin folder
683
+ cd $(CAPIM_DIR ) ; go build -trimpath -ldflags " $( LDFLAGS) " -o ../../../$(BIN_DIR ) /capim-manager sigs.k8s.io/cluster-api/test/infrastructure/inmemory
684
+
651
685
.PHONY : docker-pull-prerequisites
652
686
docker-pull-prerequisites :
653
687
docker pull docker.io/docker/dockerfile:1.4
@@ -660,13 +694,13 @@ docker-build-all: $(addprefix docker-build-,$(ALL_ARCH)) ## Build docker images
660
694
docker-build-% :
661
695
$(MAKE ) ARCH=$* docker-build
662
696
663
- ALL_DOCKER_BUILD = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure test-extension clusterctl
697
+ ALL_DOCKER_BUILD = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure in-memory-infrastructure test-extension clusterctl
664
698
665
699
.PHONY : docker-build
666
700
docker-build : docker-pull-prerequisites # # Run docker-build-* targets for all the images
667
701
$(MAKE ) ARCH=$(ARCH ) $(addprefix docker-build-,$(ALL_DOCKER_BUILD ) )
668
702
669
- ALL_DOCKER_BUILD_E2E = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure test-extension
703
+ ALL_DOCKER_BUILD_E2E = core kubeadm-bootstrap kubeadm-control-plane docker-infrastructure in-memory-infrastructure test-extension
670
704
671
705
.PHONY : docker-build-e2e
672
706
docker-build-e2e : # # Run docker-build-* targets for all the images with settings to be used for the e2e tests
@@ -698,6 +732,12 @@ docker-build-docker-infrastructure: ## Build the docker image for docker infrast
698
732
$(MAKE ) set-manifest-image MANIFEST_IMG=$(CAPD_CONTROLLER_IMG ) -$(ARCH ) MANIFEST_TAG=$(TAG ) TARGET_RESOURCE=" $( CAPD_DIR) /config/default/manager_image_patch.yaml"
699
733
$(MAKE ) set-manifest-pull-policy TARGET_RESOURCE=" $( CAPD_DIR) /config/default/manager_pull_policy.yaml"
700
734
735
+ .PHONY : docker-build-in-memory-infrastructure
736
+ docker-build-in-memory-infrastructure : # # Build the docker image for in-memory infrastructure controller manager
737
+ cd $(CAPIM_DIR ) ; DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE ) --build-arg goproxy=$(GOPROXY ) --build-arg ARCH=$(ARCH ) --build-arg ldflags=" $( LDFLAGS) " ../../.. -t $(CAPIM_CONTROLLER_IMG ) -$(ARCH ) :$(TAG ) --file ../../../Dockerfile
738
+ $(MAKE ) set-manifest-image MANIFEST_IMG=$(CAPIM_CONTROLLER_IMG ) -$(ARCH ) MANIFEST_TAG=$(TAG ) TARGET_RESOURCE=" $( CAPIM_DIR) /config/default/manager_image_patch.yaml"
739
+ $(MAKE ) set-manifest-pull-policy TARGET_RESOURCE=" $( CAPIM_DIR) /config/default/manager_pull_policy.yaml"
740
+
701
741
.PHONY : docker-build-clusterctl
702
742
docker-build-clusterctl : # # Build the docker image for clusterctl
703
743
DOCKER_BUILDKIT=1 docker build --build-arg builder_image=$(GO_CONTAINER_IMAGE ) --build-arg goproxy=$(GOPROXY ) --build-arg ARCH=$(ARCH ) --build-arg package=./cmd/clusterctl --build-arg ldflags=" $( LDFLAGS) " -f ./cmd/clusterctl/Dockerfile . -t $(CLUSTERCTL_IMG ) -$(ARCH ) :$(TAG )
@@ -764,6 +804,20 @@ test-docker-infrastructure-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and
764
804
$(GOTESTSUM ) --junitfile $(ARTIFACTS ) /junit.infra_docker.xml --raw-command cat $(ARTIFACTS ) /junit.infra_docker.stdout
765
805
exit $$(cat $(ARTIFACTS ) /junit.infra_docker.exitcode )
766
806
807
+ .PHONY : test-in-memory-infrastructure
808
+ test-in-memory-infrastructure : $(SETUP_ENVTEST ) # # Run unit and integration tests for in-memory infrastructure provider
809
+ cd $(CAPIM_DIR ) ; KUBEBUILDER_ASSETS=" $( KUBEBUILDER_ASSETS) " go test ./... $(TEST_ARGS )
810
+
811
+ .PHONY : test-in-memory-infrastructure-verbose
812
+ test-in-memory-infrastructure-verbose : # # Run unit and integration tests for in-memory infrastructure provider with verbose flag
813
+ $(MAKE ) test-in-memory-infrastructure TEST_ARGS=" $( TEST_ARGS) -v"
814
+
815
+ .PHONY : test-in-memory-infrastructure-junit
816
+ test-in-memory-infrastructure-junit : $(SETUP_ENVTEST ) $(GOTESTSUM ) # # Run unit and integration tests and generate a junit report for in-memory infrastructure provider
817
+ cd $(CAPIM_DIR ) ; set +o errexit; (KUBEBUILDER_ASSETS=" $( KUBEBUILDER_ASSETS) " go test -json ./... $( TEST_ARGS) ; echo $$ ? > $( ARTIFACTS) /junit.infra_inmemory.exitcode) | tee $(ARTIFACTS ) /junit.infra_inmemory.stdout
818
+ $(GOTESTSUM ) --junitfile $(ARTIFACTS ) /junit.infra_inmemory.xml --raw-command cat $(ARTIFACTS ) /junit.infra_inmemory.stdout
819
+ exit $$(cat $(ARTIFACTS ) /junit.infra_inmemory.exitcode )
820
+
767
821
.PHONY : test-test-extension
768
822
test-test-extension : $(SETUP_ENVTEST ) # # Run unit and integration tests for the test extension
769
823
cd $(TEST_EXTENSION_DIR ) ; KUBEBUILDER_ASSETS=" $( KUBEBUILDER_ASSETS) " go test ./... $(TEST_ARGS )
@@ -876,13 +930,16 @@ manifest-modification-dev: # Set the manifest images to the staging bucket.
876
930
MANIFEST_IMG=$(REGISTRY ) /$(CAPD_IMAGE_NAME ) MANIFEST_TAG=$(RELEASE_TAG ) \
877
931
TARGET_RESOURCE=" $( CAPD_DIR) /config/default/manager_image_patch.yaml"
878
932
$(MAKE ) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE=" $( CAPD_DIR) /config/default/manager_pull_policy.yaml"
933
+ $(MAKE ) set-manifest-image \
934
+ MANIFEST_IMG=$(REGISTRY ) /$(CAPIM_IMAGE_NAME ) MANIFEST_TAG=$(RELEASE_TAG ) \
935
+ TARGET_RESOURCE=" $( CAPIM_DIR) /config/default/manager_image_patch.yaml"
936
+ $(MAKE ) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE=" $( CAPIM_DIR) /config/default/manager_pull_policy.yaml"
879
937
$(MAKE ) set-manifest-image \
880
938
MANIFEST_IMG=$(REGISTRY ) /$(TEST_EXTENSION_IMAGE_NAME ) MANIFEST_TAG=$(RELEASE_TAG ) \
881
939
TARGET_RESOURCE=" $( TEST_EXTENSION_DIR) /config/default/manager_image_patch.yaml"
882
940
$(MAKE ) set-manifest-pull-policy PULL_POLICY=IfNotPresent TARGET_RESOURCE=" $( CAPD_DIR) /config/default/manager_pull_policy.yaml"
883
941
884
942
885
-
886
943
.PHONY : release-manifests
887
944
release-manifests : $(RELEASE_DIR ) $(KUSTOMIZE ) $(RUNTIME_OPENAPI_GEN ) # # Build the manifests to publish with a release
888
945
# Build core-components.
@@ -908,6 +965,8 @@ release-manifests: $(RELEASE_DIR) $(KUSTOMIZE) $(RUNTIME_OPENAPI_GEN) ## Build t
908
965
release-manifests-dev : $(RELEASE_DIR ) $(KUSTOMIZE ) # # Build the development manifests and copies them in the release folder
909
966
cd $(CAPD_DIR ) ; $(KUSTOMIZE ) build config/default > ../../../$(RELEASE_DIR ) /infrastructure-components-development.yaml
910
967
cp $(CAPD_DIR ) /templates/* $(RELEASE_DIR ) /
968
+ cd $(CAPIM_DIR ) ; $(KUSTOMIZE ) build config/default > ../../../$(RELEASE_DIR ) /infrastructure-components-inmemory-development.yaml
969
+ cp $(CAPIM_DIR ) /templates/* $(RELEASE_DIR ) /
911
970
cd $(TEST_EXTENSION_DIR ) ; $(KUSTOMIZE ) build config/default > ../../$(RELEASE_DIR ) /runtime-extension-components-development.yaml
912
971
913
972
.PHONY : release-binaries
@@ -961,6 +1020,7 @@ release-alias-tag: ## Add the release alias tag to the last build tag
961
1020
gcloud container images add-tag $(KUBEADM_CONTROL_PLANE_CONTROLLER_IMG ) :$(TAG ) $(KUBEADM_CONTROL_PLANE_CONTROLLER_IMG ) :$(RELEASE_ALIAS_TAG )
962
1021
gcloud container images add-tag $(CLUSTERCTL_IMG ) :$(TAG ) $(CLUSTERCTL_IMG ) :$(RELEASE_ALIAS_TAG )
963
1022
gcloud container images add-tag $(CAPD_CONTROLLER_IMG ) :$(TAG ) $(CAPD_CONTROLLER_IMG ) :$(RELEASE_ALIAS_TAG )
1023
+ gcloud container images add-tag $(CAPIM_CONTROLLER_IMG ) :$(TAG ) $(CAPIM_CONTROLLER_IMG ) :$(RELEASE_ALIAS_TAG )
964
1024
gcloud container images add-tag $(TEST_EXTENSION_IMG ) :$(TAG ) $(TEST_EXTENSION_IMG ) :$(RELEASE_ALIAS_TAG )
965
1025
966
1026
.PHONY : release-notes
@@ -985,6 +1045,7 @@ docker-push-all: $(addprefix docker-push-,$(ALL_ARCH)) ## Push the docker image
985
1045
$(MAKE ) docker-push-manifest-kubeadm-bootstrap
986
1046
$(MAKE ) docker-push-manifest-kubeadm-control-plane
987
1047
$(MAKE ) docker-push-manifest-docker-infrastructure
1048
+ $(MAKE ) docker-push-manifest-in-memory-infrastructure
988
1049
$(MAKE ) docker-push-manifest-test-extension
989
1050
$(MAKE ) docker-push-clusterctl
990
1051
@@ -998,6 +1059,7 @@ docker-push: ## Push the docker images to be included in the release
998
1059
docker push $(KUBEADM_CONTROL_PLANE_CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
999
1060
docker push $(CLUSTERCTL_IMG ) -$(ARCH ) :$(TAG )
1000
1061
docker push $(CAPD_CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
1062
+ docker push $(CAPIM_CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
1001
1063
docker push $(TEST_EXTENSION_IMG ) -$(ARCH ) :$(TAG )
1002
1064
1003
1065
.PHONY : docker-push-manifest-core
@@ -1032,6 +1094,13 @@ docker-push-manifest-docker-infrastructure: ## Push the multiarch manifest for t
1032
1094
$(MAKE ) set-manifest-image MANIFEST_IMG=$(CAPD_CONTROLLER_IMG ) MANIFEST_TAG=$(TAG ) TARGET_RESOURCE=" $( CAPD_DIR) /config/default/manager_image_patch.yaml"
1033
1095
$(MAKE ) set-manifest-pull-policy TARGET_RESOURCE=" $( CAPD_DIR) /config/default/manager_pull_policy.yaml"
1034
1096
1097
+ .PHONY : docker-push-manifest-in-memory-infrastructure
1098
+ docker-push-manifest-in-memory-infrastructure : # # Push the multiarch manifest for the in-memory infrastructure provider images
1099
+ docker manifest create --amend $(CAPIM_CONTROLLER_IMG ) :$(TAG ) $(shell echo $(ALL_ARCH ) | sed -e "s~[^ ]* ~$(CAPIM_CONTROLLER_IMG ) \-&:$(TAG ) ~g")
1100
+ @for arch in $(ALL_ARCH ) ; do docker manifest annotate --arch $$ {arch} ${CAPIM_CONTROLLER_IMG} :${TAG} ${CAPIM_CONTROLLER_IMG} -$$ {arch}:${TAG} ; done
1101
+ docker manifest push --purge $(CAPIM_CONTROLLER_IMG ) :$(TAG )
1102
+ $(MAKE ) set-manifest-image MANIFEST_IMG=$(CAPIM_CONTROLLER_IMG ) MANIFEST_TAG=$(TAG ) TARGET_RESOURCE=" $( CAPIM_DIR) /config/default/manager_image_patch.yaml"
1103
+ $(MAKE ) set-manifest-pull-policy TARGET_RESOURCE=" $( CAPIM_DIR) /config/default/manager_pull_policy.yaml"
1035
1104
1036
1105
.PHONY : docker-push-manifest-test-extension
1037
1106
docker-push-manifest-test-extension : # # Push the multiarch manifest for the test extension provider images
0 commit comments