mirror of
https://github.com/khuedoan/homelab.git
synced 2024-12-23 01:14:38 +07:00
feat(scripts): add script to wait for some main services
This commit is contained in:
parent
171f8948b5
commit
81568a3fcb
39
scripts/wait-main-services
Executable file
39
scripts/wait-main-services
Executable file
@ -0,0 +1,39 @@
|
||||
#!/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()
|
||||
|
||||
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 \033[4mhttps://{host}\033[0m to {ingress['purpose']}")
|
Loading…
Reference in New Issue
Block a user