I am building a cicd for kubernetes(EKS) with Helm in AWS. In general, what I do is, package the helm chart as template, and then, deploy with upgrade using that package plus some variables.
My issue come when deploying an already deployed chart, if I change the nameOverride value in the values.yml(identified as ${CODEBUILD_SRC_DIR_appsource}/${HELM_PROJECT_VALUES_PATH}/${ENV}/${HELM_VALUES_FILE_NAME}) which should just increase the revision and change the names of k8s resources, but instead its throwing the following error:
[Container] 2022/09/13 12:19:28 Running command helm upgrade ${APP_NAME} *.tgz --install -n ${NAMESPACE} \
-f ${CODEBUILD_SRC_DIR_appsource}/${HELM_PROJECT_VALUES_PATH}/${ENV}/${HELM_VALUES_FILE_NAME} \
-f output.yaml --set-string env=${ENV},image.tag=${APP_VERSION} --timeout 10m0s --debug
history.go:56: [debug] getting history for release eks-test-app-dev
upgrade.go:142: [debug] preparing upgrade for eks-test-app-dev
upgrade.go:150: [debug] performing update for eks-test-app-dev
upgrade.go:322: [debug] creating upgraded release for eks-test-app-dev
Error: UPGRADE FAILED: secrets "sh.helm.release.v1.eks-test-app-dev.v8" is forbidden: User "build" cannot delete resource "secrets" in API group "" in the namespace "dev"
helm.go:84: [debug] secrets "sh.helm.release.v1.eks-test-app-dev.v8" is forbidden: User "build" cannot delete resource "secrets" in API group "" in the namespace "dev"
UPGRADE FAILED
main.newUpgradeCmd.func2
helm.sh/helm/v3/cmd/helm/upgrade.go:199
github.com/spf13/cobra.(*Command).execute
github.com/spf13/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/cobra@v1.3.0/command.go:902
main.main
helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
runtime/proc.go:255
runtime.goexit
runtime/asm_amd64.s:1581
That secret is not something I generated, seems to be a secret automatically generated from Helm.
The worst part is that, running the same exact command from my computer works as expected.
Some extra info:
- Helm version: version.BuildInfo{Version:"v3.8.1", GitCommit:"5cb9af4b1b271d11d7a97a71df3ac337dd94ad37", GitTreeState:"clean", GoVersion:"go1.17.5"}
- Running before the upgrade command on the cicd: helm history ${APP_NAME} -n ${NAMESPACE}
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
8 Tue Sep 13 12:20:19 2022 superseded app-0.0.1 Upgrade complete
9 Tue Sep 13 12:22:12 2022 superseded app-0.0.1 Upgrade complete
10 Tue Sep 13 12:22:36 2022 superseded app-0.0.1 Upgrade complete
11 Tue Sep 13 12:23:42 2022 superseded app-0.0.1 Upgrade complete
12 Tue Sep 13 12:54:22 2022 superseded app-0.0.1 Upgrade complete
13 Tue Sep 13 12:56:31 2022 superseded app-0.0.1 Upgrade complete
14 Tue Sep 13 13:08:54 2022 superseded app-0.0.1 Upgrade complete
15 Tue Sep 13 13:19:00 2022 superseded app-0.0.1 Upgrade complete
16 Tue Sep 13 14:15:24 2022 superseded app-0.0.1 Upgrade complete
17 Tue Sep 13 14:17:05 2022 deployed app-0.0.1 Upgrade complete
For me it seems that upgrade somehow its failing to synchronise with all the previous revisions. But I´m totally at lost. Any hint on which is the issue?