crossplane-contrib / provider-sql

An SQL provider for @crossplane
https://crossplane.io
Apache License 2.0
104 stars 59 forks source link

Templating Capabilities for Connection Strings #142

Closed ahaw023 closed 1 year ago

ahaw023 commented 1 year ago

What problem are you facing?

Our services separate read and write models in line with Domain Driven Design

We currently pass in a READ_DSN and a WRITE_DSN from a secret as environment variables

We are looking for a way to mimic the templating behavior of this operator: https://github.com/kloeckner-i/db-operator

For example:

    READ_DSN: {{` user={{ .UserName }} password={{ .Password }} host={{ .DatabaseHost }} port={{ .DatabasePort}} dbname={{ .DatabaseName }} sslmode=require `}}
    WRITE_DSN: {{` user={{ .UserName }} password={{ .Password }} host={{ .DatabaseHost }} port={{ .DatabasePort}} dbname={{ .DatabaseName }} sslmode=require `}

How could Crossplane help solve your problem?

We are not sure if this is something we can do with composite resources XRs or if it's a new capability that we would need to add to the provider

In order to use the provider we would have to rewrite the code and also there is a concern that if we create two ROLE crds then when we got to use them as secrets we could get a key clash

ahaw023 commented 1 year ago

We have solved this via the external-secrets operator https://external-secrets.io/v0.8.3/guides/templating/