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

Prioritize location provider over global provider #97

Merged
merged 2 commits into from
Apr 13, 2020

Conversation

yurinnick
Copy link
Contributor

@yurinnick yurinnick commented Apr 10, 2020

Closes #95.

Prioritize configuration.(backupStorageLocation|volumeSnapshotLocation).config over configuration.provider

Signed-off-by: Nikolai Iurin yurinnick93@gmail.com

@@ -89,7 +89,7 @@ Create the backup storage location provider
*/}}
{{- define "velero.backupStorageLocation.provider" -}}
{{- with .Values.configuration -}}
{{ default .backupStorageLocation.provider .provider }}
{{ default .provider .backupStorageLocation.provider }}
Copy link
Contributor

Choose a reason for hiding this comment

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

In the line below, if there's a value for provider, it will make that the default value for the backupStorageLocation.provider anyway. Unless I'm reading this wrong. If it's right, would this be necessary?

https://github.com/vmware-tanzu/helm-charts/blob/master/charts/velero/templates/_helpers.tpl#L92

Copy link
Contributor Author

@yurinnick yurinnick Apr 10, 2020

Choose a reason for hiding this comment

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

Currently, if configuration.provider is set (and it has to be to enable deployment) it overrides configuration.backupStorageLocation.provider. Why? Because the first value is actually the default and the second one if given: doc. Not really intuitive, but it is how it is.

Copy link
Contributor

@carlisia carlisia Apr 11, 2020

Choose a reason for hiding this comment

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

I appreciate the explanation! My understanding was the exact opposite, so, glad to have this corrected. Thanks for the link to the relevant docs, I'll revisit that too.

@austinbv
Copy link
Contributor

I just submitted this same thing as a PR and closed it b/c this is here #98

@carlisia helm documentation is default DEFAULT_VALUE GIVEN_VALUE see https://v2.helm.sh/docs/chart_template_guide/#using-the-default-function

This threw me through a loop too but if this PR is merged the chart will default to configuration.provider if there is no more specific provider defined in configuration.backupStorageLocation or configuration.volumeSnapshotLocation.

This PR is huge as it lets us define separate providers for both the volumeSnapshotLocation and backupStorageLocation and define a configuration.provider which is required in the deployment here https://github.com/vmware-tanzu/helm-charts/blob/master/charts/velero/templates/deployment.yaml#L1-L2

@carlisia
Copy link
Contributor

Ok, makes sense. @yurinnick let's bump the chart version and get it merged.

Signed-off-by: Nikolai Iurin <yurinnick93@gmail.com>
Signed-off-by: Nikolai Iurin <yurinnick93@gmail.com>
Copy link
Contributor

@carlisia carlisia left a comment

Choose a reason for hiding this comment

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

Thank you for this! 👍

@carlisia carlisia requested review from cpanato, nrb and skriss April 13, 2020 16:54
Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

thanks for this @yurinnick, this change makes sense to me.

It'd be great if you could also update the comments in values.yaml to describe the new precedence here.

@@ -89,7 +89,7 @@ Create the backup storage location provider
*/}}
{{- define "velero.backupStorageLocation.provider" -}}
{{- with .Values.configuration -}}
{{ default .backupStorageLocation.provider .provider }}
{{ default .provider .backupStorageLocation.provider }}
Copy link
Member

Choose a reason for hiding this comment

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

should this be {{ default .provider .backupStorageLocation.name }}? .backupStorageLocation.name is what I see documented in values.yaml and the docs. However, I also see on L90 that we're using {{- define "velero.backupStorageLocation.provider" -}}, and in the backupstoragelocation template we reference backupStorageLocation.provider (https://github.com/vmware-tanzu/helm-charts/blob/master/charts/velero/templates/backupstoragelocation.yaml#L12).

Not entirely sure but it seems like there's an inconsistency somewhere.

Copy link
Contributor

@austinbv austinbv Apr 13, 2020

Choose a reason for hiding this comment

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

hey @skriss I see name and provider being a bit decoupled - name is used for the name of a resource while the provider is used by the plugin for config.

To use name you actually introduce complexity - for example when using digital ocean you would set your provider as digitalocean.com/velero which is not a valid kubernetes resource name because of the /

Another use case would be more than one AWS providers with different names

Copy link
Member

Choose a reason for hiding this comment

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

I totally agree they should be separate things. I'm just trying to ensure that (a) we're not making a backwards-incompatible change if we were previously using the "name" value to fill in the provider and now we're no longer doing so; and (b) that the docs are accurate.

I can't really tell at a glance if we're making a backwards-incompatible change here, but it seems like probably not?

If not, then let's please just document that there is now a backupStorageLocation.provider that is separate from backupStorageLocation.name.

@@ -107,6 +107,6 @@ Create the volume snapshot location provider
*/}}
{{- define "velero.volumeSnapshotLocation.provider" -}}
{{- with .Values.configuration -}}
{{ default .volumeSnapshotLocation.provider .provider }}
{{ default .provider .volumeSnapshotLocation.provider }}
Copy link
Member

Choose a reason for hiding this comment

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

same question here

Copy link
Contributor

Choose a reason for hiding this comment

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

see above

austinbv added a commit to focused-labs/helm-charts that referenced this pull request Apr 13, 2020
Documentation in the `values.yaml` to make clear having
seperate providers for `volumeSnapshotLocation`,
`backupStorageLocation`, and the `deployment.yaml`

This fixes vmware-tanzu#97 (review)

Signed-off-by: Austin Vance <austin@focusedlabs.io>
austinbv added a commit to focused-labs/helm-charts that referenced this pull request Apr 13, 2020
Documentation in the `values.yaml` to make clear having
separate providers for `volumeSnapshotLocation`,
`backupStorageLocation`, and the `deployment.yaml`

This fixes vmware-tanzu#97 (review)

Signed-off-by: Austin Vance <austin@focusedlabs.io>
@austinbv
Copy link
Contributor

@skriss I didn't have permission to modify this but if you merge #100 along with this change I think the documentation will be included.

@carlisia carlisia requested a review from skriss April 13, 2020 20:12
@skriss skriss merged commit e7d4d44 into vmware-tanzu:master Apr 13, 2020
@yurinnick yurinnick deleted the provider-priority branch April 13, 2020 21:38
austinbv added a commit to focused-labs/helm-charts that referenced this pull request Apr 13, 2020
Documentation in the `values.yaml` to make clear having
separate providers for `volumeSnapshotLocation`,
`backupStorageLocation`, and the `deployment.yaml`

This fixes vmware-tanzu#97 (review)

Signed-off-by: Austin Vance <austin@focusedlabs.io>
austinbv added a commit to focused-labs/helm-charts that referenced this pull request Apr 14, 2020
Documentation in the `values.yaml` to make clear having
separate providers for `volumeSnapshotLocation`,
`backupStorageLocation`, and the `deployment.yaml`

This fixes vmware-tanzu#97 (review)

Signed-off-by: Austin Vance <austin@focusedlabs.io>
galina-tochilkin pushed a commit to mtp-devops/3d-party-helm that referenced this pull request Jul 31, 2022
Documentation in the `values.yaml` to make clear having
separate providers for `volumeSnapshotLocation`,
`backupStorageLocation`, and the `deployment.yaml`

This fixes vmware-tanzu/helm-charts#97 (review)

Signed-off-by: Austin Vance <austin@focusedlabs.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provider configuration options
4 participants