Skip to main content
CYBERTEC-PG-Operator
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage Support

Updating the Operator

This chapter describes the recommended process for updating the CYBERTEC PostgreSQL Operator (CPO). To ensure a smooth transition and compatibility with new features, updates should be performed using our official Helm repository.

Important
CRD Update Requirement: Due to how Helm handles the crds/ directory, helm upgrade will not automatically update or patch existing Custom Resource Definitions (CRDs). You must manually apply the updated CRDs before upgrading the Helm release.

Using Helm-Chart

  1. Update the Helm Repository

First, ensure your local Helm chart cache is up to date with the latest versions from the CYBERTEC repository:

helm repo update cpo
  1. Update the Custom Resource Definitions (CRDs)

Before upgrading the Helm release, you must manually apply the latest CRDs from the CYBERTEC-operator-tutorials repository. This is a safety measure because Helm does not touch existing CRDs to prevent accidental data loss.

Apply the definitions for the Postgres clusters and the operator configuration directly from the source:

# Update the PostgreSQL Cluster CRD
kubectl apply -f https://raw.githubusercontent.com/cybertec-postgresql/CYBERTEC-operator-tutorials/refs/heads/main/setup/helm/operator/crds/postgresql.crd.yaml

# Update the Operator Configuration CRD
kubectl apply -f https://raw.githubusercontent.com/cybertec-postgresql/CYBERTEC-operator-tutorials/refs/heads/main/setup/helm/operator/crds/operatorconfiguration.crd.yaml
  1. Execute the Helm Upgrade

Once the CRDs are up to date, you can upgrade the operator deployment. This process replaces the operator pod with the new version and updates the necessary RBAC roles and service accounts.

# Upgrade the CPO release in the 'cpo' namespace
helm upgrade cpo cpo/cybertec-pg-operator \
  --namespace cpo \
  --reuse-values

Using CPO-Tutorial-Repository

  1. Clone or Update the Tutorial Repo
git clone https://github.com/$GITHUB_USER/CYBERTEC-operator-tutorials.git
cd CYBERTEC-operator-tutorials
  1. Patch CRDS
# Update the PostgreSQL Cluster CRD
kubectl apply -f setup/helm/operator/crds/postgresql.crd.yaml

# Update the Operator Configuration CRD
kubectl apply -f setup/helm/operator/crds/operatorconfiguration.crd.yaml
  1. Execute the Helm Upgrade
# Upgrade the CPO release in the 'cpo' namespace
helm upgrade cpo setup/helm/operator/. \
  --namespace cpo \
  --reuse-values

Verification

To ensure the update was successful, perform the following checks:

  1. Pod Status: Verify that the new operator pod is running.
kubectl get pods -n cpo -l app.kubernetes.io/name=cybertec-pg-operator
  1. Version Check: Check the logs to see the version string during startup.
kubectl logs -n cpo deployment/cybertec-pg-operator | grep "Starting operator"
  1. CRD Integrity: Ensure the new CRD fields are recognized by the Kubernetes API.
kubectl describe crd postgresqls.cpo.opensource.cybertec.at

Why manual CRD patching?

The CRDs are located in the helm/operator/crds/ folder. By design, Helm only installs these during the initial helm install. During an upgrade, Helm ignores this folder to protect the cluster from unintended schema changes. Therefore, manual application via kubectl apply is the standard and safest path for CPO updates.

Compatibility

Always ensure that your postgresql manifests are compatible with the new operator version by checking the Release Notes in the Documentation.