Last active
June 29, 2020 20:48
-
-
Save egeneralov/067b34f58874041b8ceb35c5ce363db4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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