Skip to content

Role provider should examine state of ConnectionLimit before applying  #194

@ajcaldera1

Description

@ajcaldera1

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)
                }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions