From a8b084ec6071e497f072d7c75f21487960ca6199 Mon Sep 17 00:00:00 2001 From: Benjamin Ritter Date: Wed, 13 Dec 2023 13:04:00 +0100 Subject: [PATCH] feat: Add optional path field for Azure backend Signed-off-by: Benjamin Ritter --- api/v1/backend.go | 10 ++++++++-- .../apiextensions.k8s.io/v1/k8up.io_archives.yaml | 2 ++ .../crd/apiextensions.k8s.io/v1/k8up.io_backups.yaml | 2 ++ .../crd/apiextensions.k8s.io/v1/k8up.io_checks.yaml | 2 ++ .../crd/apiextensions.k8s.io/v1/k8up.io_prunes.yaml | 2 ++ .../apiextensions.k8s.io/v1/k8up.io_restores.yaml | 2 ++ .../apiextensions.k8s.io/v1/k8up.io_schedules.yaml | 12 ++++++++++++ .../ROOT/pages/references/object-specifications.adoc | 1 + 8 files changed, 31 insertions(+), 2 deletions(-) diff --git a/api/v1/backend.go b/api/v1/backend.go index ca0de3be7..dd74912fb 100644 --- a/api/v1/backend.go +++ b/api/v1/backend.go @@ -204,6 +204,7 @@ func (in *GCSSpec) String() string { type AzureSpec struct { Container string `json:"container,omitempty"` + Path string `json:"path,omitempty"` AccountNameSecretRef *corev1.SecretKeySelector `json:"accountNameSecretRef,omitempty"` AccountKeySecretRef *corev1.SecretKeySelector `json:"accountKeySecretRef,omitempty"` } @@ -215,9 +216,14 @@ func (in *AzureSpec) EnvVars(vars map[string]*corev1.EnvVarSource) map[string]*c return vars } -// String returns "azure:container:/" +// String returns "azure:container:path" +// If Path is empty, the default value "/" will be used as path func (in *AzureSpec) String() string { - return fmt.Sprintf("azure:%s:/", in.Container) + path := "/" + if in.Path != "" { + path = in.Path + } + return fmt.Sprintf("azure:%s:%s", in.Container, path) } type SwiftSpec struct { diff --git a/config/crd/apiextensions.k8s.io/v1/k8up.io_archives.yaml b/config/crd/apiextensions.k8s.io/v1/k8up.io_archives.yaml index db2842c58..78919c600 100644 --- a/config/crd/apiextensions.k8s.io/v1/k8up.io_archives.yaml +++ b/config/crd/apiextensions.k8s.io/v1/k8up.io_archives.yaml @@ -100,6 +100,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: diff --git a/config/crd/apiextensions.k8s.io/v1/k8up.io_backups.yaml b/config/crd/apiextensions.k8s.io/v1/k8up.io_backups.yaml index ff068e366..992c13041 100644 --- a/config/crd/apiextensions.k8s.io/v1/k8up.io_backups.yaml +++ b/config/crd/apiextensions.k8s.io/v1/k8up.io_backups.yaml @@ -107,6 +107,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: diff --git a/config/crd/apiextensions.k8s.io/v1/k8up.io_checks.yaml b/config/crd/apiextensions.k8s.io/v1/k8up.io_checks.yaml index 7ac97eabc..b55642725 100644 --- a/config/crd/apiextensions.k8s.io/v1/k8up.io_checks.yaml +++ b/config/crd/apiextensions.k8s.io/v1/k8up.io_checks.yaml @@ -101,6 +101,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: diff --git a/config/crd/apiextensions.k8s.io/v1/k8up.io_prunes.yaml b/config/crd/apiextensions.k8s.io/v1/k8up.io_prunes.yaml index 8fb06ce0d..086aa92c8 100644 --- a/config/crd/apiextensions.k8s.io/v1/k8up.io_prunes.yaml +++ b/config/crd/apiextensions.k8s.io/v1/k8up.io_prunes.yaml @@ -101,6 +101,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: diff --git a/config/crd/apiextensions.k8s.io/v1/k8up.io_restores.yaml b/config/crd/apiextensions.k8s.io/v1/k8up.io_restores.yaml index 8e8fe6bd2..ab7cde027 100644 --- a/config/crd/apiextensions.k8s.io/v1/k8up.io_restores.yaml +++ b/config/crd/apiextensions.k8s.io/v1/k8up.io_restores.yaml @@ -101,6 +101,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: diff --git a/config/crd/apiextensions.k8s.io/v1/k8up.io_schedules.yaml b/config/crd/apiextensions.k8s.io/v1/k8up.io_schedules.yaml index 9dc0832a0..e77453f8d 100644 --- a/config/crd/apiextensions.k8s.io/v1/k8up.io_schedules.yaml +++ b/config/crd/apiextensions.k8s.io/v1/k8up.io_schedules.yaml @@ -93,6 +93,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: @@ -693,6 +695,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: @@ -998,6 +1002,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: @@ -1549,6 +1555,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: @@ -2262,6 +2270,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: @@ -2859,6 +2869,8 @@ spec: x-kubernetes-map-type: atomic container: type: string + path: + type: string type: object b2: properties: diff --git a/docs/modules/ROOT/pages/references/object-specifications.adoc b/docs/modules/ROOT/pages/references/object-specifications.adoc index c7a6c0ca3..f5154f512 100644 --- a/docs/modules/ROOT/pages/references/object-specifications.adoc +++ b/docs/modules/ROOT/pages/references/object-specifications.adoc @@ -388,6 +388,7 @@ Settings: Settings: * `container`: name of the container that should be used +* `path`: path inside the container, will default to "/" if omitted * `accountNameSecretRef`: Kubernetes secret reference containing the account name * `accountKeySecretRef`: Kubernetes secret reference containing the account key