@@ -25,6 +25,9 @@ SHELL = /usr/bin/env bash -o pipefail
25
25
.DEFAULT_GOAL: =help
26
26
GOTEST ?= go test
27
27
28
+ # https://github.com/syself/hetzner-cloud-controller-manager#networks-support
29
+ PRIVATE_NETWORK ?= false
30
+
28
31
# #@ General
29
32
30
33
@@ -79,8 +82,8 @@ MGT_CLUSTER_KUBECONFIG ?= ".mgt-cluster-kubeconfig.yaml"
79
82
80
83
# Kubebuilder.
81
84
# go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
82
- # setup-envtest list
83
- export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.29.3
85
+ # The command ` setup-envtest list` shows the available versions.
86
+ export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.31.0
84
87
85
88
# #@ Binaries
86
89
# ###########
@@ -110,7 +113,7 @@ $(ENVSUBST): # Build envsubst from tools folder.
110
113
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR ) /setup-envtest)
111
114
setup-envtest : $(SETUP_ENVTEST ) # # Build a local copy of setup-envtest
112
115
$(SETUP_ENVTEST ) : # Build setup-envtest from tools folder.
113
- go install sigs.k8s.io/controller-runtime/tools/
[email protected] 20240507051437-479b723944e3
116
+ go install sigs.k8s.io/controller-runtime/tools/
[email protected] 20250310021545-f80bc5dbf8f7
114
117
115
118
CTLPTL := $(abspath $(TOOLS_BIN_DIR ) /ctlptl)
116
119
ctlptl : $(CTLPTL ) # # Build a local copy of ctlptl
@@ -120,8 +123,7 @@ $(CTLPTL):
120
123
CLUSTERCTL := $(abspath $(TOOLS_BIN_DIR ) /clusterctl)
121
124
clusterctl : $(CLUSTERCTL ) # # Build a local copy of clusterctl
122
125
$(CLUSTERCTL ) :
123
- curl -sSLf https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.7.5/clusterctl-$$(go env GOOS ) -$$(go env GOARCH ) -o $(CLUSTERCTL )
124
- chmod a+rx $(CLUSTERCTL )
126
+ go install sigs.k8s.io/cluster-api/cmd/
[email protected]
125
127
126
128
HELM := $(abspath $(TOOLS_BIN_DIR ) /helm)
127
129
helm : $(HELM ) # # Build a local copy of helm
@@ -143,7 +145,7 @@ $(KIND):
143
145
KUBECTL := $(abspath $(TOOLS_BIN_DIR ) /kubectl)
144
146
kubectl : $(KUBECTL ) # # Build a local copy of kubectl
145
147
$(KUBECTL ) :
146
- curl -fsSL " https://dl.k8s.io/release/v1.29.4 /bin/$$ (go env GOOS)/$$ (go env GOARCH)/kubectl" -o $(KUBECTL )
148
+ curl -fsSL " https://dl.k8s.io/release/v1.31.6 /bin/$$ (go env GOOS)/$$ (go env GOARCH)/kubectl" -o $(KUBECTL )
147
149
chmod a+rx $(KUBECTL )
148
150
149
151
go-binsize-treemap := $(abspath $(TOOLS_BIN_DIR ) /go-binsize-treemap)
@@ -234,17 +236,7 @@ create-workload-cluster-hcloud: env-vars-for-wl-cluster $(KUSTOMIZE) $(ENVSUBST)
234
236
cat templates/cluster-templates/cluster-template-hcloud.yaml | $(ENVSUBST ) - | $(KUBECTL ) apply -f -
235
237
$(MAKE ) wait-and-get-secret
236
238
$(MAKE ) install-cilium-in-wl-cluster
237
- $(MAKE ) install-ccm-in-wl-cluster PRIVATE_NETWORK=false
238
-
239
- create-workload-cluster-hcloud-packer : env-vars-for-wl-cluster $(KUSTOMIZE ) $(ENVSUBST ) # # Creates a workload-cluster.
240
- # Create workload Cluster.
241
- ./hack/ensure-env-variables.sh HCLOUD_TOKEN
242
- $(KUBECTL ) create secret generic $(INFRA_PROVIDER ) --from-literal=hcloud=$(HCLOUD_TOKEN ) --save-config --dry-run=client -o yaml | $(KUBECTL ) apply -f -
243
- $(KUSTOMIZE ) build templates/cluster-templates/hcloud-packer --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hcloud-packer.yaml
244
- cat templates/cluster-templates/cluster-template-hcloud-packer.yaml | $(ENVSUBST ) - | $(KUBECTL ) apply -f -
245
- $(MAKE ) wait-and-get-secret
246
- $(MAKE ) install-cilium-in-wl-cluster
247
- $(MAKE ) install-ccm-in-wl-cluster PRIVATE_NETWORK=false
239
+ $(MAKE ) install-ccm-in-wl-cluster
248
240
249
241
create-workload-cluster-hcloud-network : env-vars-for-wl-cluster $(KUSTOMIZE ) $(ENVSUBST ) # # Creates a workload-cluster.
250
242
# Create workload Cluster.
@@ -256,16 +248,6 @@ create-workload-cluster-hcloud-network: env-vars-for-wl-cluster $(KUSTOMIZE) $(E
256
248
$(MAKE ) install-cilium-in-wl-cluster
257
249
$(MAKE ) install-ccm-in-wl-cluster PRIVATE_NETWORK=true
258
250
259
- create-workload-cluster-hcloud-network-packer : env-vars-for-wl-cluster $(KUSTOMIZE ) $(ENVSUBST ) # # Creates a workload-cluster.
260
- # Create workload Cluster.
261
- ./hack/ensure-env-variables.sh HCLOUD_TOKEN
262
- $(KUBECTL ) create secret generic $(INFRA_PROVIDER ) --from-literal=hcloud=$(HCLOUD_TOKEN ) --save-config --dry-run=client -o yaml | $(KUBECTL ) apply -f -
263
- $(KUSTOMIZE ) build templates/cluster-templates/hcloud-network-packer --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hcloud-network-packer.yaml
264
- cat templates/cluster-templates/cluster-template-hcloud-network-packer.yaml | $(ENVSUBST ) - | $(KUBECTL ) apply -f -
265
- $(MAKE ) wait-and-get-secret
266
- $(MAKE ) install-cilium-in-wl-cluster
267
- $(MAKE ) install-ccm-in-wl-cluster PRIVATE_NETWORK=true
268
-
269
251
create-workload-cluster-hetzner-hcloud-control-plane : env-vars-for-wl-cluster $(KUSTOMIZE ) $(ENVSUBST ) # # Creates a workload-cluster.
270
252
# Create workload Cluster.
271
253
./hack/ensure-env-variables.sh HCLOUD_TOKEN HETZNER_ROBOT_USER HETZNER_ROBOT_PASSWORD HETZNER_SSH_PRIV_PATH HETZNER_SSH_PUB_PATH SSH_KEY_NAME
@@ -275,7 +257,7 @@ create-workload-cluster-hetzner-hcloud-control-plane: env-vars-for-wl-cluster $(
275
257
cat templates/cluster-templates/cluster-template-$(INFRA_PROVIDER ) -hcloud-control-planes.yaml | $(ENVSUBST ) - | $(KUBECTL ) apply -f -
276
258
$(MAKE ) wait-and-get-secret
277
259
$(MAKE ) install-cilium-in-wl-cluster
278
- $(MAKE ) install-ccm-in-wl-cluster PRIVATE_NETWORK=false
260
+ $(MAKE ) install-ccm-in-wl-cluster
279
261
280
262
create-workload-cluster-hetzner-baremetal-control-plane : env-vars-for-wl-cluster $(KUSTOMIZE ) $(ENVSUBST ) # # Creates a workload-cluster.
281
263
# Create workload Cluster.
@@ -286,7 +268,7 @@ create-workload-cluster-hetzner-baremetal-control-plane: env-vars-for-wl-cluster
286
268
cat templates/cluster-templates/cluster-template-$(INFRA_PROVIDER ) -baremetal-control-planes.yaml | $(ENVSUBST ) - | $(KUBECTL ) apply -f -
287
269
$(MAKE ) wait-and-get-secret
288
270
$(MAKE ) install-cilium-in-wl-cluster
289
- $(MAKE ) install-ccm-in-wl-cluster PRIVATE_NETWORK=false
271
+ $(MAKE ) install-ccm-in-wl-cluster
290
272
291
273
create-workload-cluster-hetzner-baremetal-control-plane-remediation : env-vars-for-wl-cluster $(KUSTOMIZE ) $(ENVSUBST ) # # Creates a workload-cluster.
292
274
# Create workload Cluster.
@@ -297,7 +279,7 @@ create-workload-cluster-hetzner-baremetal-control-plane-remediation: env-vars-fo
297
279
cat templates/cluster-templates/cluster-template-$(INFRA_PROVIDER ) -baremetal-control-planes-remediation.yaml | $(ENVSUBST ) - | $(KUBECTL ) apply -f -
298
280
$(MAKE ) wait-and-get-secret
299
281
$(MAKE ) install-cilium-in-wl-cluster
300
- $(MAKE ) install-ccm-in-wl-cluster PRIVATE_NETWORK=false
282
+ $(MAKE ) install-ccm-in-wl-cluster
301
283
302
284
move-to-workload-cluster : $(CLUSTERCTL )
303
285
$(CLUSTERCTL ) init --kubeconfig=$(WORKER_CLUSTER_KUBECONFIG ) --core cluster-api --bootstrap kubeadm --control-plane kubeadm --infrastructure $(INFRA_PROVIDER )
@@ -339,6 +321,10 @@ delete-mgt-cluster-registry: $(CTLPTL) ## Deletes Kind-dev Cluster and the local
339
321
$(CTLPTL ) delete registry $(INFRA_SHORT ) -registry
340
322
341
323
generate-hcloud-token :
324
+ @if [ -n " $$ {TTS_TOKEN}" ]; then \
325
+ echo " Error: TTS_TOKEN is set. Please remove the deprecated variable (.envrc ?)." ; \
326
+ exit 1; \
327
+ fi
342
328
./hack/ensure-env-variables.sh TPS_TOKEN
343
329
./hack/ci-e2e-get-token.sh
344
330
@@ -349,6 +335,7 @@ generate-hcloud-token:
349
335
.PHONY : clean
350
336
clean : # # Remove all generated files
351
337
$(MAKE ) clean-bin
338
+ rm -rf test/e2e/data/infrastructure-hetzner/* /cluster-template* .yaml
352
339
353
340
.PHONY : clean-bin
354
341
clean-bin : # # Remove all generated helper binaries
@@ -472,16 +459,15 @@ ssh-first-control-plane: ## ssh into the first control-plane
472
459
@hack/ssh-first-control-plane.sh
473
460
474
461
475
- KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST ) use --use-env --bin-dir $(abspath $(TOOLS_BIN_DIR ) ) -p path $(KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ) )
476
-
477
462
E2E_DIR ?= $(ROOT_DIR ) /test/e2e
478
463
E2E_CONF_FILE_SOURCE ?= $(E2E_DIR ) /config/$(INFRA_PROVIDER ) .yaml
479
464
E2E_CONF_FILE ?= $(E2E_DIR ) /config/$(INFRA_PROVIDER ) .tmp.yaml
480
465
466
+
481
467
.PHONY : test-unit
482
468
test-unit : $(SETUP_ENVTEST ) $(GOTESTSUM ) # # Run unit and integration tests
483
- @mkdir -p $(shell pwd) /.coverage
484
- KUBEBUILDER_ASSETS= " $( KUBEBUILDER_ASSETS ) " $( GOTESTSUM ) --junitfile=.coverage/junit.xml --format testname -- -covermode=atomic -coverprofile=.coverage/cover.out -p=4 -timeout 5m ./controllers/... ./pkg/... ./api/...
469
+ echo $(SETUP_ENVTEST ) $( GOTESTSUM )
470
+ ./hack/test-unit.sh
485
471
486
472
.PHONY : e2e-image
487
473
e2e-image : # # Build the e2e manager image
@@ -494,18 +480,21 @@ $(E2E_CONF_FILE): $(ENVSUBST) $(E2E_CONF_FILE_SOURCE) ./hack/create-e2e-conf-fil
494
480
E2E_CONF_FILE=$(E2E_CONF_FILE ) ./hack/create-e2e-conf-file.sh
495
481
496
482
.PHONY : test-e2e
497
- test-e2e : $(E2E_CONF_FILE ) $(if $(SKIP_IMAGE_BUILD ) ,,e2e-image) $(ARTIFACTS )
483
+ test-e2e : test-e2e-hcloud
484
+
485
+ .PHONY : test-e2e-hcloud
486
+ test-e2e-hcloud : $(E2E_CONF_FILE ) $(if $(SKIP_IMAGE_BUILD ) ,,e2e-image) $(ARTIFACTS )
498
487
rm -f $(WORKER_CLUSTER_KUBECONFIG )
499
- GINKGO_FOKUS=" '\[Basic\]'" GINKGO_NODES=2 E2E_CONF_FILE=$(E2E_CONF_FILE ) ./hack/ci-e2e-capi.sh
488
+ HETZNER_SSH_PUB= HETZNER_SSH_PRIV= \
489
+ HETZNER_SSH_PUB_PATH= HETZNER_SSH_PRIV_PATH= \
490
+ HETZNER_ROBOT_PASSWORD= HETZNER_ROBOT_USER= \
491
+ GINKGO_FOKUS=" '\[Basic\]'" GINKGO_NODES=2 E2E_CONF_FILE=$(E2E_CONF_FILE ) \
492
+ ./hack/ci-e2e-capi.sh
500
493
501
494
.PHONY : test-e2e-feature
502
495
test-e2e-feature : $(E2E_CONF_FILE ) $(if $(SKIP_IMAGE_BUILD ) ,,e2e-image) $(ARTIFACTS )
503
496
GINKGO_FOKUS=" '\[Feature\]'" GINKGO_NODES=3 ./hack/ci-e2e-capi.sh
504
497
505
- .PHONY : test-e2e-feature-packer
506
- test-e2e-feature-packer : $(if $(SKIP_IMAGE_BUILD ) ,,e2e-image) $(ARTIFACTS )
507
- GINKGO_FOKUS=" '\[Feature Packer\]'" GINKGO_NODES=1 PACKER_IMAGE_NAME=templates/node-image/1.29.4-ubuntu-22-04-containerd ./hack/ci-e2e-capi.sh
508
-
509
498
.PHONY : test-e2e-lifecycle
510
499
test-e2e-lifecycle : $(E2E_CONF_FILE ) $(if $(SKIP_IMAGE_BUILD ) ,,e2e-image) $(ARTIFACTS )
511
500
GINKGO_FOKUS=" '\[Lifecycle\]'" GINKGO_NODES=3 ./hack/ci-e2e-capi.sh
@@ -516,7 +505,7 @@ test-e2e-upgrade-$(INFRA_SHORT): $(E2E_CONF_FILE) $(if $(SKIP_IMAGE_BUILD),,e2e-
516
505
517
506
.PHONY : test-e2e-upgrade-kubernetes
518
507
test-e2e-upgrade-kubernetes : $(if $(SKIP_IMAGE_BUILD ) ,,e2e-image) $(ARTIFACTS )
519
- GINKGO_FOKUS=" '\[Upgrade Kubernetes\]'" GINKGO_NODES=2 PACKER_KUBERNETES_UPGRADE_FROM=templates/node-image/1.28.9-ubuntu-22-04-containerd PACKER_KUBERNETES_UPGRADE_TO=templates/node-image/1.29.4-ubuntu-22-04-containerd ./hack/ci-e2e-capi.sh
508
+ GINKGO_FOKUS=" '\[Upgrade Kubernetes\]'" GINKGO_NODES=2 ./hack/ci-e2e-capi.sh
520
509
521
510
.PHONY : test-e2e-conformance
522
511
test-e2e-conformance : $(E2E_CONF_FILE ) $(if $(SKIP_IMAGE_BUILD ) ,,e2e-image) $(ARTIFACTS )
@@ -632,9 +621,7 @@ generate-api-ci: generate-manifests generate-go-deepcopy
632
621
cluster-templates : $(KUSTOMIZE )
633
622
$(KUSTOMIZE ) build templates/cluster-templates/hcloud --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template.yaml
634
623
$(KUSTOMIZE ) build templates/cluster-templates/hcloud --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hcloud.yaml
635
- $(KUSTOMIZE ) build templates/cluster-templates/hcloud-packer --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hcloud-packer.yaml
636
624
$(KUSTOMIZE ) build templates/cluster-templates/hcloud-network --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hcloud-network.yaml
637
- $(KUSTOMIZE ) build templates/cluster-templates/hcloud-network-packer --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hcloud-network-packer.yaml
638
625
$(KUSTOMIZE ) build templates/cluster-templates/hetzner-hcloud-control-planes --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hetzner-hcloud-control-planes.yaml
639
626
$(KUSTOMIZE ) build templates/cluster-templates/hetzner-baremetal-control-planes --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hetzner-baremetal-control-planes.yaml
640
627
$(KUSTOMIZE ) build templates/cluster-templates/hetzner-baremetal-control-planes-remediation --load-restrictor LoadRestrictionsNone > templates/cluster-templates/cluster-template-hetzner-baremetal-control-planes-remediation.yaml
0 commit comments