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

Role provider should examine state of ConnectionLimit before applying #194

Open
ajcaldera1 opened this issue Sep 25, 2024 · 0 comments · May be fixed by #197
Open

Role provider should examine state of ConnectionLimit before applying #194

ajcaldera1 opened this issue Sep 25, 2024 · 0 comments · May be fixed by #197
Labels
enhancement New feature or request

Comments

@ajcaldera1
Copy link

What problem are you facing?

When a provider config contains a directive to set ConnectionLimit, it blindly applies the setting without checking the observed state as it does for Privileges and ConfigurationParameters. This is causing additional traffic to the catalog that is unhelpful in a distributed environment.

How could Crossplane help solve your problem?

In provider-sql/pkg/controller/postgresql/role/reconciler.go:

        cl := cr.Spec.ForProvider.ConnectionLimit
        if cl != nil && cr.Status.AtProvider.ConnectionLimit != cr.Spec.ForProvider.ConnectionLimit  { 
                if err := c.db.Exec(ctx, xsql.Query{
                        String: fmt.Sprintf("ALTER ROLE %s CONNECTION LIMIT %d", crn, int64(*cl)),
                }); err != nil {
                        return managed.ExternalUpdate{}, errors.Wrap(err, errUpdateRole)
                }
        }
@ajcaldera1 ajcaldera1 added the enhancement New feature or request label Sep 25, 2024
@ajcaldera1 ajcaldera1 linked a pull request Oct 15, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant