The python script add katenary.io without "www" to generate the certificate and to be able to accept https://katenary.io to make the redirection.
18 lines
522 B
Python
Executable File
18 lines
522 B
Python
Executable File
#!/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))
|