Conversation
| python3 -m yq -r \ | ||
| .spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.customTLSSecret.properties.name.description \ | ||
| "${clusters_dir}/generated/postgres-operator.crunchydata.com_postgresclusters.yaml" | ||
| "${clusters_dir}/generated/upstream.pgv2.percona.com_postgresclusters.yaml" |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| python3 -m yq -r \ | |
| .spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.customTLSSecret.properties.name.description \ | |
| "${clusters_dir}/generated/postgres-operator.crunchydata.com_postgresclusters.yaml" | |
| "${clusters_dir}/generated/upstream.pgv2.percona.com_postgresclusters.yaml" | |
| python3 -m yq -r \ | |
| .spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.customTLSSecret.properties.name.description \ | |
| "${clusters_dir}/generated/upstream.pgv2.percona.com_postgresclusters.yaml" |
| "${clusters_dir}/generated/postgres-operator.crunchydata.com_postgresclusters.yaml" | ||
| "${clusters_dir}/generated/upstream.pgv2.percona.com_postgresclusters.yaml" | ||
| ) | ||
| name_desc_without_todo=$(sed 's/ TODO.*//g' <<< "${name_desc_with_todo}") |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| name_desc_without_todo=$(sed 's/ TODO.*//g' <<< "${name_desc_with_todo}") | |
| name_desc_without_todo=$(sed 's/ TODO.*//g' <<<"${name_desc_with_todo}") |
| [{ op: "remove", path: "/work" }] | ||
| ' \ | ||
| "${clusters_dir}/generated/postgres-operator.crunchydata.com_postgresclusters.yaml" > "${clusters_dir}/todos.yaml" | ||
| "${clusters_dir}/generated/upstream.pgv2.percona.com_postgresclusters.yaml" > "${clusters_dir}/todos.yaml" |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| "${clusters_dir}/generated/upstream.pgv2.percona.com_postgresclusters.yaml" > "${clusters_dir}/todos.yaml" | |
| "${clusters_dir}/generated/upstream.pgv2.percona.com_postgresclusters.yaml" >"${clusters_dir}/todos.yaml" |
| [{ op: "remove", path: "/work" }] | ||
| ' \ | ||
| "${upgrades_dir}/generated/postgres-operator.crunchydata.com_pgupgrades.yaml" > "${upgrades_dir}/todos.yaml" | ||
| "${upgrades_dir}/generated/upstream.pgv2.percona.com_pgupgrades.yaml" > "${upgrades_dir}/todos.yaml" |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| "${upgrades_dir}/generated/upstream.pgv2.percona.com_pgupgrades.yaml" > "${upgrades_dir}/todos.yaml" | |
| "${upgrades_dir}/generated/upstream.pgv2.percona.com_pgupgrades.yaml" >"${upgrades_dir}/todos.yaml" |
| @@ -17,7 +17,7 @@ import ( | |||
|
|
|||
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| "sigs.k8s.io/controller-runtime/pkg/client" | |
| @@ -18,7 +18,7 @@ import ( | |||
|
|
|||
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| corev1 "k8s.io/api/core/v1" | |
| "github.com/pkg/errors" | ||
|
|
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| "github.com/pkg/errors" |
| @@ -0,0 +1,36 @@ | |||
| apiVersion: kustomize.config.k8s.io/v1beta1 | |||
| return reconcile.Result{}, errors.Wrap(err, "get new PostgresCluster") | ||
| } | ||
|
|
||
| if legacy.GetDeletionTimestamp().IsZero() { |
There was a problem hiding this comment.
Wondering if this logic can have issues in case something like argocd/etc deletes legacy objects, marking them with deletion timestamp and for edge cases not triggering the logic here. Maybe we can add the finalizers early?
There was a problem hiding this comment.
hmm not sure if i follow, adding the finalizer is literally the first thing we do
|
We also have a lot of linting suggestions from golangci-lint, we should resolve these as well. |
| return nil | ||
| } | ||
| patch := client.MergeFrom(legacy.DeepCopy()) | ||
| legacy.SetFinalizers(nil) |
There was a problem hiding this comment.
Why are we removing all the finalizers and not only the one we added with this logic?
@gkech they are all existing issues surfaced because I touched every single file from upstream. I don't want to fix them :/ |
| import ( | ||
| "context" | ||
|
|
||
| apierrors "k8s.io/apimachinery/pkg/api/errors" |
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| apierrors "k8s.io/apimachinery/pkg/api/errors" | |
| "github.com/pkg/errors" | |
| apierrors "k8s.io/apimachinery/pkg/api/errors" |
| "github.com/percona/percona-postgresql-operator/v2/internal/naming" | ||
| v2 "github.com/percona/percona-postgresql-operator/v2/pkg/apis/pgv2.percona.com/v2" | ||
| "github.com/percona/percona-postgresql-operator/v2/pkg/apis/upstream.pgv2.percona.com/v1beta1" | ||
| "github.com/pkg/errors" |
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| "github.com/pkg/errors" |
| ObservedGeneration: cr.GetGeneration(), | ||
| }) | ||
| if err != nil { | ||
| return errors.Wrap(err, "set status condition to false") |
There was a problem hiding this comment.
| return errors.Wrap(err, "set status condition to false") | |
| return errors.Wrap(err, "set status condition to true") |
| legacy.SetGroupVersionKind(LegacyGVK) | ||
|
|
||
| if err := r.Client.Get(ctx, types.NamespacedName{Name: cr.Name, Namespace: cr.Namespace}, legacy); err != nil { | ||
| return client.IgnoreNotFound(err) |
There was a problem hiding this comment.
How would this condition work for new clusters when legacy CRD is installed? IIUC, any new PerconaPGCluster will not be created with legacy PostgresCluster object. So according to this logic, it will do an early return here and the new PerconaPGCluster will be stuck with condition APIGroupMigration == False
It won't affect anything, but there will be a misleading condition
commit: f0daa58 |
CHANGE DESCRIPTION
Problem:
Re-using upstream CRDs makes it hard to deploy operator in a cluster where upstream operator is already running. This makes it hard to deploy our operator and ensure existing upstream clusters are not affected.
Solution:
upstream.pgv2.percona.comThe operator previously owned
PostgresClusterunder the grouppostgres-operator.crunchydata.com/v1beta1, and has been renamed toupstream.pgv2.percona.com/v1beta1. Existing running clusters have child objects (StatefulSets, Secrets, PVCs, etc.) whoseownerReferencesstill point at the old-group parent. PostgresCluster (upstream) controller re-parents those children to the new-group parent and then removes the old parent — without triggering restarts or deletes of the children.PerconaPGCluster controller iterates through children of PostgresCluster and checks if owner references are updated. This is done only to inform user about the migration state and provide a better experience.
While the migration is in progress, there will be a status condition in PerconaPGCluster object:
After migration is completed, condition status will be True and check won't run again:
Operator logs all children objects it checks on Info level. Logger name is APIGroupMigration, you can grep this string to see all operations.
Known limitations
Test cases
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability