Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poosibility to define target secret of credentials #23

Open
Schnitzel opened this issue Sep 23, 2020 · 1 comment
Open

poosibility to define target secret of credentials #23

Schnitzel opened this issue Sep 23, 2020 · 1 comment

Comments

@Schnitzel
Copy link
Member

just an idea, not sure if that would work:
currently we store the credentials just in the MariaDBConsumer object. But this object is not known by any other k8s objects (like I cannot mount a variable from MariaDBConsumer into a pod as environment variable).
So I could imagine that in the MariaDBConsumer you can define a secret and mabye also the keys that should be used to store the credentials in, this then can be mounted by a pod. So we don't have to copy paste credentials around.

@shreddedbacon
Copy link
Member

I think it might be possible to have it just create a secret with the same name that the consumer has.

It could then be a process of creating a consumer called, eg mariadbconsumer-testing like below, with a spec with secret.create: true set.

apiVersion: mariadb.amazee.io/v1
kind: MariaDBConsumer
metadata:
  name: mariadbconsumer-testing
spec:
  environment: test
  secret:
    create: true

Once the controller has created the resources, it will create (or update!) a secret of the same name.
That way you know the name of the secret already before creating it (you could also pre-create the secret, since it would get updated)

But it could then also be possible to pre-seed the secret name with something like this?

spec:
  environment: test
  secret:
    name: my-custom-secret-name
    create: true

The keys could just be the same as what happens in lagoon, but under spec.secret have a field called prefix and you can define the prefix that would be added to the start of the key?

${PREFIX}_DB_HOST=$(spec.consumer.services.primary)
${PREFIX}_DB_USER=$(spec.consumer.username)
${PREFIX}_DB_PASSWORD=$(spec.consumer.password)
${PREFIX}_DB_NAME=$(spec.consumer.database)
${PREFIX}_DB_PORT=$(spec.provider.port)
${PREFIX}_DB_READREPLICA_HOSTS=$(spec.consumer.services.replicas)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants