diff --git a/Makefile b/Makefile index a88ac4e..ed2522f 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ dist: $(wildcard src/* compose.yaml) podman run --rm -it -u $(id -u):$(id -g) -v $(PWD):/app -w /app node:alpine sh -c "yarn install && yarn parcel build --no-source-maps" deploy: build - helm -n $(NS) upgrade --install $(RELEASE) ./chart/ -f override.yaml --create-namespace + helm -n $(NS) upgrade --install $(RELEASE) ./chart/ -f override.yaml --create-namespace --post-render=./post-render.py sleep 1 kubectl -n $(NS) rollout restart deployment $(RELEASE)-server diff --git a/post-render.py b/post-render.py new file mode 100755 index 0000000..8e6dc70 --- /dev/null +++ b/post-render.py @@ -0,0 +1,17 @@ +#!/bin/env python +import sys + +import yaml + +if __name__ == "__main__": + # get stdin content + resources = list(yaml.safe_load_all(sys.stdin)) + ingresses = [r for r in resources if r["kind"] == "Ingress"] + for ingress in ingresses: + tls = ingress.get("spec", {}).get("tls", []) + for tls_entry in tls: + hosts = {h for h in tls_entry.get("hosts", []) if h.startswith("www.")} + for h in hosts: + tls_entry["hosts"].append(h[4:]) + + print(yaml.dump_all(resources))