Skip to content

Commit 16c835c

Browse files
committed
Temp fix for the dual stack cluster to enable public ipv6 nodeport datapath
1 parent be8cb0b commit 16c835c

2 files changed

Lines changed: 42 additions & 9 deletions

File tree

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ CAAPH_VERSION ?= "v0.6.1"
3636
# renovate: datasource=github-tags depName=linode/cluster-api-provider-linode
3737
CAPL_VERSION ?= "v0.10.1"
3838

39+
# renovate: datasource=github-tags depName=cilium/cilium
40+
CILIUM_VERSION ?= "1.18.7"
41+
3942
# renovate: datasource=github-tags depName=golangci/golangci-lint
4043
GOLANGCI_LINT_VERSION ?= "v2.11.3"
4144

@@ -165,15 +168,23 @@ run-debug: build
165168
mgmt-and-capl-cluster: docker-setup mgmt-cluster capl-cluster
166169

167170
.PHONY: capl-cluster
168-
capl-cluster: generate-capl-cluster-manifests create-capl-cluster patch-linode-ccm
171+
capl-cluster: generate-capl-cluster-manifests create-capl-cluster
169172

170173
.PHONY: generate-capl-cluster-manifests
171174
generate-capl-cluster-manifests: clusterctl
172175
# Create the CAPL cluster manifests without any CSI driver stuff
173-
LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED) LINODE_OS=$(LINODE_OS) VPC_NAME=$(VPC_NAME) $(CLUSTERCTL) generate cluster $(CLUSTER_NAME) \
176+
LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED) LINODE_OS=$(LINODE_OS) VPC_NAME=$(VPC_NAME) CILIUM_VERSION=$(CILIUM_VERSION) $(CLUSTERCTL) generate cluster $(CLUSTER_NAME) \
174177
--kubernetes-version $(K8S_VERSION) --infrastructure linode-linode:$(CAPL_VERSION) \
175178
--control-plane-machine-count $(CONTROLPLANE_NODES) --worker-machine-count $(WORKER_NODES) --flavor kubeadm-dual-stack > $(MANIFEST_NAME).yaml
176179
yq -i e 'select(.kind == "LinodeVPC").spec.ipv6Range = [{"range": "auto"}] | select(.kind == "LinodeVPC").spec.subnets = [{"ipv4": "10.0.0.0/8", "label": "default", "ipv6Range": [{"range": "auto"}]}, {"ipv4": "172.16.0.0/16", "label": "testing", "ipv6Range": [{"range": "auto"}]}]' $(MANIFEST_NAME).yaml
180+
yq e 'select(.kind == "HelmChartProxy" and .spec.chartName == "cilium").spec.valuesTemplate' $(MANIFEST_NAME).yaml > tmp-cilium.yaml
181+
yq -i e '.devices = ["eth0", "eth1"] | .nodePort.addresses = ["0.0.0.0/0", "::/0"] | .nodePort.directRoutingDevice = "eth0" | .hostFirewall.enabled = false | del(.extraArgs[] | select(. == "--nodeport-addresses=0.0.0.0/0")) | del(.extraArgs[] | select(. == "--nodeport-addresses=0.0.0.0/0,::/0"))' tmp-cilium.yaml
182+
yq -i e 'select(.kind == "HelmChartProxy" and .spec.chartName == "cilium").spec.valuesTemplate = load_str("tmp-cilium.yaml")' $(MANIFEST_NAME).yaml
183+
rm tmp-cilium.yaml
184+
yq e 'select(.kind == "HelmChartProxy" and .spec.chartName == "ccm-linode").spec.valuesTemplate' $(MANIFEST_NAME).yaml > tmp.yaml
185+
IMG_TAG=$${IMG##*:} yq -i e '.image.tag = strenv(IMG_TAG) | .image.pullPolicy = "Always"' tmp.yaml
186+
yq -i e 'select(.kind == "HelmChartProxy" and .spec.chartName == "ccm-linode").spec.valuesTemplate = load_str("tmp.yaml")' $(MANIFEST_NAME).yaml
187+
rm tmp.yaml
177188

178189
.PHONY: create-capl-cluster
179190
create-capl-cluster: clusterctl
@@ -189,6 +200,7 @@ create-capl-cluster: clusterctl
189200
.PHONY: patch-linode-ccm
190201
patch-linode-ccm:
191202
KUBECONFIG=$(KUBECONFIG_PATH) kubectl patch -n kube-system daemonset ccm-linode --type='json' -p="[{'op': 'replace', 'path': '/spec/template/spec/containers/0/image', 'value': '${IMG}'}]"
203+
KUBECONFIG=$(KUBECONFIG_PATH) kubectl patch -n kube-system daemonset ccm-linode --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Always"}]'
192204
KUBECONFIG=$(KUBECONFIG_PATH) kubectl patch -n kube-system daemonset ccm-linode --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/env/-", "value": {"name": "LINODE_API_VERSION", "value": "v4beta"}}]'
193205
KUBECONFIG=$(KUBECONFIG_PATH) kubectl rollout status -n kube-system daemonset/ccm-linode --timeout=600s
194206
KUBECONFIG=$(KUBECONFIG_PATH) kubectl -n kube-system get daemonset/ccm-linode -o yaml

e2e/test/lb-with-ipv6-backends/chainsaw-test.yaml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,43 @@ spec:
7878
($error): ~
7979
(contains($stdout, 'NO_BACKEND_ADDRESSES')): false
8080
(contains($stdout, 'is NOT IPv6')): false
81+
- name: Wait for loadbalancer to start serving traffic
82+
try:
83+
- script:
84+
timeout: 10m
85+
content: |
86+
bash -ce '
87+
TARGET_IP=$(kubectl get svc svc-test -n "$NAMESPACE" -o json | jq -r '"'"'.status.loadBalancer.ingress[]? | select(.ip != null and (.ip | contains(":") | not)) | .ip'"'"' | head -n1)
88+
TARGET="http://$TARGET_IP:80"
89+
90+
for i in {1..24}; do
91+
output=$(curl -s --max-time 8 "$TARGET" | jq -r .podName 2>/dev/null || true)
92+
if [[ "$output" == *"test-"* ]]; then
93+
echo "loadbalancer ready"
94+
exit 0
95+
fi
96+
sleep 5
97+
done
98+
99+
echo "loadbalancer not ready"
100+
exit 1
101+
'
102+
check:
103+
($error == null): true
104+
(contains($stdout, 'loadbalancer ready')): true
81105
- name: Fetch loadbalancer ip and check both pods reachable
82106
try:
83107
- script:
108+
timeout: 10m
84109
content: |
85110
bash -ce '
86-
IP=$(kubectl get svc svc-test -n "$NAMESPACE" -o json | jq -r .status.loadBalancer.ingress[0].ip)
87-
if [[ "$IP" == *:* ]]; then
88-
TARGET="[$IP]"
89-
else
90-
TARGET="$IP"
91-
fi
111+
TARGET_IP=$(kubectl get svc svc-test -n "$NAMESPACE" -o json | jq -r '"'"'.status.loadBalancer.ingress[]? | select(.ip != null and (.ip | contains(":") | not)) | .ip'"'"' | head -n1)
112+
TARGET="http://$TARGET_IP:80"
92113
podnames=()
93114
94115
for i in {1..10}; do
95116
if [[ ${#podnames[@]} -lt 2 ]]; then
96-
output=$(curl -s "${TARGET}:80" | jq -e .podName || true)
117+
output=$(curl -s --max-time 8 "$TARGET" | jq -e .podName || true)
97118
98119
if [[ "$output" == *"test-"* ]]; then
99120
unique=true

0 commit comments

Comments
 (0)