add scale down as well and remove debug
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 55s

This commit is contained in:
2024-11-06 22:44:47 +00:00
parent 80877663a9
commit c7e5afc750
5 changed files with 13 additions and 1 deletions
+10
View File
@@ -24,6 +24,16 @@ def scale_up(request,namespace_name,deploy_name):
name=deploy_name, namespace=namespace_name, body=deployment);
return HttpResponse('<h1>Scaled up !</h1>')
def scale_down(request,namespace_name,deploy_name):
config.load_kube_config(config_file='/code/kubeconfig')
api = client.AppsV1Api()
deployment = api.read_namespaced_deployment(name=deploy_name, namespace=namespace_name)
deployment.spec.replicas = 0
resp = api.patch_namespaced_deployment(
name=deploy_name, namespace=namespace_name, body=deployment);
return HttpResponse('<h1>Scaled down !</h1>')
def nodes(request):
config.load_kube_config(config_file='/code/kubeconfig')
v1 = client.CoreV1Api()