Skip to content

BB-6394 Allow immutable fields remain unchaged when upgrading

Supporting information

Ticket: https://tasks.opencraft.com/browse/BB-6394

Why

Original from ticket description

When we are increasing the helm chart version number and do a release, the release fails with the error below. Find the root cause and fix the issue. It is probably in the deployment resource of celerybeat in the libdjango's celerybeat helm template.

Root cause

  • Labels of deployment are required to be immutable after resource is created
  • appVersion and version are used for labels of deployment and selector
  • We change appVersion and Helm chart version every time we update a chart of Django application

What

  • Separate version related labels from common labels
  • Move version related labels from deployment and selector to template's labels, this allows us to filter pods with a specific chart version and app version

PoW

  • Environment: minikube in local machine

https://www.loom.com/share/f4c747bafb3f4781bf12d78212e38454

Testing instruction

  • Environment: Staging environment
  • Note: Should be executed by someone who has permission to operate Listaflow in Staging environemnt
  1. Switch to the feature branch in local environment
  2. Modify appVersion and listaflow_app_version (in Terraform) to test_0.0.1
  3. Update chart dependecy. When pushing (helm cm-push), declare a version to prevent pushing to stable version by adding --version test_0.0.1 parameter
  4. Uninstall current Listaflow helm chart on Kubernetes
  5. terraform apply
  6. Make sure Listaflow installed successfully in the cluster
  7. Update the appVersion in local environment
  8. Package and push Listaflow chart with version test_0.0.2
  9. Modify the version in Terraform
  10. terraform apply
  11. Expect the app to be upgraded successfully

References

https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates

Edited by Dat Nguyen

Merge request reports