new version with the scale Up option
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 59s

This commit is contained in:
2024-11-06 11:09:52 +00:00
parent ceaf0f0ef6
commit 80877663a9
11 changed files with 516328 additions and 5 deletions
@@ -15,6 +15,14 @@ import yaml
def hello(request):
return HttpResponse('<h1>Hello k8s!</h1>')
def scale_up(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 = 2
resp = api.patch_namespaced_deployment(
name=deploy_name, namespace=namespace_name, body=deployment);
return HttpResponse('<h1>Scaled up !</h1>')
def nodes(request):
config.load_kube_config(config_file='/code/kubeconfig')