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 = False
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu']
|
||||
|
||||
|
||||
Binary file not shown.
@@ -12,6 +12,8 @@ import random
|
||||
import mimetypes
|
||||
import ruamel.yaml
|
||||
import yaml
|
||||
import urllib.request
|
||||
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello k8s!</h1>')
|
||||
|
||||
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user