@@ -14,16 +14,21 @@ HELM_VERSION ?= v3.16.3
14
14
# Dev Setup
15
15
# ####################################################################
16
16
CLUSTER_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
17
21
K8S_VERSION ?= "v1.31.2"
18
22
CAPI_VERSION ?= "v1.8.5"
19
23
CAAPH_VERSION ?= "v0.2.1"
20
- CAPL_VERSION ?= "v0.7.1 "
24
+ CAPL_VERSION ?= "v0.8.5 "
21
25
CONTROLPLANE_NODES ?= 1
22
26
WORKER_NODES ?= 1
23
27
LINODE_FIREWALL_ENABLED ?= true
24
28
LINODE_REGION ?= us-lax
25
29
LINODE_OS ?= linode/ubuntu22.04
26
30
KUBECONFIG_PATH ?= $(CURDIR ) /test-cluster-kubeconfig.yaml
31
+ SUBNET_KUBECONFIG_PATH ?= $(CURDIR ) /subnet-testing-kubeconfig.yaml
27
32
MGMT_KUBECONFIG_PATH ?= $(CURDIR ) /mgmt-cluster-kubeconfig.yaml
28
33
29
34
# 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
144
149
.PHONY : generate-capl-cluster-manifests
145
150
generate-capl-cluster-manifests :
146
151
# 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 ) \
148
153
--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
150
156
151
157
.PHONY : create-capl-cluster
152
158
create-capl-cluster :
153
159
# 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
155
161
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)
156
162
kubectl wait --for=condition=NodeHealthy=true machines -l cluster.x-k8s.io/cluster-name=$(CLUSTER_NAME ) --timeout=900s
157
163
clusterctl get kubeconfig $(CLUSTER_NAME ) > $(KUBECONFIG_PATH )
@@ -207,6 +213,27 @@ e2e-test-bgp:
207
213
LINODE_TOKEN=$(LINODE_TOKEN ) \
208
214
chainsaw test e2e/bgp-test/lb-cilium-bgp $(E2E_FLAGS )
209
215
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
+
210
237
# ####################################################################
211
238
# OS / ARCH
212
239
# ####################################################################
0 commit comments