Skip to content

Commit 9498c05

Browse files
committed
Fix CAPL manifest yq patching
1 parent 2533b9a commit 9498c05

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,8 @@ generate-capl-cluster-manifests: clusterctl
177177
--kubernetes-version $(K8S_VERSION) --infrastructure linode-linode:$(CAPL_VERSION) \
178178
--control-plane-machine-count $(CONTROLPLANE_NODES) --worker-machine-count $(WORKER_NODES) --flavor kubeadm-dual-stack > $(MANIFEST_NAME).yaml
179179
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##*:} IMG_REPO=$${IMG%:*} yq -i e '.image.repository = strenv(IMG_REPO) | .image.tag = strenv(IMG_TAG) | .image.pullPolicy = "Always" | .env = ((.env // []) | map(select(.name != "LINODE_API_VERSION")) + [{"name": "LINODE_API_VERSION", "value": "v4beta"}])' 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
180+
yq -i e '(select(.kind == "HelmChartProxy" and .spec.chartName == "cilium").spec.valuesTemplate |= sub("hostFirewall:\n enabled: [^\n]+\n"; "hostFirewall:\n enabled: false\n")) | (select(.kind == "HelmChartProxy" and .spec.chartName == "cilium").spec.valuesTemplate |= sub("extraArgs:\n(?:- --nodeport-addresses=0\\.0\\.0\\.0/0(?:,::/0)?\n)+"; "extraArgs: []\n")) | (select(.kind == "HelmChartProxy" and .spec.chartName == "cilium").spec.valuesTemplate |= sub("hubble:\n relay:\n enabled: true\n ui:\n enabled: true"; "hubble:\n relay:\n enabled: true\n ui:\n enabled: true\ndevices:\n - eth0\n - eth1\nnodePort:\n addresses:\n - 0.0.0.0/0\n - ::/0\n directRoutingDevice: eth0"))' $(MANIFEST_NAME).yaml
181+
IMG_TAG=$${IMG##*:} yq -i e '(select(.kind == "HelmChartProxy" and .spec.chartName == "ccm-linode").spec.valuesTemplate |= sub("tag: [^\\n]+"; "tag: " + strenv(IMG_TAG))) | (select(.kind == "HelmChartProxy" and .spec.chartName == "ccm-linode").spec.valuesTemplate |= sub("pullPolicy: [^\\n]+"; "pullPolicy: Always"))' $(MANIFEST_NAME).yaml
188182

189183
.PHONY: create-capl-cluster
190184
create-capl-cluster: clusterctl

0 commit comments

Comments
 (0)