Skip to content

helm fails installing CRDs using crd-install hook #5054

Closed

Description

@AMecea

This happens only with version 2.12.0 with version 2.11.0 works fine.

When trying to install a chart that installs CRDs with crd-install hook installation fails with the following error:

$ helm repo add presslabs https://presslabs.github.io/charts
"presslabs" has been added to your repositories

$ helm install presslabs/mysql-operator --name oper                                                                                                                                             
Error: customresourcedefinitions.apiextensions.k8s.io "mysqlbackups.mysql.presslabs.org" already exists

The chart crds template can be found here.

The CRDs are installed but the release is failed:

$ kubectl get crds                                                                                                                                                                                    
NAME                                    CREATED AT
mysqlbackups.mysql.presslabs.org        2018-12-13T16:17:52Z
mysqlclusters.mysql.presslabs.org       2018-12-13T16:17:52Z

$ helm ls
NAME	REVISION	UPDATED                 	STATUS	CHART               	APP VERSION	NAMESPACE
oper	1       	Thu Dec 13 18:17:51 2018	FAILED	mysql-operator-0.2.1	v0.2.1     	default 

After deleting the release the CRDs will be deleted too:

$ helm delete --purge oper                                                                                                                                                                      
release "oper" deleted

$ kubectl get crds
No resources found.

The CRD description:

$ kubectl describe crd mysqlclusters.mysql.presslabs.org                                                                                                                                              
Name:         mysqlclusters.mysql.presslabs.org
Namespace:    
Labels:       app=mysql-operator
              chart=mysql-operator-0.2.1
              controller-tools.k8s.io=1.0
              heritage=Tiller
              release=oper
Annotations:  helm.sh/hook=crd-install
API Version:  apiextensions.k8s.io/v1beta1
Kind:         CustomResourceDefinition
Metadata:
  Creation Timestamp:  2018-12-13T16:32:29Z
  Generation:          1
  Resource Version:    5047801
  Self Link:           /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/mysqlclusters.mysql.presslabs.org
  UID:                 aebf3973-fef4-11e8-811a-42010a9c0035
Spec:
  Additional Printer Columns:
    JSON Path:    .metadata.creationTimestamp
    Description:  CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.

Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
    Name:  Age
    Type:  date
  Group:   mysql.presslabs.org
  Names:
    Kind:       MysqlCluster
    List Kind:  MysqlClusterList
    Plural:     mysqlclusters
    Short Names:
      mysql
    Singular:  mysqlcluster
  Scope:       Namespaced
  Subresources:
    Scale:
      Spec Replicas Path:    .spec.replicas
      Status Replicas Path:  .status.readyNodes
    Status:
  Version:  v1alpha1
  Versions:
    Name:     v1alpha1
    Served:   true
    Storage:  true
Status:
  Accepted Names:
    Kind:       MysqlCluster
    List Kind:  MysqlClusterList
    Plural:     mysqlclusters
    Short Names:
      mysql
    Singular:  mysqlcluster
  Conditions:
    Last Transition Time:  2018-12-13T16:32:29Z
    Message:               no conflicts found
    Reason:                NoConflicts
    Status:                True
    Type:                  NamesAccepted
    Last Transition Time:  <nil>
    Message:               the initial names have been accepted
    Reason:                InitialNamesAccepted
    Status:                True
    Type:                  Established
  Stored Versions:
    v1alpha1
Events:  <none>

Output of helm version:

Client: &version.Version{SemVer:"v2.12.0", GitCommit:"d325d2a9c179b33af1a024cdb5a4472b6288016a", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.12.0", GitCommit:"d325d2a9c179b33af1a024cdb5a4472b6288016a", GitTreeState:"clean"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.0", GitCommit:"91e7b4fd31fcd3d5f436da26c980becec37ceefe", GitTreeState:"clean", BuildDate:"2018-06-27T20:17:28Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.2-gke.18", GitCommit:"5796233393d7bc034428de15191ad3d2eaff95fb", GitTreeState:"clean", BuildDate:"2018-11-08T20:49:08Z", GoVersion:"go1.10.3b4", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.): GKE, Digital Ocean

Activity

  1. philoserf commented on Dec 13, 2018

    @philoserf

    reference issues: helm/charts#9941, helm/charts#9166
    potential source: #4709

  2. philoserf commented on Dec 14, 2018

    @philoserf

    Can you take a look @mmerrill3

    I am still looking for any other cause. It may be that in fixing #4704 and the delete case the install case was broken.

  3. mortent commented on Dec 15, 2018

    @mortent

    #4709 is the source of this bug. It causes the CRDs to first be installed in the crd_install hook and then also tries to install it with the other resources. So this will break install of all charts that uses the crd_install hook.
    It also changes the semantics of the crd_install hook, since this causes the CRDs to be tracked as part of the release. This causes CRDs to be deleted when a release is removed, which is not safe.

  4. GitBytes commented on Dec 16, 2018

    @GitBytes

    +1

  5. paskal commented on Dec 17, 2018

    @paskal

    In my case I can't install prometheus-operator as subchart of my own chart at all because of this bug.
    Team, could you please revert this change and release bugfix version 12.1 with it?
    cc @technosophos

  6. bacongobbler commented on Dec 17, 2018

    @bacongobbler
    Member

    Back from kubecon. I can take a closer look.

  7. added
    bug
    on Dec 17, 2018
  8. added this to the 2.12.1 milestone on Dec 17, 2018
  9. bacongobbler commented on Dec 17, 2018

    @bacongobbler
    Member

    If y'all wouldn't mind testing #5067 and confirm that it retains the old behaviour of the crd-install hook, that'd be much appreciated. Thanks!

  10. philoserf commented on Dec 17, 2018

    @philoserf

    I can confirm this corrects the situation @bacongobbler

  11. hobti01 commented on Dec 17, 2018

    @hobti01
    Contributor

    We have seen that after installing with 2.12 and downgrading to 2.11 our CRDs were removed - presumably the same deletion will happen with reversal of this. Perhaps because 2.12 owns the CRDs and 2.11 doesn't.

  12. bacongobbler commented on Dec 17, 2018

    @bacongobbler
    Member

    that's exactly correct, @hobti01. @mortent wrote up a pretty good summary of the issue in a comment a little further up^

    #5054 (comment)

  13. hobti01 commented on Dec 17, 2018

    @hobti01
    Contributor

    Yes, his summary is great but perhaps does not highlight the impact of a downgrade or reversion for anyone who worked around the 2.12 issue.

    We worked around the issue for cert-manager with 2.12 by installing with the chart-specific ability/flag to not install CRDs, then using normal upgrade. So now we are "ok" for 2.12, but reverting will cause an un-install of all CRDs and therefore all custom resources.

    In both cases, CRDs get deleted, which is unfortunate, but we're happy to have reliable behaviour and working installations and upgrades.

  14. added a commit that references this issue on Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions