Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Introduce ExternalSecretBackend CRDs to configure multiple backends #15

Closed
wants to merge 19 commits into from

Conversation

riccardomc
Copy link
Contributor

@riccardomc riccardomc commented May 23, 2019

Extract Backend instantiation by introducing an ExternalSecretBackend CRD and relative controller.

Backends will be instantiated by creating ExternalSecretBackend CR similar to the following:

apiVersion: externalsecret-operator.container-solutions.com/v1alpha1
kind: ExternalSecretBackend
metadata:
  name: asm-example
spec:
  Type: asm
  Parameters:
    accessKeyID: AKIA...
    secretAccessKey: KSecret444
    region: eu-west-1

ExternalSecret CR will reference the ExternalSecretName to specify which backend to use. For example, the following CR would use the Backend defined above:

apiVersion: externalsecret-operator.container-solutions.com/v1alpha1
kind: ExternalSecret
metadata:
  name: example-externalsecret-asm
spec:
  Key: example-externalsecret-key
  Backend: asm-example

Backend types are now required to register themselves at startup in a:

var BackendFunctions map[string]func() BackendIface

which maps the backend type label to a function that returns a backend of that type.

This will allow the controller to instantiate backends of the correct type when reconciling the ExternalSecretBackend CRs. Instantiated backend are stored in a map as well:

var BackendInstances map[string]BackendIface

An easy way to register backend types at startup is to use the init() function in the module that defines the backend. For example, this is how it is done in the AWS Secret Manager backend:

func init() {
	BackendRegister("asm", NewAWSSecretsManagerBackend)
}

@riccardomc
Copy link
Contributor Author

Closed because we merged #18 instead.

@riccardomc riccardomc deleted the externalsecretbackend branch May 29, 2019 18:20
amouat pushed a commit that referenced this pull request May 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant