chore(label): new label "values-from"

This labels allow to use some environment variables from another service
and use the configMap / secret instead of the original value. This is
useful to avoid duplication of values for several variables.
This commit is contained in:
2024-11-26 16:11:12 +01:00
parent 4f0298c0a9
commit 3b4dade699
8 changed files with 304 additions and 0 deletions

View File

@@ -113,6 +113,10 @@ func Generate(project *types.Project) (*HelmChart, error) {
}
}
}
// it's now time to get "value-from", before makeing the secrets and configmaps!
for _, s := range project.Services {
chart.setEnvironmentValuesFrom(s, deployments)
}
// generate configmaps with environment variables
chart.generateConfigMapsAndSecrets(project)
@@ -123,6 +127,16 @@ func Generate(project *types.Project) (*HelmChart, error) {
chart.setSharedConf(s, deployments)
}
// remove all "boundEnv" from the values
for _, d := range deployments {
if len(d.boundEnvVar) == 0 {
continue
}
for _, e := range d.boundEnvVar {
delete(chart.Values[d.service.Name].(*Value).Environment, e)
}
}
// generate yaml files
for _, d := range deployments {
y, err := d.Yaml()