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

@@ -270,16 +270,9 @@ func (r *localRuntime) Create(s *runtime.Service, opts ...runtime.CreateOption)
options.Args = []string{"run", "."}
}
// pass credentials as env vars
if len(options.Credentials) > 0 {
// validate the creds
comps := strings.Split(options.Credentials, ":")
if len(comps) != 2 {
return errors.New("Invalid credentials, expected format 'user:pass'")
}
options.Env = append(options.Env, "MICRO_AUTH_ID", comps[0])
options.Env = append(options.Env, "MICRO_AUTH_SECRET", comps[1])
// pass secrets as env vars
for key, value := range options.Secrets {
options.Env = append(options.Env, key, value)
}
if _, ok := r.namespaces[options.Namespace]; !ok {