diff --git a/django_code/django_code/__pycache__/settings.cpython-313.pyc b/django_code/django_code/__pycache__/settings.cpython-313.pyc index 15b1f8e..d0fb2d9 100644 Binary files a/django_code/django_code/__pycache__/settings.cpython-313.pyc and b/django_code/django_code/__pycache__/settings.cpython-313.pyc differ diff --git a/django_code/django_code/settings.py b/django_code/django_code/settings.py index f493ced..45d5d01 100644 --- a/django_code/django_code/settings.py +++ b/django_code/django_code/settings.py @@ -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 = False +DEBUG = True ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu'] diff --git a/django_code/kubernetes_connection/__pycache__/apps.cpython-313.pyc b/django_code/kubernetes_connection/__pycache__/apps.cpython-313.pyc index 571200c..d61e4d8 100644 Binary files a/django_code/kubernetes_connection/__pycache__/apps.cpython-313.pyc and b/django_code/kubernetes_connection/__pycache__/apps.cpython-313.pyc differ diff --git a/django_code/kubernetes_connection/apps.py b/django_code/kubernetes_connection/apps.py index 3c1330d..acb378c 100644 --- a/django_code/kubernetes_connection/apps.py +++ b/django_code/kubernetes_connection/apps.py @@ -12,6 +12,8 @@ import random import mimetypes import ruamel.yaml import yaml +import urllib.request + def hello(request): return HttpResponse('

Hello k8s!

') @@ -111,23 +113,13 @@ def backup_job(request): def backup_job_yaml(request): config.load_kube_config(config_file='/code/kubeconfig') -# v1 = client.CoreV1Api() v1 = client.BatchV1Api() -# v1.list_node() -# pod_manifest_job = { + with urllib.request.urlopen("https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Django/pod.yaml") as fo: - with open('/code/pod.yaml') as fo: -# yaml = YAML(typ='rt') - #yaml.load(...) - -# job = ruamel.yaml.load(fo) +# with open('/code/pod.yaml') as fo: job = yaml.safe_load(fo) - v1.create_namespaced_job( job['metadata']['namespace'], job, pretty=True - -# _request_timeout=(settings.CONNECTION_TIMEOUT_SECONDS, settings.READ_TIMEOUT_SECONDS - ) return HttpResponse(job['metadata']['namespace'])