Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b24c089
feat: adding support for psql inherit
matthewgreenwaldagility Apr 24, 2026
fda1947
docs: updating docs for other contributors
matthewgreenwaldagility Apr 24, 2026
c1ea143
addressing comments and rebasing from master
matthewgreenwaldagility May 28, 2026
321f8fb
chore: bump docker/setup-buildx-action from 4.0.0 to 4.1.0 (#388)
dependabot[bot] Jun 1, 2026
6b2f021
chore: bump github/codeql-action from 4.35.4 to 4.36.0 (#387)
dependabot[bot] Jun 1, 2026
79f930e
chore: bump golangci/golangci-lint-action from 9.2.0 to 9.2.1 (#386)
dependabot[bot] Jun 1, 2026
7ce0411
chore: bump distroless/static in /cluster/images/provider-sql (#389)
dependabot[bot] Jun 1, 2026
3676bf3
chore: bump codecov/codecov-action from 6.0.0 to 6.0.1 (#385)
dependabot[bot] Jun 1, 2026
c94aa27
chore: bump docker/setup-qemu-action from 4.0.0 to 4.1.0 (#384)
dependabot[bot] Jun 1, 2026
f42e34d
chore: bump github.com/go-sql-driver/mysql from 1.9.3 to 1.10.0 (#383)
dependabot[bot] Jun 1, 2026
ba99215
Merge branch 'master' into feat/psql-inheritance
matthewgreenwaldagility Jun 4, 2026
90ce806
chore: bump codecov/codecov-action from 6.0.1 to 7.0.0
dependabot[bot] Jul 1, 2026
98c58bf
chore: bump github/codeql-action/analyze from 4.36.0 to 4.36.2
dependabot[bot] Jul 1, 2026
7a636db
chore: bump actions/checkout from 6.0.2 to 7.0.0
dependabot[bot] Jul 1, 2026
2fcc740
chore: bump actions/setup-go from 6.4.0 to 6.5.0
dependabot[bot] Jul 1, 2026
5c39e2e
Merge pull request #404 from crossplane-contrib/dependabot/github_act…
fernandezcuesta Jul 5, 2026
9116f1f
Merge pull request #403 from crossplane-contrib/dependabot/github_act…
fernandezcuesta Jul 5, 2026
dbebae5
Merge pull request #400 from crossplane-contrib/dependabot/github_act…
fernandezcuesta Jul 5, 2026
91fbbec
test: add PG<16 withInherit error path tests; revert build submodule
matthewgreenwaldagility Jul 8, 2026
c6dbd79
Merge branch 'master' into feat/psql-inheritance
matthewgreenwaldagility Jul 8, 2026
b0fd0da
Merge pull request #401 from crossplane-contrib/dependabot/github_act…
fernandezcuesta Jul 9, 2026
a30e415
Merge branch 'master' into feat/psql-inheritance
fernandezcuesta Jul 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true

- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
# We could run 'make lint' but we prefer this action because it leaves
# 'annotations' (i.e. it comments on PRs to point out linter violations).
- name: Lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.2.1
with:
version: ${{ env.GOLANGCI_VERSION }}

Expand All @@ -94,12 +94,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true

- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -144,15 +144,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true

- name: Fetch History
run: git fetch --prune --unshallow

- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
run: make -j2 test

- name: Publish Unit Test Coverage
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
use_oidc: true
flags: unittests
Expand All @@ -194,25 +194,25 @@ jobs:

steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with:
platforms: all

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true

- name: Fetch History
run: git fetch --prune --unshallow

- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -254,12 +254,12 @@ jobs:

steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with:
platforms: all

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}

Expand All @@ -272,15 +272,15 @@ jobs:
password: ${{ secrets.XPKG_TOKEN }}

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true

- name: Fetch History
run: git fetch --prune --unshallow

- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: ${{ env.GO_VERSION }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true

- name: Initialize CodeQL
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
with:
languages: go

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

- name: Create Tag
uses: negz/create-tag@39bae1e0932567a58c20dea5a1a0d18358503320 # v1
Expand Down
10 changes: 10 additions & 0 deletions apis/cluster/postgresql/v1alpha1/grant_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ type Routine struct {
}

// GrantParameters define the desired state of a PostgreSQL grant instance.
// +kubebuilder:validation:XValidation:rule="!has(self.withInherit) || has(self.memberOf) || has(self.memberOfRef) || has(self.memberOfSelector)",message="withInherit may only be set on memberOf grants"
type GrantParameters struct {
// Privileges to be granted.
// See https://www.postgresql.org/docs/current/sql-grant.html for available privileges.
Expand Down Expand Up @@ -406,6 +407,15 @@ type GrantParameters struct {
// +optional
// +kubebuilder:validation:items:Pattern:=^[a-zA-Z_][a-zA-Z0-9_$]*$
ForeignServers []string `json:"foreignServers,omitempty"`

// WithInherit controls whether the grantee automatically inherits the privileges
// of the granted role. When set to false, emits WITH INHERIT FALSE (PostgreSQL 16+),
// granting membership without automatic privilege inheritance. Only valid when
// memberOf is set. When omitted, PostgreSQL's default behavior (inherit true) applies.
// Note: this field is only evaluated when non-nil. Removing it from the manifest
// does NOT revert the database-side setting; set withInherit: true explicitly to revert.
// +optional
WithInherit *bool `json:"withInherit,omitempty"`
}

// A GrantStatus represents the observed state of a Grant.
Expand Down
5 changes: 5 additions & 0 deletions apis/cluster/postgresql/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions apis/namespaced/postgresql/v1alpha1/grant_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ type Routine struct {
}

// GrantParameters define the desired state of a PostgreSQL grant instance.
// +kubebuilder:validation:XValidation:rule="!has(self.withInherit) || has(self.memberOf) || has(self.memberOfRef) || has(self.memberOfSelector)",message="withInherit may only be set on memberOf grants"
type GrantParameters struct {
// Privileges to be granted.
// See https://www.postgresql.org/docs/current/sql-grant.html for available privileges.
Expand Down Expand Up @@ -408,6 +409,15 @@ type GrantParameters struct {
// +optional
// +kubebuilder:validation:items:Pattern:=^[a-zA-Z_][a-zA-Z0-9_$]*$
ForeignServers []string `json:"foreignServers,omitempty"`

// WithInherit controls whether the grantee automatically inherits the privileges
// of the granted role. When set to false, emits WITH INHERIT FALSE (PostgreSQL 16+),
// granting membership without automatic privilege inheritance. Only valid when
// memberOf is set. When omitted, PostgreSQL's default behavior (inherit true) applies.
// Note: this field is only evaluated when non-nil. Removing it from the manifest
// does NOT revert the database-side setting; set withInherit: true explicitly to revert.
// +optional
WithInherit *bool `json:"withInherit,omitempty"`
}

// A GrantStatus represents the observed state of a Grant.
Expand Down
5 changes: 5 additions & 0 deletions apis/namespaced/postgresql/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cluster/images/provider-sql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gcr.io/distroless/static:nonroot@sha256:e3f945647ffb95b5839c07038d64f9811adf17308b9121d8a2b87b6a22a80a39
FROM gcr.io/distroless/static:nonroot@sha256:963fa6c544fe5ce420f1f54fb88b6fb01479f054c8056d0f74cc2c6000df5240

ARG TARGETOS
ARG TARGETARCH
Expand Down
25 changes: 25 additions & 0 deletions examples/cluster/postgresql/grant-with-inherit-false.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Demonstrates WITH INHERIT FALSE on a role membership grant (PostgreSQL 16+).
#
# Use case: RDS IAM database authentication with a shared admin role.
#
# 1. An "admin" role holds rds_iam membership so that migration tools
# (Flyway, Liquibase, Atlas) can authenticate via IAM tokens.
# 2. The RDS master user needs membership in "admin" in order to run
# ALTER DEFAULT PRIVILEGES FOR ROLE admin — but must NOT inherit
# the rds_iam privilege, which would break its password authentication.
#
# GRANT admin TO master_user WITH INHERIT FALSE satisfies both requirements:
# the master user can SET ROLE admin (for ALTER DEFAULT PRIVILEGES) while
# retaining its own password-based login.
---
apiVersion: postgresql.sql.crossplane.io/v1alpha1
kind: Grant
metadata:
name: grant-master-user-membership-no-inherit
spec:
forProvider:
withInherit: false
roleRef:
name: master-user
memberOfRef:
name: admin-role
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/crossplane/crossplane-runtime/v2 v2.2.1
github.com/crossplane/crossplane-tools v0.0.0-20250731192036-00d407d8b7ec
github.com/crossplane/upjet/v2 v2.2.0
github.com/go-sql-driver/mysql v1.9.3
github.com/go-sql-driver/mysql v1.10.0
github.com/google/go-cmp v0.7.0
github.com/lib/pq v1.12.3
github.com/microsoft/go-mssqldb v1.10.0
Expand All @@ -22,7 +22,7 @@ require (

require (
dario.cat/mergo v1.0.2 // indirect
filippo.io/edwards25519 v1.1.1 // indirect
filippo.io/edwards25519 v1.2.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
github.com/antchfx/htmlquery v1.2.4 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4=
cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
filippo.io/edwards25519 v1.1.1 h1:YpjwWWlNmGIDyXOn8zLzqiD+9TyIlPhGFG96P39uBpw=
filippo.io/edwards25519 v1.1.1/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 h1:jHb/wfvRikGdxMXYV3QG/SzUOPYN9KEUUuC0Yd0/vC0=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1/go.mod h1:pzBXCYn05zvYIrwLgtK8Ap8QcjRg+0i76tMQdWN6wOk=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4=
Expand Down Expand Up @@ -115,8 +115,8 @@ github.com/go-openapi/testify/enable/yaml/v2 v2.0.2 h1:0+Y41Pz1NkbTHz8NngxTuAXxE
github.com/go-openapi/testify/enable/yaml/v2 v2.0.2/go.mod h1:kme83333GCtJQHXQ8UKX3IBZu6z8T5Dvy5+CW3NLUUg=
github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw=
github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
Expand Down
13 changes: 13 additions & 0 deletions package/crds/postgresql.sql.crossplane.io_grants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,15 @@ spec:
pattern: ^[a-zA-Z_][a-zA-Z0-9_$]*$
type: string
type: array
withInherit:
description: |-
WithInherit controls whether the grantee automatically inherits the privileges
of the granted role. When set to false, emits WITH INHERIT FALSE (PostgreSQL 16+),
granting membership without automatic privilege inheritance. Only valid when
memberOf is set. When omitted, PostgreSQL's default behavior (inherit true) applies.
Note: this field is only evaluated when non-nil. Removing it from the manifest
does NOT revert the database-side setting; set withInherit: true explicitly to revert.
type: boolean
withOption:
description: |-
WithOption allows an option to be set on the grant.
Expand All @@ -472,6 +481,10 @@ spec:
- GRANT
type: string
type: object
x-kubernetes-validations:
- message: withInherit may only be set on memberOf grants
rule: '!has(self.withInherit) || has(self.memberOf) || has(self.memberOfRef)
|| has(self.memberOfSelector)'
managementPolicies:
default:
- '*'
Expand Down
13 changes: 13 additions & 0 deletions package/crds/postgresql.sql.m.crossplane.io_grants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,15 @@ spec:
pattern: ^[a-zA-Z_][a-zA-Z0-9_$]*$
type: string
type: array
withInherit:
description: |-
WithInherit controls whether the grantee automatically inherits the privileges
of the granted role. When set to false, emits WITH INHERIT FALSE (PostgreSQL 16+),
granting membership without automatic privilege inheritance. Only valid when
memberOf is set. When omitted, PostgreSQL's default behavior (inherit true) applies.
Note: this field is only evaluated when non-nil. Removing it from the manifest
does NOT revert the database-side setting; set withInherit: true explicitly to revert.
type: boolean
withOption:
description: |-
WithOption allows an option to be set on the grant.
Expand All @@ -482,6 +491,10 @@ spec:
- GRANT
type: string
type: object
x-kubernetes-validations:
- message: withInherit may only be set on memberOf grants
rule: '!has(self.withInherit) || has(self.memberOf) || has(self.memberOfRef)
|| has(self.memberOfSelector)'
managementPolicies:
default:
- '*'
Expand Down
Loading