-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.17 - Relax gloogateway.Context validation (#10153)
Co-authored-by: Sam Heilbron <[email protected]> Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com>
- Loading branch information
1 parent
33d3991
commit d9f563c
Showing
5 changed files
with
94 additions
and
71 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
changelog/v1.17.13/production-helm-profiles-in-tests-part2.yaml
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,6 @@ | ||
changelog: | ||
- type: NON_USER_FACING | ||
issueLink: https://github.com/solo-io/docs/issues/489 | ||
resolvesIssue: false | ||
description: >- | ||
Validate the gloogateway.Context object in a way that it can be invoked by an Enterprise installation |
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,46 @@ | ||
package helmutils | ||
|
||
import ( | ||
"os" | ||
|
||
k8syamlutil "sigs.k8s.io/yaml" | ||
) | ||
|
||
// UnmarshalValuesFile reads a file and returns a map containing the unmarshalled values | ||
func UnmarshalValuesFile(filePath string) (map[string]interface{}, error) { | ||
mapFromFile := map[string]interface{}{} | ||
|
||
bytes, err := os.ReadFile(filePath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// NOTE: This is not the default golang yaml.Unmarshal, because that implementation | ||
// does not unmarshal into a map[string]interface{}; it unmarshals the file into a map[interface{}]interface{} | ||
// https://github.com/go-yaml/yaml/issues/139 | ||
if err := k8syamlutil.Unmarshal(bytes, &mapFromFile); err != nil { | ||
return nil, err | ||
} | ||
|
||
return mapFromFile, nil | ||
} | ||
|
||
// MergeMaps comes from Helm internals: https://github.com/helm/helm/blob/release-3.0/pkg/cli/values/options.go#L88 | ||
func MergeMaps(a, b map[string]interface{}) map[string]interface{} { | ||
out := make(map[string]interface{}, len(a)) | ||
for k, v := range a { | ||
out[k] = v | ||
} | ||
for k, v := range b { | ||
if v, ok := v.(map[string]interface{}); ok { | ||
if bv, ok := out[k]; ok { | ||
if bv, ok := bv.(map[string]interface{}); ok { | ||
out[k] = MergeMaps(bv, v) | ||
continue | ||
} | ||
} | ||
} | ||
out[k] = v | ||
} | ||
return out | ||
} |
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