Skip to content

Commit

Permalink
Add FeatureValues helper (#453)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Aug 2, 2024
1 parent 995886d commit 9d80d06
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions hub/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,29 @@ func FeatureVersion(kc client.Client, featureName string) string {
return ""
}

func FeatureValues(kc client.Client, featureName string) (map[string]any, error) {
preset, found := GetBootstrapPresets(kc)
if found {
hr := preset.Helm.Releases[featureName]
if hr != nil && hr.Values != nil {
var vals map[string]any
if err := toMap(hr.Values, &vals); err != nil {
return nil, err
}
return vals, nil
}
}
return map[string]any{}, nil
}

func toMap(src, dst any) error {
data, err := json.Marshal(src)
if err != nil {
return err
}
return json.Unmarshal(data, dst)
}

func HelmCreateNamespace(kc client.Client) bool {
preset, found := GetBootstrapPresets(kc)
if found {
Expand Down

0 comments on commit 9d80d06

Please sign in to comment.