@@ -14,16 +14,21 @@ HELM_VERSION ?= v3.16.3
1414# Dev Setup
1515# ####################################################################
1616CLUSTER_NAME ?= ccm-$(shell git rev-parse --short HEAD)
17+ SUBNET_CLUSTER_NAME ?= subnet-testing-$(shell git rev-parse --short HEAD)
18+ VPC_NAME ?= $(CLUSTER_NAME )
19+ MANIFEST_NAME ?= capl-cluster-manifests
20+ SUBNET_MANIFEST_NAME ?= subnet-testing-manifests
1721K8S_VERSION ?= "v1.31.2"
1822CAPI_VERSION ?= "v1.8.5"
1923CAAPH_VERSION ?= "v0.2.1"
20- CAPL_VERSION ?= "v0.7.1 "
24+ CAPL_VERSION ?= "v0.8.5 "
2125CONTROLPLANE_NODES ?= 1
2226WORKER_NODES ?= 1
2327LINODE_FIREWALL_ENABLED ?= true
2428LINODE_REGION ?= us-lax
2529LINODE_OS ?= linode/ubuntu22.04
2630KUBECONFIG_PATH ?= $(CURDIR ) /test-cluster-kubeconfig.yaml
31+ SUBNET_KUBECONFIG_PATH ?= $(CURDIR ) /subnet-testing-kubeconfig.yaml
2732MGMT_KUBECONFIG_PATH ?= $(CURDIR ) /mgmt-cluster-kubeconfig.yaml
2833
2934# if the $DEVBOX_PACKAGES_DIR env variable exists that means we are within a devbox shell and can safely
@@ -144,14 +149,15 @@ capl-cluster: generate-capl-cluster-manifests create-capl-cluster patch-linode-c
144149.PHONY : generate-capl-cluster-manifests
145150generate-capl-cluster-manifests :
146151 # Create the CAPL cluster manifests without any CSI driver stuff
147- LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED ) LINODE_OS=$(LINODE_OS ) clusterctl generate cluster $(CLUSTER_NAME ) \
152+ LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED ) LINODE_OS=$(LINODE_OS ) VPC_NAME= $( VPC_NAME ) clusterctl generate cluster $(CLUSTER_NAME ) \
148153 --kubernetes-version $(K8S_VERSION ) --infrastructure linode-linode:$(CAPL_VERSION ) \
149- --control-plane-machine-count $(CONTROLPLANE_NODES ) --worker-machine-count $(WORKER_NODES ) > capl-cluster-manifests.yaml
154+ --control-plane-machine-count $(CONTROLPLANE_NODES ) --worker-machine-count $(WORKER_NODES ) > $(MANIFEST_NAME ) .yaml
155+ yq -i e ' select(.kind == "LinodeVPC").spec.subnets = [{"ipv4": "10.0.0.0/8", "label": "default"}, {"ipv4": "172.16.0.0/16", "label": "testing"}]' $(MANIFEST_NAME ) .yaml
150156
151157.PHONY : create-capl-cluster
152158create-capl-cluster :
153159 # Create a CAPL cluster with updated CCM and wait for it to be ready
154- kubectl apply -f capl-cluster-manifests .yaml
160+ kubectl apply -f $( MANIFEST_NAME ) .yaml
155161 kubectl wait --for=condition=ControlPlaneReady cluster/$(CLUSTER_NAME ) --timeout=600s || (kubectl get cluster -o yaml; kubectl get linodecluster -o yaml; kubectl get linodemachines -o yaml)
156162 kubectl wait --for=condition=NodeHealthy=true machines -l cluster.x-k8s.io/cluster-name=$(CLUSTER_NAME ) --timeout=900s
157163 clusterctl get kubeconfig $(CLUSTER_NAME ) > $(KUBECONFIG_PATH )
@@ -207,6 +213,27 @@ e2e-test-bgp:
207213 LINODE_TOKEN=$(LINODE_TOKEN ) \
208214 chainsaw test e2e/bgp-test/lb-cilium-bgp $(E2E_FLAGS )
209215
216+ .PHONY : e2e-test-subnet
217+ e2e-test-subnet :
218+ # Generate cluster manifests for second cluster
219+ SUBNET_NAME=testing CLUSTER_NAME=$(SUBNET_CLUSTER_NAME ) MANIFEST_NAME=$(SUBNET_MANIFEST_NAME ) VPC_NAME=$(CLUSTER_NAME ) \
220+ VPC_NETWORK_CIDR=172.16.0.0/16 K8S_CLUSTER_CIDR=172.16.64.0/18 make generate-capl-cluster-manifests
221+ # Add subnetNames to HelmChartProxy
222+ yq e ' select(.kind == "HelmChartProxy" and .spec.chartName == "ccm-linode").spec.valuesTemplate' $(SUBNET_MANIFEST_NAME ) .yaml > tmp.yaml
223+ yq -i e ' .routeController += {"subnetNames": "testing"}' tmp.yaml
224+ yq -i e ' .routeController.vpcNames = "{{.InfraCluster.spec.vpcRef.name}}"' tmp.yaml
225+ yq -i e ' select(.kind == "HelmChartProxy" and .spec.chartName == "ccm-linode").spec.valuesTemplate = load_str("tmp.yaml")' $(SUBNET_MANIFEST_NAME ) .yaml
226+ rm tmp.yaml
227+ # Create the second cluster
228+ MANIFEST_NAME=$(SUBNET_MANIFEST_NAME ) CLUSTER_NAME=$(SUBNET_CLUSTER_NAME ) KUBECONFIG_PATH=$(SUBNET_KUBECONFIG_PATH ) \
229+ make create-capl-cluster
230+ KUBECONFIG_PATH=$(SUBNET_KUBECONFIG_PATH ) make patch-linode-ccm
231+ # Run chainsaw test
232+ LINODE_TOKEN=$(LINODE_TOKEN ) \
233+ FIRST_CONFIG=$(KUBECONFIG_PATH ) \
234+ SECOND_CONFIG=$(SUBNET_KUBECONFIG_PATH ) \
235+ chainsaw test e2e/subnet-test $(E2E_FLAGS )
236+
210237# ####################################################################
211238# OS / ARCH
212239# ####################################################################
0 commit comments