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:
@@ -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>')
|
||||
|
||||
Reference in New Issue
Block a user