fix: add missing ownerRef+ownerSelector field#377
Open
fernandezcuesta wants to merge 3 commits into
Open
Conversation
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds Crossplane reference & selector support for the PostgreSQL Database owner role, allowing spec.forProvider.owner to be resolved via ownerRef / ownerSelector rather than requiring a literal role name.
Changes:
- Add
ownerRefandownerSelectorfields to theDatabaseAPI (cluster + namespaced) and generate reference resolvers/deepcopy updates. - Update CRDs and examples to demonstrate selecting the owner Role via labels.
- Add an integration test assertion that validates the resolved database owner in PostgreSQL.
Reviewed changes
Copilot reviewed 9 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| package/crds/postgresql.sql.m.crossplane.io_databases.yaml | Adds ownerRef / ownerSelector schema for namespaced Database CRD. |
| package/crds/postgresql.sql.crossplane.io_databases.yaml | Adds ownerRef / ownerSelector schema for cluster-scoped Database CRD. |
| apis/namespaced/postgresql/v1alpha1/database_types.go | Introduces OwnerRef / OwnerSelector fields for namespaced Database parameters. |
| apis/namespaced/postgresql/v1alpha1/zz_generated.resolvers.go | Adds reference resolution for spec.forProvider.owner. |
| apis/namespaced/postgresql/v1alpha1/zz_generated.deepcopy.go | Deep-copies the new reference/selector fields. |
| apis/cluster/postgresql/v1alpha1/database_types.go | Introduces OwnerRef / OwnerSelector fields for cluster Database parameters. |
| apis/cluster/postgresql/v1alpha1/zz_generated.resolvers.go | Adds reference resolution for spec.forProvider.owner. |
| apis/cluster/postgresql/v1alpha1/zz_generated.deepcopy.go | Deep-copies the new reference/selector fields. |
| examples/namespaced/postgresql/role.yaml | Adds labels used by ownerSelector. |
| examples/namespaced/postgresql/database.yaml | Adds an example Database using ownerSelector. |
| examples/cluster/postgresql/role.yaml | Adds labels used by ownerSelector. |
| examples/cluster/postgresql/database.yaml | Adds an example Database using ownerSelector. |
| cluster/local/postgresdb_functions.sh | Adds an integration test check for the resolved database owner. |
Files not reviewed (4)
- apis/cluster/postgresql/v1alpha1/zz_generated.deepcopy.go: Language not supported
- apis/cluster/postgresql/v1alpha1/zz_generated.resolvers.go: Language not supported
- apis/namespaced/postgresql/v1alpha1/zz_generated.deepcopy.go: Language not supported
- apis/namespaced/postgresql/v1alpha1/zz_generated.resolvers.go: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+48
to
+49
| // +immutable | ||
| // +optional |
Comment on lines
+53
to
+54
| // +immutable | ||
| // +optional |
Comment on lines
+47
to
+48
| // +immutable | ||
| // +optional |
Comment on lines
+52
to
+53
| // +immutable | ||
| // +optional |
| } | ||
|
|
||
| check_database_owner_ref() { | ||
| echo_step "check if database created with ownerRef has correct owner" |
| owner=$(echo "${owner}" | xargs) | ||
|
|
||
| if [ "${owner}" = "ownerrole" ]; then | ||
| echo_info "ownerRef resolved correctly: owner=${owner}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
Implements ownerRef+ownerSelector for PG Database resource.
Fixes #372
I have:
How has this code been tested
Added an integration test with ownerSelector matching labels for the owner.