Open zhekazuev opened 2 weeks ago
Hello @zhekazuev
Crossplane already supports this functionality. A resources name can be set using the crossplane.io/external-name
annotation.
For example:
apiVersion: postgresql.sql.crossplane.io/v1alpha1
kind: Role
metadata:
name: example-role-k8s # Kubernetes resource name
annotations:
crossplane.io/external-name: custom_name
spec:
More details here: https://docs.crossplane.io/latest/concepts/managed-resources/#naming-external-resources
Hello @zhekazuev
Crossplane already supports this functionality. A resources name can be set using the
crossplane.io/external-name
annotation.For example:
apiVersion: postgresql.sql.crossplane.io/v1alpha1 kind: Role metadata: name: example-role-k8s # Kubernetes resource name annotations: crossplane.io/external-name: custom_name spec:
More details here: https://docs.crossplane.io/latest/concepts/managed-resources/#naming-external-resources
Hello @Ben10k ,
Thanks for the reply, I thought this functionality needs for Claim/Composition resources naming. I will check and close issue on the next week.
What problem are you facing?
Currently, the
provider-sql
uses the name of the Kubernetes manifest(resource) as the name of the database resource(Role, Database, etc.).This approach introduces several limitations:
_
) or other characters restricted by Kubernetes naming conventions, but it should be possible because Postgres Naming Conventions.To resolve these issues, I propose introducing a separate field within the spec of the Provider Resources to explicitly define the database resource name, as it works in the next providers:
provider-kubernetes
:provider-keycloak
:provider-openstack
:provider-confluent
:provider-postgresql
by Tages:This will decouple the Kubernetes resource name from the database resource name, allowing greater flexibility and avoiding naming conflicts.
Example with PostgreSQL Role after that changes:
Benefits:
Roles
with similar names across different database instances. This is particularly beneficial for scenarios where Crossplane Compositions are used for multi-tenant setups, allowing users to define external resource names directly in the Composition with end-user own naming conventions.Implementing this change will enhance the usability and flexibility of the provider-sql for various RDBMS types within Crossplane, ensuring it meets user needs more effectively while maintaining compatibility with existing deployments.
How could Crossplane help solve your problem?
Modify the CRD (CustomResourceDefinition):
Update the Controller Logic:
ref
fields(DatabaseRef, MemberOfRef, etc.)Tests: