@@ -6,6 +6,9 @@ KIND_EXPERIMENTAL_DOCKER_NETWORK=mini_lab_ext
66KUBECONFIG := $(shell pwd) /mini-lab/.kubeconfig
77MINI_LAB_FLAVOR =capms
88
9+ CLUSTER_NAME ?= metal-test
10+ KUBERNETES_VERSION ?= 1.31.6
11+
912METAL_API_URL =http://metal.203.0.113.1.nip.io:8080
1013METAL_API_HMAC =metal-edit
1114METAL_API_HMAC_AUTH_TYPE =Metal-Edit
@@ -16,9 +19,9 @@ METALCTL_HMAC_AUTH_TYPE=Metal-Edit
1619METAL_PARTITION ?= mini-lab
1720METAL_PROJECT_ID ?= 00000000-0000-0000-0000-000000000001
1821
19- CONTROL_PLANE_MACHINE_IMAGE ?= ubuntu-24.0-k8s-1.31.6
22+ CONTROL_PLANE_MACHINE_IMAGE ?= ubuntu-24.0-k8s-$( KUBERNETES_VERSION )
2023CONTROL_PLANE_MACHINE_SIZE ?= v1-small-x86
21- WORKER_MACHINE_IMAGE ?= ubuntu-24.0-k8s-1.31.6
24+ WORKER_MACHINE_IMAGE ?= ubuntu-24.0-k8s-$( KUBERNETES_VERSION )
2225WORKER_MACHINE_SIZE ?= v1-small-x86
2326
2427IMG ?= ghcr.io/metal-stack/cluster-api-metal-stack-controller:latest
@@ -54,37 +57,38 @@ controller:
5457
5558.PHONY : firewall
5659firewall :
57- metalctl firewall create --description fw --name fw --hostname fw --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image firewall-ubuntu-3.0 --size v1-small-x86 --firewall-rules-file=firewall-rules.yaml --networks internet-mini-lab,$(shell metalctl network list --name metal-test -o template --template '{{ .id }}')
60+ metalctl firewall create --description fw --name fw --hostname fw --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image firewall-ubuntu-3.0 --size v1-small-x86 --firewall-rules-file=firewall-rules.yaml --networks internet-mini-lab,$(shell metalctl network list --name $( CLUSTER_NAME ) -o template --template '{{ .id }}')
5861
5962.PHONY : node-network
6063node-network :
61- metalctl network allocate --description " node network for metal-test cluster" --name metal-test --project 00000000-0000-0000-0000-000000000001 --partition mini-lab
64+ metalctl network allocate --description " node network for $( CLUSTER_NAME ) cluster" --name $( CLUSTER_NAME ) --project 00000000-0000-0000-0000-000000000001 --partition mini-lab
6265
6366.PHONY : control-plane-ip
6467control-plane-ip :
6568 metalctl network ip create --network internet-mini-lab --project $(METAL_PROJECT_ID ) --name " $( CLUSTER_NAME) -vip" --type static -o template --template " {{ .ipaddress }}"
6669
6770.PHONY : apply-sample-cluster
6871apply-sample-cluster :
69- $(eval METAL_NODE_NETWORK_ID = $(shell metalctl network list --name metal-test -o template --template '{{ .id }}') )
70- $(eval CONTROL_PLANE_IP = $(shell metalctl network ip list --name "$(CLUSTER_NAME ) -vip" -o template --template '{{ .id }}') )
71- clusterctl generate cluster metal-test \
72+ $(eval METAL_NODE_NETWORK_ID = $(shell metalctl network list --name $(CLUSTER_NAME ) -o template --template '{{ .id }}') )
73+ $(eval CONTROL_PLANE_IP = $(shell metalctl network ip list --name "$(CLUSTER_NAME ) -vip" -o template --template '{{ .ipaddress }}') )
74+ echo $(CLUSTER_NAME )
75+ clusterctl generate cluster $(CLUSTER_NAME ) \
7276 --kubeconfig=$(KUBECONFIG ) \
7377 --worker-machine-count 1 \
7478 --control-plane-machine-count 1 \
75- --kubernetes-version 1.30.6 \
79+ --kubernetes-version $( KUBERNETES_VERSION ) \
7680 --from ../config/clusterctl-templates/cluster-template.yaml \
7781 | kubectl --kubeconfig=$(KUBECONFIG ) apply -f -
7882
7983.PHONY : delete-sample-cluster
8084delete-sample-cluster :
81- $(eval METAL_NODE_NETWORK_ID = $(shell metalctl network list --name metal-test -o template --template '{{ .id }}') )
82- $(eval CONTROL_PLANE_IP = $(shell metalctl network ip list --name "$(CLUSTER_NAME ) -vip" -o template --template '{{ .id }}') )
83- clusterctl generate cluster metal-test \
85+ $(eval METAL_NODE_NETWORK_ID = $(shell metalctl network list --name $( CLUSTER_NAME ) -o template --template '{{ .id }}') )
86+ $(eval CONTROL_PLANE_IP = $(shell metalctl network ip list --name "$(CLUSTER_NAME ) -vip" -o template --template '{{ .ipaddress }}') )
87+ clusterctl generate cluster $( CLUSTER_NAME ) \
8488 --kubeconfig=$(KUBECONFIG ) \
8589 --worker-machine-count 1 \
8690 --control-plane-machine-count 1 \
87- --kubernetes-version 1.30.6 \
91+ --kubernetes-version $( KUBERNETES_VERSION ) \
8892 --from ../config/clusterctl-templates/cluster-template.yaml \
8993 | kubectl --kubeconfig=$(KUBECONFIG ) delete -f -
9094
@@ -95,7 +99,7 @@ mtu-fix:
9599
96100.PHONY : deploy-metal-ccm
97101deploy-metal-ccm :
98- $(eval METAL_CLUSTER_ID = $(shell kubectl get metalstackclusters.infrastructure.cluster.x-k8s.io metal-test -ojsonpath='{.metadata.uid }') )
99- $(eval METAL_NODE_NETWORK_ID = $(shell metalctl network list --name metal-test -o template --template '{{ .id }}') )
102+ $(eval NAMESPACE = $(shell kubectl get metalstackclusters.infrastructure.cluster.x-k8s.io $( CLUSTER_NAME ) -ojsonpath='{.metadata.namespace }') )
103+ $(eval METAL_NODE_NETWORK_ID = $(shell metalctl network list --name $( CLUSTER_NAME ) -o template --template '{{ .id }}') )
100104 $(eval CONTROL_PLANE_IP = $(shell metalctl network ip list --name "$(CLUSTER_NAME ) -vip" -o template --template '{{ .id }}') )
101105 cat metal-ccm.yaml | envsubst | kubectl --kubeconfig=.capms-cluster-kubeconfig.yaml apply -f -
0 commit comments