Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[velero] Add support for multiple backupstoragelocations and volumesnapshotlocations #413

Merged
merged 29 commits into from
Apr 26, 2023

Conversation

bsteinm2
Copy link
Contributor

@bsteinm2 bsteinm2 commented Oct 24, 2022

Special notes for your reviewer:

Fixes #254

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • DCO signed
  • Chart Version bumped
  • Variables are documented in the values.yaml or README.md
  • Title of the PR starts with chart name (e.g. [velero])

@bsteinm2
Copy link
Contributor Author

I would also like to add a couple things:

  1. These changes have been tested to the best of my knowledge
  2. A side note, at this page under header "Velero is not publishing prometheus metrics", shouldn't the 'metrics' port be 'http-monitoring' ? The prometheus metrics port opened by the deployment template is called http-monitoring, not metrics. I would try to open a separate PR for this, but I don't see where I can do that. Thanks in advance!

@bsteinm2 bsteinm2 force-pushed the multiplebackupstoragelocations branch from 7d8bfac to 0a8b806 Compare October 25, 2022 19:44
@jenting jenting self-requested a review October 26, 2022 13:11
@bsteinm2
Copy link
Contributor Author

Hi, these lint tests are failing due to empty values in values.yaml. If it would helpful, I could confirm that this can lint correctly by temporarily pushing some populated values under .velero.configuration.backupstoragelocation and .velero.configuration.volumesnapshotlocation? I have seen these errors before while linting this chart.

@jenting
Copy link
Collaborator

jenting commented Oct 27, 2022

Hi, these lint tests are failing due to empty values in values.yaml. If it would helpful, I could confirm that this can lint correctly by temporarily pushing some populated values under .velero.configuration.backupstoragelocation and .velero.configuration.volumesnapshotlocation? I have seen these errors before while linting this chart.

Thanks for your contribution @bsteinm2
The problem is that the user might configure the backupstoragelocation and volumesnapshotlocation manually after the helm install/upgrade. Furthermore, the volumesnapshotlocation is an optional field only required when we use restic to backup/restore pod volume.

@bsteinm2
Copy link
Contributor Author

Thanks for taking a look @jenting

The problem is that the user might configure the backupstoragelocation and volumesnapshotlocation manually after the helm install/upgrade.

If I understand correctly, you're talking about the user manually editing the backupstoragelocation/volumesnapshotlocation k8s resource? Are you saying that my additions to the backupstoragelocation and volumesnapshotlocation templates would impede editing those resources?

Furthermore, the volumesnapshotlocation is an optional field only required when we use restic to backup/restore pod volume.

I am aware of this.

It sounds to me like I should undo my changes to the values file and some logic needs to be added to the backupstoragelocation and volumesnapshotlocation, but I'm not sure what. Do you have a proposed fix?

Also, I'm just going to use BSL and VSL to abbreviate backupstoragelocation and volumesnapshotlocation now, those are too long to type out every time :)

@jenting
Copy link
Collaborator

jenting commented Oct 28, 2022

Not yet. The problem is how can we make a backward compatible. I have no idea for now.

@bsteinm2
Copy link
Contributor Author

bsteinm2 commented Jan 5, 2023

Hi @jenting, I believe these latest commits address the issue. I've tested with the old (current) values format and also with multiple BSL and VSL values configuration. Let me know what you think!

Copy link
Collaborator

@jenting jenting left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic @bsteinm2
I left some comments. It's a cool improvement.

charts/velero/Chart.yaml Outdated Show resolved Hide resolved
charts/velero/templates/backupstoragelocation.yaml Outdated Show resolved Hide resolved
charts/velero/templates/backupstoragelocation.yaml Outdated Show resolved Hide resolved
charts/velero/templates/backupstoragelocation.yaml Outdated Show resolved Hide resolved
@jenting
Copy link
Collaborator

jenting commented Jan 18, 2023

@bsteinm2 Do you have time to address the comments?

…ult provider behavior

Signed-off-by: Brandon Steinman <[email protected]>
@bsteinm2
Copy link
Contributor Author

Hopefully your comments have all been adequately addressed. Apologies that it took a while!

@jenting jenting added enhancement New feature or request velero labels Jan 31, 2023
@jenting jenting self-requested a review April 12, 2023 02:57
@jenting
Copy link
Collaborator

jenting commented Apr 24, 2023

I did a test, the BSL credential is mandatory but should be optional.

helm install velero \
  --namespace=velero \
  --create-namespace \
  --set-file credentials.secretContents.cloud=credentials-velero \
  --set configuration.provider=aws \
  --set configuration.backupStorageLocation[0].name=default \
  --set configuration.backupStorageLocation[0].bucket=velero \
  --set configuration.backupStorageLocation[0].config.region=minio-default \
  --set configuration.backupStorageLocation[0].config.s3ForcePathStyle=true \
  --set configuration.backupStorageLocation[0].config.s3Url=http://minio-default.velero.svc.cluster.local:9000 \
  --set configuration.backupStorageLocation[0].config.publicUrl=http://localhost:9000 \
  --set snapshotsEnabled=true \
  --set deployNodeAgent=true \
  --set configuration.volumeSnapshotLocation[0].name=default \
  --set configuration.volumeSnapshotLocation[0].config.region=minio-default \
  --set initContainers[0].name=velero-plugin-for-aws \
  --set initContainers[0].image=velero/velero-plugin-for-aws:v1.5.3 \
  --set initContainers[0].volumeMounts[0].mountPath=/target \
  --set initContainers[0].volumeMounts[0].name=plugins \
  --dry-run \
  ./charts/velero/

@jenting jenting force-pushed the multiplebackupstoragelocations branch 3 times, most recently from 037d826 to d99965c Compare April 25, 2023 05:18
@jenting jenting self-requested a review April 25, 2023 05:27
@jenting jenting force-pushed the multiplebackupstoragelocations branch from d99965c to fe67c0d Compare April 25, 2023 05:29
@jenting
Copy link
Collaborator

jenting commented Apr 25, 2023

@bsteinm2 I have fixed all the issues I found.

@jenting jenting requested a review from qiuming-best April 25, 2023 05:35
@jenting jenting merged commit 4553dc5 into vmware-tanzu:main Apr 26, 2023
@benedikt-bartscher
Copy link

benedikt-bartscher commented Apr 26, 2023

Hey there, thanks for your work on the helm chart.
I just updated my helm deployment and realized that the velero deployment only gets created if .Values.configuration.provider exists, which got removed from the default values with this PR. I than readded configuration.provider to my values.yaml to fix this (redeploy the velero controller) but the helm charts checks do not allow this, the installs fails with this message from NOTES.txt:
REMOVED: .configuration.provider has been removed, instead each backupStorageLocation and volumeSnapshotLocation has a provider configured

AnthonyEnr1quez referenced this pull request in AnthonyEnr1quez/k3s-gitops May 8, 2023
Stackclash referenced this pull request in Stackclash/home-cluster May 25, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [velero](https://togithub.com/vmware-tanzu/velero)
([source](https://togithub.com/vmware-tanzu/helm-charts)) | major |
`3.2.0` -> `4.0.2` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the
Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>vmware-tanzu/helm-charts</summary>

###
[`v4.0.2`](https://togithub.com/vmware-tanzu/helm-charts/releases/tag/velero-4.0.2)

[Compare
Source](https://togithub.com/vmware-tanzu/helm-charts/compare/velero-4.0.1...velero-4.0.2)

A Helm chart for velero

#### What's Changed

- \[velero] ci: add k8s 1.26 and 1.27 tests by
[@&#8203;jenting](https://togithub.com/jenting) in
[https://github.com/vmware-tanzu/helm-charts/pull/453](https://togithub.com/vmware-tanzu/helm-charts/pull/453)
- \[velero] doc: the configuration.provider is deprecated by
[@&#8203;jenting](https://togithub.com/jenting) in
[https://github.com/vmware-tanzu/helm-charts/pull/458](https://togithub.com/vmware-tanzu/helm-charts/pull/458)

**Full Changelog**:
vmware-tanzu/helm-charts@velero-4.0.1...velero-4.0.2

###
[`v4.0.1`](https://togithub.com/vmware-tanzu/helm-charts/releases/tag/velero-4.0.1)

[Compare
Source](https://togithub.com/vmware-tanzu/helm-charts/compare/velero-4.0.0...velero-4.0.1)

A Helm chart for velero

#### What's Changed

- \[velero] Fix no velero deployment by
[@&#8203;jenting](https://togithub.com/jenting) in
[https://github.com/vmware-tanzu/helm-charts/pull/455](https://togithub.com/vmware-tanzu/helm-charts/pull/455)

**Full Changelog**:
vmware-tanzu/helm-charts@velero-4.0.0...velero-4.0.1

###
[`v4.0.0`](https://togithub.com/vmware-tanzu/helm-charts/releases/tag/velero-4.0.0)

[Compare
Source](https://togithub.com/vmware-tanzu/helm-charts/compare/velero-3.2.0...velero-4.0.0)

A Helm chart for velero

#### What's Changed

- \[velero] Add support for multiple backupstoragelocations and
volumesnapshotlocations by
[@&#8203;bsteinm2](https://togithub.com/bsteinm2) in
[https://github.com/vmware-tanzu/helm-charts/pull/413](https://togithub.com/vmware-tanzu/helm-charts/pull/413)

#### New Contributors

- [@&#8203;bsteinm2](https://togithub.com/bsteinm2) made their first
contribution in
[https://github.com/vmware-tanzu/helm-charts/pull/413](https://togithub.com/vmware-tanzu/helm-charts/pull/413)

**Full Changelog**:
vmware-tanzu/helm-charts@velero-3.2.0...velero-4.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on saturday" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/RickCoxDev/home-cluster).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS43OS4xIiwidXBkYXRlZEluVmVyIjoiMzUuOTguNCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@wilmardo
Copy link

Is there a reason a slice was chosen over a map? schedules already is a map based on names and allows for multiple schedules to be created. This now is a slice and deviates from that, not really intuitive from a user perspective.

Using maps is also one of the best-practices outlined in the Helm docs:

For this reason, it's often better to structure your values file using maps.

source: https://helm.sh/docs/chart_best_practices/values/#consider-how-users-will-use-your-values

Also lists are annoying since they are non mergeable. You need to redeclare the whole list to add something.
We for example had a velero umbrella chart providing some defaults which were getting merged with the user provided values, this now isn't possible with the backupStorageLocation anymore.

For example:

# defaults in the umbrella
      configuration:
          provider: aws
          backupStorageLocation:
            bucket: dummy
            config:
              region: eu-central-1

# user-provided
          backupStorageLocation:
            bucket: name

Keeps things nice and DRY :)

This now isn't possible and the user needs to redeclare the whole list.

An example approach with a map would have kept this possibility:

# defaults in the umbrella
      configuration:
          backupStorageLocation:
            default:
              bucket: dummy
              provider: aws              
              config:
                region: eu-central-1
 # user-provided
          backupStorageLocation:
            default:
               bucket: name
           customerLocationUserSpecific:
              bucket: somethingvalid
              provider: aws              
              config:
                region: us-west-1

Let me know if this is something that would be considered for a PR. To bad I see this PR so late, feels a little to late now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request velero
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How can i create helm release with multiple backup storage locations?
5 participants