Skip to content

Commit

Permalink
feat: add velero endpoint customization from templates and schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nutellinoit committed Jan 9, 2024
1 parent d8545f8 commit 256cfec
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 2 deletions.
9 changes: 8 additions & 1 deletion defaults/kfddistribution-kfd-v1alpha2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,14 @@ data:
nodeSelector: null
tolerations: null
# the standard configuration for velero on the dr module
velero: {}
velero:
backend: minio
externalEndpoint:
endpoint: s3.eu-west-1.amazonaws.com
insecure: false
secretAccessKey: example
accessKeyId: example
bucketName: velerobucket
# auth module configuration
auth:
overrides:
Expand Down
9 changes: 8 additions & 1 deletion defaults/onpremises-kfd-v1alpha2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,14 @@ data:
nodeSelector: null
tolerations: null
# the standard configuration for velero on the dr module
velero: {}
velero:
backend: minio
externalEndpoint:
endpoint: s3.eu-west-1.amazonaws.com
insecure: false
secretAccessKey: example
accessKeyId: example
bucketName: velerobucket
# auth module configuration
auth:
overrides:
Expand Down
28 changes: 28 additions & 0 deletions schemas/public/kfddistribution-kfd-v1alpha2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,34 @@
"type": "object",
"additionalProperties": false,
"properties": {
"retentionTime": {
"type": "string"
},
"backend": {
"type": "string",
"enum": ["minio", "externalEndpoint"]
},
"externalEndpoint" : {
"type": "object",
"additionalProperties": false,
"properties": {
"endpoint": {
"type": "string"
},
"insecure": {
"type": "boolean"
},
"secretAccessKey": {
"type": "string"
},
"accessKeyId": {
"type": "string"
},
"bucketName": {
"type": "string"
}
}
},
"overrides": {
"$ref": "#/$defs/Types.FuryModuleComponentOverrides"
}
Expand Down
28 changes: 28 additions & 0 deletions schemas/public/onpremises-kfd-v1alpha2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,34 @@
"type": "object",
"additionalProperties": false,
"properties": {
"retentionTime": {
"type": "string"
},
"backend": {
"type": "string",
"enum": ["minio", "externalEndpoint"]
},
"externalEndpoint" : {
"type": "object",
"additionalProperties": false,
"properties": {
"endpoint": {
"type": "string"
},
"insecure": {
"type": "boolean"
},
"secretAccessKey": {
"type": "string"
},
"accessKeyId": {
"type": "string"
},
"bucketName": {
"type": "string"
}
}
},
"overrides": {
"$ref": "#/$defs/Types.FuryModuleComponentOverrides"
}
Expand Down
17 changes: 17 additions & 0 deletions templates/distribution/manifests/dr/kustomization.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ resources:
{{- if eq .spec.distribution.common.provider.type "eks" }}
- {{ print "../" .spec.distribution.common.relativeVendorPath "/modules/dr/katalog/velero/velero-aws" }}
{{- else if eq .spec.distribution.common.provider.type "none" }}

{{- if eq .spec.distribution.modules.dr.velero.backend "minio" }}
- {{ print "../" .spec.distribution.common.relativeVendorPath "/modules/dr/katalog/velero/velero-on-prem" }}
{{- else }}
- {{ print "../" .spec.distribution.common.relativeVendorPath "/modules/dr/katalog/velero/velero-aws" }}
- resources/storageLocation.yaml
{{- end }}
- {{ print "../" .spec.distribution.common.relativeVendorPath "/modules/dr/katalog/velero/velero-node-agent" }}

{{- end }}
- {{ print "../" .spec.distribution.common.relativeVendorPath "/modules/dr/katalog/velero/velero-schedules" }}
{{- if eq .spec.distribution.common.provider.type "eks" }}
Expand All @@ -24,3 +31,13 @@ patchesStrategicMerge:
{{- if eq .spec.distribution.common.provider.type "eks" }}
- patches/eks-velero.yml
{{- end }}

{{- if eq .spec.distribution.common.provider.type "none" }}
{{- if eq .spec.distribution.modules.dr.velero.backend "externalEndpoint" }}
secretGenerator:
- name: cloud-credentials
namespace: kube-system
files:
- cloud=secrets/cloud-credentials.config
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2017-present SIGHUP s.r.l All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

---
apiVersion: velero.io/v1
kind: BackupStorageLocation
metadata:
labels:
k8s-app: velero
name: default
namespace: kube-system
spec:
config:
region: custom
s3ForcePathStyle: "true"
s3Url: {{ ternary "http" "https" .spec.distribution.modules.dr.velero.externalEndpoint.insecure }}://{{ .spec.distribution.modules.dr.velero.externalEndpoint.endpoint }}
objectStorage:
bucket: {{ .spec.distribution.modules.dr.velero.externalEndpoint.bucketName }}
provider: aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default]
aws_access_key_id = {{ .spec.distribution.modules.dr.velero.externalEndpoint.accessKeyId }}
aws_secret_access_key = {{ .spec.distribution.modules.dr.velero.externalEndpoint.secretAccessKey }}

0 comments on commit 256cfec

Please sign in to comment.