mastodon / chart

Helm chart for Mastodon deployment in Kubernetes
GNU Affero General Public License v3.0
152 stars 90 forks source link

Duplicate annotation in deployment-sidekiq #48

Open Azuki-bar opened 1 year ago

Azuki-bar commented 1 year ago

I tried to deploy using helm and could not, so I identified the cause. The cause was a duplicate annotation key.

deployment-sidekiq.yaml file has duplicate annotation key checksum/config-secrets. k8s requires a unique annotation key, so installing mastodon chart failed.

I will show you how to reproduce it in the next section. I tried with 3934da1d2185b5526798e7dd946a4ded5a0b2c4e.

reproduct

$ helm dependency update
$ helm template . \
  --values dev-values.yaml \
  --output-dir rendered-templates
$ cat rendered-templates/mastodon/templates/deployment-sidekiq.yaml
...
annotations:
  # roll the pods to pick up any db migrations or other changes

  rollme: "1"
  checksum/config-secrets: "c988861c081539520cbb260007ba5b9292a189a02254ba616eb4e67445f210d0"
  checksum/config-configmap: "8ed3ba7c668487c141b93a946bfdb2b3caebf3f8ae5efccbe922cbedc711fa6d"
  checksum/config-secrets: "58c287f58852f11e58b06dbea32d36751824156324743461f864565d9ebbb969"
...
# -> the annotation `checksum/config-secrets` in L31, L33 were duplicated.

I think #38 may be a hint.

iavael commented 1 year ago

@renchap please look at this problem, helm chart is broken now, fix is trivial and couple of PRs are already here. Looks like an easy hanging fruit.

iavael commented 1 year ago

Short summary for context of this problem: while helm ignores duplicate annotations kustomize (that can deploy helm charts too) doesn't https://github.com/kubernetes-sigs/kustomize/issues/3480 because of limitation in go-yaml https://github.com/go-yaml/yaml/issues/751 And kustomize is used by gitops tool fluxcd https://github.com/fluxcd/flux2/issues/1522 https://github.com/fluxcd/helm-controller/issues/286 https://github.com/fluxcd/helm-controller/issues/283

The easiest fis is to remove duplicate keys from rendered resources