Skip to content

Add OCI (Oracle Cloud Infrastructure) cloud provider support#326

Open
cvilodub wants to merge 1 commit into
movetokube:masterfrom
cvilodub:oci-support
Open

Add OCI (Oracle Cloud Infrastructure) cloud provider support#326
cvilodub wants to merge 1 commit into
movetokube:masterfrom
cvilodub:oci-support

Conversation

@cvilodub

Copy link
Copy Markdown

Summary

Oracle Cloud Infrastructure (OCI) managed PostgreSQL, like AWS RDS and GCP
AlloyDB, does not grant the admin user full superuser privileges. This means
certain operations require the admin user to belong to the target
role(s) before they can succeed. Without a dedicated provider wrapper,
CreateDB and DropRole fail against OCI PostgreSQL.

This PR adds an OCI provider wrapper that mirrors the workarounds already in
place for AWS and GCP:

  • CreateDB: grants the admin user membership in the target role before
    calling ALTER DATABASE ... OWNER TO, then delegates to the base
    implementation.
  • DropRole: grants the admin user membership in both the role being
    dropped and the new owner role (required for REASSIGN OWNED BY), with
    appropriate handling for the "already a member" (0LP01) and "role does not
    exist" (42704) error codes. The new-owner grant is revoked via defer
    after the drop completes.

Changes

  • pkg/config/config.go: add CloudProviderOCI constant and "oci" case in
    ParseCloudProvider.
  • pkg/postgres/oci.go: new file implementing the ocipg wrapper with
    CreateDB and DropRole overrides.
  • pkg/postgres/postgres.go: wire CloudProviderOCI into the NewPG factory.

Testing

Tested against an OCI PostgreSQL instance with the operator configured with
cloudProvider: OCI. Database and role lifecycle operations all complete successfully.

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.

1 participant