Skip to content

Commit 3949b70

Browse files
committed
feat(values): env WERF_EXPERIMENT_NO_GLOBAL_SERVICE_VALUES=1 will disable global service values
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
1 parent 97fa211 commit 3949b70

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

pkg/deploy/helm/chart_extender/helpers/service_values.go

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/werf/logboek"
1515
"github.com/werf/werf/v2/pkg/image"
16+
"github.com/werf/werf/v2/pkg/util"
1617
"github.com/werf/werf/v2/pkg/werf"
1718
)
1819

@@ -47,10 +48,15 @@ type ServiceValuesOptions struct {
4748
}
4849

4950
func GetEnvServiceValues(env string) map[string]interface{} {
50-
return map[string]interface{}{
51-
"werf": map[string]interface{}{"env": env},
52-
"global": map[string]interface{}{"env": env},
51+
result := map[string]interface{}{
52+
"werf": map[string]interface{}{"env": env},
5353
}
54+
55+
if exposeGlobalServiceValues() {
56+
result["global"] = map[string]interface{}{"env": env}
57+
}
58+
59+
return result
5460
}
5561

5662
func GetServiceValues(ctx context.Context, projectName, repo string, imageInfoGetters []*image.InfoGetter, opts ServiceValuesOptions) (map[string]interface{}, error) {
@@ -114,8 +120,11 @@ func GetServiceValues(ctx context.Context, projectName, repo string, imageInfoGe
114120
}
115121

116122
res := map[string]interface{}{
117-
"werf": werfInfo,
118-
"global": globalInfo,
123+
"werf": werfInfo,
124+
}
125+
126+
if exposeGlobalServiceValues() {
127+
res["global"] = globalInfo
119128
}
120129

121130
if opts.SetDockerConfigJsonValue {
@@ -151,8 +160,11 @@ func GetBundleServiceValues(ctx context.Context, opts ServiceValuesOptions) (map
151160
}
152161

153162
res := map[string]interface{}{
154-
"werf": werfInfo,
155-
"global": globalInfo,
163+
"werf": werfInfo,
164+
}
165+
166+
if exposeGlobalServiceValues() {
167+
res["global"] = globalInfo
156168
}
157169

158170
if opts.SetDockerConfigJsonValue {
@@ -193,3 +205,8 @@ func writeDockerConfigJsonValue(ctx context.Context, values map[string]interface
193205

194206
return nil
195207
}
208+
209+
// TODO(3.0): remove global service values completely
210+
func exposeGlobalServiceValues() bool {
211+
return !util.GetBoolEnvironmentDefaultFalse("WERF_EXPERIMENT_NO_GLOBAL_SERVICE_VALUES")
212+
}

0 commit comments

Comments
 (0)