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

@@ -75,22 +75,14 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
env = append(env, client.EnvVar{Name: evarPair[0], Value: evarPair[1]})
}
// if credentials were provided, pass them to the service
if len(c.Credentials) > 0 {
// if secrets were provided, pass them to the service
for key := range c.Secrets {
env = append(env, client.EnvVar{
Name: "MICRO_AUTH_ID",
Name: key,
ValueFrom: &client.EnvVarSource{
SecretKeyRef: &client.SecretKeySelector{
Name: c.Credentials, Key: "id",
},
},
})
env = append(env, client.EnvVar{
Name: "MICRO_AUTH_SECRET",
ValueFrom: &client.EnvVarSource{
SecretKeyRef: &client.SecretKeySelector{
Name: c.Credentials, Key: "secret",
Name: credentialsName(s),
Key: key,
},
},
})