runtime: support for dynamic secrets (#1861)

* runtime: replace CreateCredentials with CreateSecret

* runtime/kubernetes: secrets support

* runtime: CreateSecret => WithSecret

* runtime: use map[string]string for secrets

* runtime/kubernetes: update to use kv secrets

* Fix merge conflict (missing import)

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
ben-toogood
2020-07-29 13:41:50 +01:00
committed by GitHub
parent 3d1ba914fc
commit 006bbefaf3
4 changed files with 27 additions and 49 deletions

View File

@@ -82,8 +82,8 @@ type CreateOptions struct {
Namespace string
// Specify the context to use
Context context.Context
// Credentials for the service to use
Credentials string
// Secrets to use
Secrets map[string]string
}
// ReadOptions queries runtime services
@@ -128,10 +128,14 @@ func CreateContext(ctx context.Context) CreateOption {
}
}
// CreateCredentials sets the credentials to start the service with
func CreateCredentials(user, pass string) CreateOption {
// WithSecret sets a secret to provide the service with
func WithSecret(key, value string) CreateOption {
return func(o *CreateOptions) {
o.Credentials = user + ":" + pass
if o.Secrets == nil {
o.Secrets = map[string]string{key: value}
} else {
o.Secrets[key] = value
}
}
}