Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
feat(bundles): allow usage of bundles with included secret-values as …
…oci chart dependencies Decode secret-values.yaml included into the bundle when converging a werf project with bundle enabled as a chart dependency. Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
- Loading branch information
1 parent
e1dcbea
commit 469678c
Showing
12 changed files
with
144 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package helpers | ||
|
||
import ( | ||
"context" | ||
|
||
"helm.sh/helm/v3/pkg/chartutil" | ||
|
||
"github.com/werf/werf/pkg/deploy/helm/chart_extender/helpers/secrets" | ||
) | ||
|
||
type ChartExtenderValuesMerger struct{} | ||
|
||
func (m *ChartExtenderValuesMerger) MergeValues(ctx context.Context, inputVals, serviceVals map[string]interface{}, secretsRuntimeData *secrets.SecretsRuntimeData) (map[string]interface{}, error) { | ||
vals := make(map[string]interface{}) | ||
|
||
DebugPrintValues(ctx, "service", serviceVals) | ||
chartutil.CoalesceTables(vals, serviceVals) // NOTE: service values will not be saved into the marshalled release | ||
|
||
if secretsRuntimeData != nil { | ||
if DebugSecretValues() { | ||
DebugPrintValues(ctx, "secret", secretsRuntimeData.DecryptedSecretValues) | ||
} | ||
chartutil.CoalesceTables(vals, secretsRuntimeData.DecryptedSecretValues) | ||
} | ||
|
||
DebugPrintValues(ctx, "input", inputVals) | ||
chartutil.CoalesceTables(vals, inputVals) | ||
|
||
if DebugSecretValues() { | ||
// Only print all values with secrets when secret values debug enabled | ||
DebugPrintValues(ctx, "all", vals) | ||
} | ||
|
||
return vals, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package helpers | ||
|
||
import ( | ||
"context" | ||
"os" | ||
|
||
"sigs.k8s.io/yaml" | ||
|
||
"github.com/werf/logboek" | ||
) | ||
|
||
func DebugPrintValues(ctx context.Context, name string, vals map[string]interface{}) { | ||
data, err := yaml.Marshal(vals) | ||
if err != nil { | ||
logboek.Context(ctx).Debug().LogF("Unable to marshal %q values: %s\n", err) | ||
} else { | ||
logboek.Context(ctx).Debug().LogF("%q values:\n%s---\n", name, data) | ||
} | ||
} | ||
|
||
func DebugSecretValues() bool { | ||
return os.Getenv("WERF_DEBUG_SECRET_VALUES") == "1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters