Skip to content

Instantly share code, notes, and snippets.

@egeneralov
Last active June 29, 2020 20:48
Show Gist options
  • Save egeneralov/067b34f58874041b8ceb35c5ce363db4 to your computer and use it in GitHub Desktop.
Save egeneralov/067b34f58874041b8ceb35c5ce363db4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# kubectl get ing --all-namespaces -o yaml > /tmp/ing.yaml
import yaml
data = yaml.load(
open("/tmp/ing.yaml").read()
)
for el in data['items']:
name = el["metadata"]["name"]
if "kubernetes.io/ingress.class" in el["metadata"]["annotations"]:
ing_class = el["metadata"]["annotations"]["kubernetes.io/ingress.class"]
else:
ing_class = "universal"
for rule in el['spec']['rules']:
print(
f"{ing_class}\t\t{rule['host']}"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment