canonical / microk8s-community-addons

The add-ons shipped with MicroK8s
Apache License 2.0
64 stars 69 forks source link

CloudNative-PG upgrade #239

Open maximemoreillon opened 1 month ago

maximemoreillon commented 1 month ago

Summary

I have enabled the CloudNative-PG addon which installed CNPG v1.22.0 in my K8s cluster. I woud now like to upgrade CNPG to v1.23.2. How should I proceed?

Running microk8s.enable cloudnative-pg 1.23.2 results in Addon community/cloudnative-pg is already enabled and microk8s.disable cloudnative-pg would delete my PostgreSQL clusters.

Why is this important?

Newer version of CNPG bring various improvements that users would benefit from.

Are you interested in contributing to this feature?

If it is within my abilities

maximemoreillon commented 1 month ago

Currently, I am considering two options:

Option 1 would be to manually upgrade CNPG as describe in the official documentation, using

kubectl apply --server-side -f \
  https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.23/releases/cnpg-1.23.2.yaml

However, doing so results in multiple errors like these:

Apply failed with 3 conflicts: conflicts with "kubectl-client-side-apply" using admissionregistration.k8s.io/v1:
- .webhooks[name="mbackup.cnpg.io"].rules
- .webhooks[name="mcluster.cnpg.io"].rules
- .webhooks[name="mscheduledbackup.cnpg.io"].rules
Please review the fields above--they currently have other managers. Here
are the ways you can resolve this warning:
* If you intend to manage all of these fields, please re-run the apply
  command with the `--force-conflicts` flag.
* If you do not intend to manage all of the fields, please edit your
  manifest to remove references to the fields that should keep their
  current managers.
* You may co-own fields by updating your manifest to match the existing
  value; in this case, you'll become the manager if the other manager(s)
  stop managing the field (remove it from their configuration).
See https://kubernetes.io/docs/reference/using-api/server-side-apply/#conflicts

Option 2 would be to delete kubectl-cnpg in /var/snap/microk8s/current/bin/, tricking the addon enable command into thinking the addon is not installed and run

microk8s.enable cloudnative-pg 1.23.2

Any opinions?