Changed behavio on environment
- variables are all in values.yaml as "template string". This means that we can now set values to reference others (useful with mapenv label) - we can also set any variable as a secret
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
// InlineConfig is made to represent a configMap or a secret
|
||||
type InlineConfig interface {
|
||||
AddEnvFile(filename string) error
|
||||
AddEnv(key, val string) error
|
||||
Metadata() *Metadata
|
||||
}
|
||||
|
||||
@@ -56,9 +57,12 @@ func (c *ConfigMap) AddEnvFile(file string) error {
|
||||
}
|
||||
c.Data[parts[0]] = parts[1]
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ConfigMap) AddEnv(key, val string) error {
|
||||
c.Data[key] = val
|
||||
return nil
|
||||
}
|
||||
|
||||
// Secret is made to represent a secret with data.
|
||||
@@ -108,3 +112,9 @@ func (s *Secret) AddEnvFile(file string) error {
|
||||
func (s *Secret) Metadata() *Metadata {
|
||||
return s.K8sBase.Metadata
|
||||
}
|
||||
|
||||
// AddEnv adds an environment variable to the secret.
|
||||
func (s *Secret) AddEnv(key, val string) error {
|
||||
s.Data[key] = fmt.Sprintf(`{{ %s | b64enc }}`, val)
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user