Skip to content

feat(cert-manager): install helm with crds - #1536

Closed
anasinnyk wants to merge 2 commits into
cert-manager:masterfrom
MacPaw:master
Closed

anasinnyk wants to merge 2 commits into
cert-manager:masterfrom
MacPaw:master

Conversation

@anasinnyk

Copy link
Copy Markdown

What this PR does / why we need it: We need to install all chart by helm

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes helm/charts#10949
Special notes for your reviewer:

Release note:

- add crds
- add podsecuritypolicy
- add crds cleanup

Signed-off-by: Andrii Nasinnyk <[email protected]>
Signed-off-by: Andrii Nasinnyk <[email protected]>
@jetstack-bot

Copy link
Copy Markdown
Contributor

@anasinnyk: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

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.

@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 10, 2019
@jetstack-bot

Copy link
Copy Markdown
Contributor

Hi @anasinnyk. Thanks for your PR.

I'm waiting for a jetstack or cert-manager 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.

Details

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.

@jetstack-bot jetstack-bot added the area/deploy Indicates a PR modifies deployment configuration label Apr 10, 2019
@jetstack-bot
jetstack-bot requested a review from munnerz April 10, 2019 14:24
@jetstack-bot jetstack-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 10, 2019
@jetstack-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: anasinnyk
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: simonswine

If they are not already assigned, you can assign the PR to them by writing /assign @simonswine in a comment when ready.

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

The pull request process is described here

Details 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

@@ -0,0 +1,154 @@
{{- if and .Release.IsInstall .Values.crds.create -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would delete crds on upgrade.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hm... I don't think so. That install only once and not modify it after upgrade. I checked it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

kubectl delete clusterissuers --all;
kubectl delete orders --all;
kubectl delete challenges --all;
sleep 10;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is hacky. Shouldn't it suffice to delete the crds?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That's optionally and disable by default. I found it in stable/prometheus-operator

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@munnerz

munnerz commented Apr 11, 2019

Copy link
Copy Markdown
Member

After the debacle with the crd-install hook in the past, I'm not really comfortable introducing this option back into our chart until we're sure it will behave well in recent versions of Helm. We have users on pre-2.9 versions, and when this is installed the hook will actually be ignored.

There seems to be a lot of code here that's effectively working around Helm's own deficiencies in CRD management in charts - when considering the full test matrix of helm versions, as well as users upgrading from/to different cert-manager chart versions, I don't think any homegrown solution that isn't an actual, official & supported method is going to bite us at some point.

The reason for moving the CRDs out of the chart altogether is that a lot of users experienced their CRDs being deleted upon upgrade, deleting important configuration and also breaking those users upgrade paths.

I really want to enforce a separation between "cert-manager API types" and cert-manager itself, as from a kubernetes perspective they are quite distinct things (think: kube-apiserver vs kube-controller-manager).

Unless someone from the upstream Helm project can comment as to how this situation has improved over the last few months (I may have missed some movement!), I am inclined to not accept this PR until we are certain we won't have destructive behaviour again.

@anasinnyk

anasinnyk commented Apr 11, 2019 •

Copy link
Copy Markdown
Author

@munnerz I can describe some workaround like that: https://github.com/helm/charts/tree/master/stable/prometheus-operator#helm-210-workaround in our case it's more easier we just should disable crds.create=false or we can set this option to false by default, but it's really useful when we have crds installed with chart. It's one way use it form terraform for example.
What do you think?

@anasinnyk

Copy link
Copy Markdown
Author

@munnerz what do you think about the previous comment?

@anasinnyk

Copy link
Copy Markdown
Author

@munnerz please answer to my comment.
best regards, @anasinnyk

@jhoblitt

Copy link
Copy Markdown

The pre-flight manual set of needing to inject CRDs really makes it painful to use this chart with the terraform helm provider. Doubly so when tf is also provisioning the k8s cluster.

@munnerz Would you consider adding a tillerVersion constraint?

@munnerz

munnerz commented Apr 24, 2019

Copy link
Copy Markdown
Member

@munnerz I can describe some workaround like that: https://github.com/helm/charts/tree/master/stable/prometheus-operator#helm-210-workaround in our case it's more easier we just should disable crds.create=false or we can set this option to false by default, but it's really useful when we have crds installed with chart. It's one way use it form terraform for example.

My concern is more the additional burden/overhead on us as maintainers to ensure users can upgrade safely. Adding it as an option implies that we will support that installation mechanism moving forward (and if we don't commit to this, then I think it's a short-return if we were to add it in).

So far there's not been that much movement in the upstream Helm project to properly resolve the issues we had before, so I'm not comfortable supporting this installation/upgrade mechanism without seeing that addressed.

The pre-flight manual set of needing to inject CRDs really makes it painful to use this chart with the terraform helm provider. Doubly so when tf is also provisioning the k8s cluster.

With regards to terraform, you should be able to add an explicit depends_on field to your Helm chart installation resource, causing terraform to run your "install CRDs" resource type before the installation of cert-manager?

@jhoblitt

Copy link
Copy Markdown

The terraform kubernetes provider has no support for CRDs as under the current model, a new resource type would have to be added for each CRD. This is why charts are often used to package up the kubernetes resources and tf handles ordering and introspection, which helm can not provide.

@munnerz

munnerz commented Apr 25, 2019

Copy link
Copy Markdown
Member

That makes sense, but I don't think it precludes you using Terraform's DAG to specify "this resource must exist before this one". This could either be two different Helm chart resources, one of them explicitly declaring a depends_on on the other one, or whatever other preferred way you have of installing actual CustomResourceDefinitions.

I understand it may be easier from a first-time-install point of view to bundle them all into one, but we lose the ability to upgrade the CustomResourceDefinition resources in future, as well as introduce behaviour that is unpredictable between Helm/Tiller versions.

Given that the Helm project still doesn't have a good answer to these problems, I don't think we should switch back to this model until we can be certain that we can continue to maintain/upgrade user's cert-manager installations long term.

I'm going to close this now, as I think any attempt to add CRDs back into our Helm chart is going to need to be accompanied by an analysis/document detailing:

  • How first time installation works
  • How upgrades work after first time installation
  • How uninstallation works
  • How we handle older/newer Helm/Tiller clients

I appreciate this isn't the answer you're hoping for, but adding an additional installation mechanism makes supporting users twice as hard, as we have an entire new matrix of installation problems that can be encountered - and we've already been burnt by a lot of these installation problems in the past, and made a decision to move away from this model for that reason.

Thanks for putting this together though - and for the insight into problems Terraform users face with cert-manager 🙈

@munnerz munnerz closed this Apr 25, 2019
@gabzim

gabzim commented Jul 7, 2019

Copy link
Copy Markdown

Why not provide this as a beta, unstable feature under a flag? Having Helm install the CRDs is exactly what a few of my projects need to have terraform manage the cluster smoothly without outside interaction.

If you don't want to support user installations using this feature then make it clear in the docs and hide it behind a flag? experimental.installCrds or something.

@drewwells drewwells mentioned this pull request Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/deploy Indicates a PR modifies deployment configuration dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[stable/cert-manager] New Install fails - validation failed: - no matches for kind "Certificate" in version "certmanager.k8s.io/v1alpha1"

6 participants