crossplane-contrib / crossplane-contrib/provider-sql

Role provider should examine state of ConnectionLimit before applying

Open
#194 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
154
Forks
119
Avg merge
6d 17h
Merged PRs (30d)
8

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.