Skip to content

Commit

Permalink
Add GetBootstrapPresets
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Oct 29, 2023
1 parent 0b79f64 commit a1fedf0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions hub/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,28 @@ func FluxCDHelmRepository(kc client.Client) kmapi.TypedObjectReference {
}
}

func FeatureVersion(kc client.Client, featureName string) string {
func GetBootstrapPresets(kc client.Client) (*shared.BootstrapPresets, bool) {
if kc != nil {
var ccp chartsapi.ClusterChartPreset
err := kc.Get(context.TODO(), client.ObjectKey{Name: BootstrapPresetsName}, &ccp)
if err == nil {
var preset shared.BootstrapPresets
err := json.Unmarshal(ccp.Spec.Values.Raw, &preset)
if err == nil {
hr := preset.Helm.Releases[featureName]
if hr != nil {
return hr.Version
}
return &preset, true
}
}
}
return nil, false
}

func FeatureVersion(kc client.Client, featureName string) string {
preset, found := GetBootstrapPresets(kc)
if found {
hr := preset.Helm.Releases[featureName]
if hr != nil {
return hr.Version
}
}
return ""
}

0 comments on commit a1fedf0

Please sign in to comment.