Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPG-594 delete custom extensions from installed #967

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

nmarukovich
Copy link
Contributor

@nmarukovich nmarukovich commented Dec 2, 2024

K8SPG-594 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
We need to delete custom extensions not only from available but from installed too. If we deleted a custom extension from available extensions it doesn't work correctly so anyway we should delete it.

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
As solution, custom annotations with the list of installed custom extensions were added.
Under each reconciliation extension either added to annotations (if it's new one and were deleted in custom extensions in CR or if it was deleted from custom extensions we should delete in from DB and from annotations too )

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/extensions/uninstall.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Show resolved Hide resolved
@nmarukovich
Copy link
Contributor Author

nmarukovich commented Dec 12, 2024

We discussed it with @egegunes one more time and decided to move custom extensions list to status not to annotations.
Motivation:

  1. It's strange to add it to high level annotations since we use it for our inner check
  2. It's strange to add it to spec annotations since usually only users update the spec
  3. To add them in status is simplify their usage (we can store it in array, not string) and make it more visible and clear for user

cc @hors @inelpandzic

percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
percona/controller/pgcluster/controller.go Outdated Show resolved Hide resolved
@nmarukovich nmarukovich marked this pull request as ready for review December 18, 2024 17:26

if len(removedExtension) > 0 {

disabled := func(ctx context.Context, exec postgres.Executor) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disable would be a better name for this function

}

if len(removedExtension) > 0 {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary empty line

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"

"github.com/percona/percona-postgresql-operator/internal/logging"
"github.com/percona/percona-postgresql-operator/percona/clientcmd"
"github.com/percona/percona-postgresql-operator/percona/pgbackrest"
common "github.com/percona/percona-postgresql-operator/percona/postgres"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't like this common, why it was necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we need to use both "github.com/percona/percona-postgresql-operator/internal/postgres"
and "github.com/percona/percona-postgresql-operator/percona/postgres".
To keep both packages and avoid using variable, I can suggest to rename postgres package in percona directory to perconapostgres. What do you think?
@egegunes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, we generally use util rather than common, maybe you could have alias here like pgUtil or something like that. Or maybe even perconaPostgres (probably too long) or maybe perconaPG?

@JNKPercona
Copy link
Collaborator

Test name Status
custom-extensions passed
custom-tls passed
demand-backup passed
finalizers passed
init-deploy passed
monitoring passed
one-pod passed
operator-self-healing passed
pitr passed
scaling passed
scheduled-backup passed
self-healing passed
sidecars passed
start-from-backup passed
tablespaces passed
telemetry-transfer passed
upgrade-consistency passed
upgrade-minor passed
users passed
We run 19 out of 19

commit: 7128445
image: perconalab/percona-postgresql-operator:PR-967-712844513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants