Repository navigation
Description
Output of helm version:
Client: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
Output of kubectl version:
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-08T16:31:16Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.7", GitCommit:"0c38c362511b20a098d7cd855f1314dad92c2780", GitTreeState:"clean", BuildDate:"2018-08-20T09:56:31Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Cloud Provider/Platform (AKS, GKE, Minikube etc.):
AWS
Hello,
When we update an existing chart using the helm annotation "helm.sh/hook": crd-install, helm will not add the to the target manifest the resources that contain the hook. So, as part of the upgrade, the CRD definitions are deleted. As a side effect, all of the CRD instances are also deleted.
The log below shows this from tiller (in bold):
[tiller] 2018/09/21 15:52:20 executing 3 pre-upgrade hooks for security
[tiller] 2018/09/21 15:52:20 hooks complete for pre-upgrade security
[kube] 2018/09/21 15:52:20 building resources from updated manifest
[kube] 2018/09/21 15:52:20 checking 16 resources for changes
[kube] 2018/09/21 15:52:20 Looks like there are no changes for ServiceAccount "sealed-secrets"
…
[kube] 2018/09/21 15:52:20 Deleting "certificates.certmanager.k8s.io" in ...
[kube] 2018/09/21 15:52:20 Deleting "clusterissuers.certmanager.k8s.io" in ...
[kube] 2018/09/21 15:52:20 Deleting "issuers.certmanager.k8s.io" in ...
[tiller] 2018/09/21 15:52:20 executing 3 post-upgrade hooks for security
[tiller] 2018/09/21 15:52:20 hooks complete for post-upgrade security
[storage] 2018/09/21 15:52:20 updating release "security.v7"
[tiller] 2018/09/21 15:52:20 updating status for updated release for security
[storage] 2018/09/21 15:52:20 updating release "security.v8"
[storage] 2018/09/21 15:52:21 getting last revision of "security"
[storage] 2018/09/21 15:52:21 getting release history for "security"
I believe the issue is with the file release_server.go
helm/pkg/tiller/release_server.go
Line 333 in 8be42ba
| for _, m := range manifests { |
The hooks are not being added to the manifests, so they are not part of the comparison later on. The CRDs contain the hook annotation, so they are omitted.
I believe the correct behavior is to include the manifest that have the hooks in the comparison. So, the hooks would need to be included in the manifests as well.
Activity
mmerrill3 commentedon Sep 27, 2018
Hi, I believe it would suffice to add the CustomResouceDefinition to the target manifests when there is a crd-install hook annotated on the resource. This would handle the use case where helm charts are deployed before this hook was implemented.
At the very least, there should be documentation to indicate that this hook is destructive for existing CRD definitions that are deployed by helm. Let people decide how to handle this issue through internal migration processes.
bacongobbler commentedon Nov 29, 2018
Closed via #4709