This commit is contained in:
@@ -111,15 +111,16 @@ def backup_job(request):
|
||||
#help with yaml import
|
||||
#https://github.com/kubernetes-client/python/issues/589
|
||||
|
||||
def backup_job_yaml(request):
|
||||
def backup_job_yaml(request,sync_target):
|
||||
config.load_kube_config(config_file='/code/kubeconfig')
|
||||
v1 = client.BatchV1Api()
|
||||
|
||||
with urllib.request.urlopen(https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/pod.yaml") as manifest_url:
|
||||
yaml_location = {
|
||||
"synology" : "https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/synology_pod.yaml",
|
||||
"openmediavault":"https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/openmediavault_pod.yaml"
|
||||
}
|
||||
print(yaml_location[sync_target])
|
||||
url_to_select=yaml_location[sync_target]
|
||||
api_response = v1.create_namespaced_job(body=pod_manifest_job)
|
||||
|
||||
# with open('/code/pod.yaml') as :
|
||||
job = yaml.safe_load(manifest_url)
|
||||
v1.create_namespaced_job(
|
||||
job['metadata']['namespace'], job, pretty=True
|
||||
)
|
||||
return HttpResponse(job['metadata']['namespace'])
|
||||
return HttpResponse(api_response)
|
||||
|
||||
Reference in New Issue
Block a user