Note
APIs are currently in v1alpha1
, which implies that non backward compatible changes might happen. See Kubernetes API versioning for more detail.
This guide illustrates, step by step, how to migrate to v0.0.20
from previous versions, as some breaking changes have been introduced. See:
It's important to note that this migration process only applies if:
- You have created a
MariaDB
resource using amariadb-operator
version <v0.0.20
and you are upgrading to >=v0.0.20
. - Your
MariaDB
resource hasspec.replication
enabled.
If that's your case follow these steps for upgrading:
- Uninstall you current
mariadb-operator
for preventing conflicts:
helm uninstall mariadb-operator
Alternatively, you may only downscale and delete the webhook configurations:
kubectl scale deployment mariadb-operator -n default --replicas=0
kubectl scale deployment mariadb-operator-webhook -n default --replicas=0
kubectl delete validatingwebhookconfiguration mariadb-operator-webhook
kubectl delete mutatingwebhookconfiguration mariadb-operator-webhook
- In case you are manually applying manifests, get a copy of your
MariaDB
resources, as the CRD upgrade will wipe out fields that are no longer supported:
kubectl get mariadb mariadb-repl -n default -o yaml > mariadb-repl.yaml
- Upgrade CRDs to
v0.0.20
:
Important
Helm does not handle CRD upgrades. See helm docs.
Warning
This step will delete fields that are no longer supported in your resources.
kubectl replace -f https://github.com/mariadb-operator/mariadb-operator/releases/download/helm-chart-0.20.0/crds.yaml
-
Perform migrations in your
MariaDB
resouces:- Set
spec.replication.enabled = true
. - If you had previously set
spec.replication.primary.service
, move it tospec.primaryService
. - Rename your resources to point to the new
<mariadb-name>-primary
Service
instead ofprimary-<mariadb-name>
. - If you had previously set
spec.replication.primary.connection
, move it tospec.primaryConnection
. - Rename your resources to point to the new
<mariadb-name>-primary
Connection
instead ofprimary-<mariadb-name>
.
- Set
-
Upgrade
mariadb-operator
tov0.0.20
:
helm repo update mariadb-operator
helm upgrade --install mariadb-operator mariadb-operator/mariadb-operator --version 0.20.0
- If you previously decided to downscale the operator, make sure you upscale it back:
kubectl scale deployment mariadb-operator -n default --replicas=1
kubectl scale deployment mariadb-operator-webhook -n default --replicas=1