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-571 grant user access to public schema #1097

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

nmarukovich
Copy link
Contributor

@nmarukovich nmarukovich commented Mar 21, 2025

K8SPG-571 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
By default, when user is created for a specific database, it only has access to a schema matching its username. However, in some cases, granting access to the public schema may also be necessary. To accommodate this need, the option to enable public schema access for users was added.

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

Solution:
Short explanation of the solution we are providing with this PR.

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?

Comment on lines 262 to 264
var err error
var stdout string
var stderr string
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did these variables need to be defined here? We can simply do stdout, stderr, err := exec..., right?

Comment on lines 173 to 174
for i := range users {
user := users[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use the way to iterate on elements of an array without using indexes:

for _, user := range users { ...

Comment on lines 65 to 66
// Grant a specific user access to the public schema in every database where they already have permissions.
// +optional
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend this comment with a pointer to the databases field to increase clarity:

// Grant the user access to the public schema in each database listed under `databases`.
// +optional


// Grant a specific user access to the public schema in every database where they already have permissions.
// +optional
GrantPublicSchemaAccess *bool `json:"grantPublicSchemaAccess,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

The name seems fine to me.

Copy link

@laudares laudares left a comment

Choose a reason for hiding this comment

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

Reviewed the changes with Natali, I'm happy with them.

@@ -19655,6 +19655,10 @@ spec:
type: string
type: array
x-kubernetes-list-type: set
grantPublicSchemaAccess:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@nmarukovich please confirm this name with our PM

Copy link

@PeterSzcz PeterSzcz left a comment

Choose a reason for hiding this comment

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

looks good to me, variable name make sense

@JNKPercona
Copy link
Collaborator

Test name Status
custom-extensions passed
custom-tls passed
demand-backup passed
finalizers passed
init-deploy passed
monitoring passed
monitoring-pmm3 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 20 out of 20

commit: 0819c1b
image: perconalab/percona-postgresql-operator:PR-1097-0819c1b46

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.

6 participants