khuedoan-homelab/scripts/wait-main-apps

55 lines
1.1 KiB
Python
Executable File

#!/usr/bin/python
import requests
from kubernetes import client, config
# Essential services
ingresses = [
{
'name': 'argocd-server',
'namespace': 'argocd',
'purpose': 'manage your applications'
},
{
'name': 'gitea',
'namespace': 'gitea',
'purpose': 'manage your git repositories'
},
{
'name': 'hajimari',
'namespace': 'hajimari',
'purpose': 'view your homepage'
},
]
config.load_kube_config()
# TODO wait for Argo apps
# until argocd app wait \
# argocd \
# gitea \
# hajimari \
# ingress-nginx \
# longhorn-system \
# metallb-system \
# > /dev/null
# do
# sleep 3
# done
for ingress in ingresses:
i = client.NetworkingV1Api().read_namespaced_ingress(
ingress['name'],
ingress['namespace']
)
# TODO wait for ingress and retry
host = i.spec.rules[0].host
if requests.get(f"https://{host}").status_code == 200:
print(f"Visit https://{host} to {ingress['purpose']}")
print("\nThere're more services but the above is enough for you to start exploring!")