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

helm: chart best practices #240

Merged
merged 1 commit into from
Aug 13, 2020

Conversation

snooyen
Copy link
Contributor

@snooyen snooyen commented Jun 30, 2020

What this PR does / why we need it:

  • Updates Helm chart resources to use recommended/standard labels.
  • Prevents undesired restarts of the secrets-store-csi-driver daemonset when running helm upgrade --install due to changing revision label.
  • Moves SecretProviderClass CRDs to crds directory. Prevents issues when installing on a cluster with pre-existing SecretProviderClass CRDS. (e.g.Error: UPGRADE FAILED: rendered manifests contain a new resource that already exists. Unable to continue with update: existing resource conflict: namespace: , name: secretproviderclasspodstatuses.secrets-store.csi.x-k8s.io, existing_kind: apiextensions.k8s.io/v1beta1, Kind=CustomResourceDefinition, new_kind: apiextensions.k8s.io/v1beta1, Kind=CustomResourceDefinition)

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #226, Fixes Azure/secrets-store-csi-driver-provider-azure#121

Special notes for your reviewer:

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 30, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @snooyen!

It looks like this is your first PR to kubernetes-sigs/secrets-store-csi-driver 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/secrets-store-csi-driver has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 30, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @snooyen. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 30, 2020
@snooyen
Copy link
Contributor Author

snooyen commented Jun 30, 2020

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.

CLA Signed

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 30, 2020
@aramase
Copy link
Member

aramase commented Jun 30, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 30, 2020
@aramase
Copy link
Member

aramase commented Jun 30, 2020

@snooyen Thank you for the PR. When upgrading from old chart to the new chart, the CRDs are being removed -

➜ helm upgrade csi charts/secrets-store-csi-driver
Release "csi" has been upgraded. Happy Helming!
NAME: csi
LAST DEPLOYED: Tue Jun 30 23:57:57 2020
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
The Secrets Store CSI Driver is getting deployed to your cluster.

To verify that Secrets Store CSI Driver has started, run:

  kubectl --namespace=default get pods -l "app=secrets-store-csi-driver"

Now you can follow these steps https://github.com/kubernetes-sigs/secrets-store-csi-driver#use-the-secrets-store-csi-driver
to create a SecretProviderClass resource, and a deployment using the SecretProviderClass.

➜ kubectl get crds
No resources found in default namespace.

I believe this is because of the crds moved to crds dir. When I upgrade the old chart with the latest from master, the upgrade works fine and the crds still exist.

@aramase
Copy link
Member

aramase commented Jul 1, 2020

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 1, 2020
@snooyen
Copy link
Contributor Author

snooyen commented Jul 1, 2020

@aramase Which chart are you upgrading from that causes the CRDs to disappear?

@aramase
Copy link
Member

aramase commented Jul 1, 2020

@aramase Which chart are you upgrading from that causes the CRDs to disappear?

@snooyen I installed the charts first using the master branch and then upgraded using helm charts from the PR.

@aramase
Copy link
Member

aramase commented Jul 14, 2020

@snooyen Did you get a chance to try it out? Helm 3 uses crds dir to install crds before deploying the rest of the templates, but I think making the switch does break the upgrade path.

Copy link
Member

@aramase aramase left a comment

Choose a reason for hiding this comment

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

@snooyen We can move the crds to a new dir, but to maintain backward compatibility and also to support users still using helm2, we need to add a crds.yaml in the template dir with

{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }}
  {{ $.Files.Get $path }}
---
{{- end }}

This will generate manifest as expected and ensure backward compatibility.

@aramase aramase added this to the v0.0.13 milestone Jul 27, 2020
@snooyen
Copy link
Contributor Author

snooyen commented Jul 31, 2020

@snooyen We can move the crds to a new dir, but to maintain backward compatibility and also to support users still using helm2, we need to add a crds.yaml in the template dir with

{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }}
  {{ $.Files.Get $path }}
---
{{- end }}

This will generate manifest as expected and ensure backward compatibility.

@aramase Sorry, I got pulled away to deal with other items. But I've just pushed the changes you requested. Tested locally, I was able to:

  1. Install using the chart on the master branch
  2. Upgrade using the chart on my branch

@snooyen snooyen requested a review from aramase July 31, 2020 17:38
@aramase
Copy link
Member

aramase commented Jul 31, 2020

@snooyen Thank you for taking the time to work on this PR.

As part of #258 we have created a new manifest_staging dir to host the helm charts. All the changes to helm chart will be done in manifest_staging and we'll then copy them to the charts dir during the release. This is done to ensure all helm/manifest releases are tagged to a release. Could you update your PR to make the changes in the manifest_staging/charts dir?

The appVersion and chartVersion are bumped as part of the release target. So no changes are required in charts dir.

@aramase
Copy link
Member

aramase commented Jul 31, 2020

/retitle helm: chart best practices

@k8s-ci-robot k8s-ci-robot changed the title Helm Chart Best Practices helm: chart best practices Jul 31, 2020
@aramase
Copy link
Member

aramase commented Aug 4, 2020

@snooyen ping! Let us know if we can help with the PR.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 2020
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 7, 2020
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 7, 2020
keep crds in templates/ directory for helm2 compatibility
@aramase
Copy link
Member

aramase commented Aug 13, 2020

/retest

Copy link
Member

@aramase aramase left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 13, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 13, 2020
@ritazh
Copy link
Member

ritazh commented Aug 13, 2020

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ritazh, snooyen

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 13, 2020
@k8s-ci-robot k8s-ci-robot merged commit 6538825 into kubernetes-sigs:master Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove revision and heritage labels from helm charts Pods restart every time the chart is deployed
4 participants