Skip to content

fix(psql): isolate controller RBAC - #82

Merged
HaoyL666 merged 2 commits into
oracle:mainfrom
HaoyL666:fix/oke-44458-psql-rbac
Jul 31, 2026
Merged

fix(psql): isolate controller RBAC#82
HaoyL666 merged 2 commits into
oracle:mainfrom
HaoyL666:fix/oke-44458-psql-rbac

Conversation

@HaoyL666

Copy link
Copy Markdown
Member

solve: https://jira.oci.oraclecorp.com/browse/OKE-44458

Summary

Moves the PostgreSQL controller off the shared default ServiceAccount and reduces its Secret access to least privilege.

Changes

  • Generate a dedicated PSQL manager ServiceAccount.
  • Bind the PSQL manager and leader-election roles to that account.
  • Remove the PSQL package’s shared/default-ServiceAccount bindings.
  • Reduce PSQL Secret RBAC from get,list,watch to get.
  • Read credential Secrets through mgr.GetAPIReader() rather than the controller-runtime cache, avoiding the Secret informer
    requirement for list and watch.
  • Preserve existing resource ordering for non-dedicated generated packages.
  • Add regression coverage proving credential reads bypass the cached client.

Validation

  • go test ./pkg/manager ./internal/generator/...
  • go build ./...
  • go vet ./...
  • Rendered PSQL package verification:
    • dedicated ServiceAccount is used
    • no binding to default
    • Secrets permission is get only
  • Live OKE test using the pushed PSQL image:
    • image ran with the dedicated ServiceAccount
    • instance-principal authentication succeeded
    • get secrets allowed; list/watch secrets denied
    • Secret-backed DbSystem reconciliation performed a named Secret GET and returned expected NotFound, not RBAC Forbidden

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 21, 2026
@HaoyL666
HaoyL666 requested a review from veera-adithya-d July 21, 2026 17:49
@HaoyL666
HaoyL666 merged commit b4b4e86 into oracle:main Jul 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants