change to an URL instead
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 41s

This commit is contained in:
2024-11-12 11:02:28 +00:00
parent c7e5afc750
commit ccad16f38c
4 changed files with 5 additions and 13 deletions
+1 -1
View File
@@ -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' 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! # 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'] ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu']
+4 -12
View File
@@ -12,6 +12,8 @@ import random
import mimetypes import mimetypes
import ruamel.yaml import ruamel.yaml
import yaml import yaml
import urllib.request
def hello(request): def hello(request):
return HttpResponse('<h1>Hello k8s!</h1>') return HttpResponse('<h1>Hello k8s!</h1>')
@@ -111,23 +113,13 @@ def backup_job(request):
def backup_job_yaml(request): def backup_job_yaml(request):
config.load_kube_config(config_file='/code/kubeconfig') config.load_kube_config(config_file='/code/kubeconfig')
# v1 = client.CoreV1Api()
v1 = client.BatchV1Api() v1 = client.BatchV1Api()
# v1.list_node() with urllib.request.urlopen("https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Django/pod.yaml") as fo:
# pod_manifest_job = {
with open('/code/pod.yaml') as fo: # with open('/code/pod.yaml') as fo:
# yaml = YAML(typ='rt')
#yaml.load(...)
# job = ruamel.yaml.load(fo)
job = yaml.safe_load(fo) job = yaml.safe_load(fo)
v1.create_namespaced_job( v1.create_namespaced_job(
job['metadata']['namespace'], job, pretty=True job['metadata']['namespace'], job, pretty=True
# _request_timeout=(settings.CONNECTION_TIMEOUT_SECONDS, settings.READ_TIMEOUT_SECONDS
) )
return HttpResponse(job['metadata']['namespace']) return HttpResponse(job['metadata']['namespace'])