Skip to content

Commit

Permalink
feat: Add optional path field for Azure backend
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Ritter <[email protected]>
  • Loading branch information
l0wl3vel committed Dec 13, 2023
1 parent 608c1d1 commit a8b084e
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/v1/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions config/crd/apiextensions.k8s.io/v1/k8up.io_archives.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/apiextensions.k8s.io/v1/k8up.io_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/apiextensions.k8s.io/v1/k8up.io_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/apiextensions.k8s.io/v1/k8up.io_prunes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/apiextensions.k8s.io/v1/k8up.io_restores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down
12 changes: 12 additions & 0 deletions config/crd/apiextensions.k8s.io/v1/k8up.io_schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down Expand Up @@ -693,6 +695,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down Expand Up @@ -998,6 +1002,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down Expand Up @@ -1549,6 +1555,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down Expand Up @@ -2262,6 +2270,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down Expand Up @@ -2859,6 +2869,8 @@ spec:
x-kubernetes-map-type: atomic
container:
type: string
path:
type: string
type: object
b2:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a8b084e

Please sign in to comment.