add scale down as well and remove debug
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 55s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 55s
This commit is contained in:
Binary file not shown.
@@ -23,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = 'django-insecure-71%)_#e#o9-dl2o^6mfud-*rw+4+8vy-nd*bzeier&(34ap-p9'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu']
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ urlpatterns = [
|
||||
path('kubernetes_connection/backup_job/', kubernetes_connection.backup_job),
|
||||
path('kubernetes_connection/backup_job_yaml/', kubernetes_connection.backup_job_yaml),
|
||||
path('kubernetes_connection/scale_up/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_up),
|
||||
path('kubernetes_connection/scale_down/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_down),
|
||||
|
||||
# path('bookstack/', docker_connection.apps.hello),
|
||||
# path('test/', docker_connection.apps.http_call_test),
|
||||
# path('proxmox/', docker_connection.apps.proxmox),
|
||||
|
||||
Binary file not shown.
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user