Skip to content

Commit 72698eb

Browse files
authored
Use pointer when converting Helm configs (#251)
* Use pointer when converting Helm configs
1 parent e8b399f commit 72698eb

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/ohler55/ojg v1.23.0
1919
github.com/onsi/ginkgo/v2 v2.19.0
2020
github.com/onsi/gomega v1.33.1
21-
github.com/replicatedhq/embedded-cluster-kinds v1.4.5
21+
github.com/replicatedhq/embedded-cluster-kinds v1.4.6
2222
github.com/sirupsen/logrus v1.9.3
2323
github.com/spf13/cobra v1.8.1
2424
github.com/stretchr/testify v1.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne
174174
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
175175
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
176176
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
177-
github.com/replicatedhq/embedded-cluster-kinds v1.4.5 h1:OZygNoSL4yFF+r+0l2slnq/2aj3Wl6KF1TE2euz8hVI=
178-
github.com/replicatedhq/embedded-cluster-kinds v1.4.5/go.mod h1:AwopUvvGcaWO4mn9DkbPj5RnLuOy756CNLrcaAlmjMo=
177+
github.com/replicatedhq/embedded-cluster-kinds v1.4.6 h1:nP2/ANhUW1omiPp3WFm6tQWkLy9fAA4JPveazg8LlTU=
178+
github.com/replicatedhq/embedded-cluster-kinds v1.4.6/go.mod h1:AwopUvvGcaWO4mn9DkbPj5RnLuOy756CNLrcaAlmjMo=
179179
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
180180
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
181181
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=

pkg/upgrade/upgrade.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
k0sv1beta1 "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
1313
"github.com/replicatedhq/embedded-cluster-kinds/apis/v1beta1"
1414
clusterv1beta1 "github.com/replicatedhq/embedded-cluster-kinds/apis/v1beta1"
15-
ectypes "github.com/replicatedhq/embedded-cluster-kinds/types"
1615
"github.com/replicatedhq/embedded-cluster-operator/pkg/artifacts"
1716
"github.com/replicatedhq/embedded-cluster-operator/pkg/autopilot"
1817
"github.com/replicatedhq/embedded-cluster-operator/pkg/charts"
@@ -226,7 +225,7 @@ func getOperatorChart(ctx context.Context, cli client.Client, in *clusterv1beta1
226225
return nil, fmt.Errorf("failed to get helm charts from installation: %w", err)
227226
}
228227

229-
cfgs := k0sv1beta1.HelmExtensions{}
228+
cfgs := &k0sv1beta1.HelmExtensions{}
230229
cfgs, err = v1beta1.ConvertTo(*combinedConfigs, cfgs)
231230
if err != nil {
232231
return nil, fmt.Errorf("convert to k0s helm type: %w", err)
@@ -241,21 +240,6 @@ func getOperatorChart(ctx context.Context, cli client.Client, in *clusterv1beta1
241240
return nil, fmt.Errorf("operator chart not found")
242241
}
243242

244-
func getOperatorChartFromMetadata(metadata *ectypes.ReleaseMetadata) (k0sv1beta1.Chart, error) {
245-
cfgs := k0sv1beta1.HelmExtensions{}
246-
cfgs, err := v1beta1.ConvertTo(metadata.Configs, cfgs)
247-
if err != nil {
248-
return k0sv1beta1.Chart{}, fmt.Errorf("convert to k0s helm type: %w", err)
249-
}
250-
251-
for _, chart := range cfgs.Charts {
252-
if chart.Name == operatorChartName {
253-
return chart, nil
254-
}
255-
}
256-
return k0sv1beta1.Chart{}, fmt.Errorf("chart not found")
257-
}
258-
259243
const (
260244
installationNameAnnotation = "embedded-cluster.replicated.com/installation-name"
261245
)

0 commit comments

Comments
 (0)