adding all the files , still work in progress but getting there , needs to move scale_up function to somrthing not managed by REQUEST

This commit is contained in:
pierre geeraert
2026-03-25 22:53:36 +00:00
parent 1e8afcbc44
commit b38f2a8b2f
8 changed files with 41 additions and 30 deletions
+6 -2
View File
@@ -17,11 +17,15 @@ import urllib.request
def hello(request):
return HttpResponse('<h1>Hello k8s!</h1>')
def scale_up(request,namespace_name,deploy_name):
def echoHello():
print("hello from k8s")
return "returned from k8s"
def scale_up(request,namespace_name,deploy_name,replicas=1):
config.load_kube_config(config_file='/kubeconfig/config')
api = client.AppsV1Api()
deployment = api.read_namespaced_deployment(name=deploy_name, namespace=namespace_name)
deployment.spec.replicas = 1
deployment.spec.replicas = replicas
resp = api.patch_namespaced_deployment(
name=deploy_name, namespace=namespace_name, body=deployment);
#return HttpResponse('<h1>Scaled up !</h1>')