77 "strings"
88
99 "github.com/replicatedhq/embedded-cluster/pkg/addons/openebs"
10+ "github.com/replicatedhq/embedded-cluster/pkg/helm"
1011 "github.com/replicatedhq/embedded-cluster/pkg/release"
1112 "github.com/sirupsen/logrus"
1213 "github.com/urfave/cli/v2"
@@ -47,12 +48,18 @@ var updateOpenEBSAddonCommand = &cli.Command{
4748 Action : func (c * cli.Context ) error {
4849 logrus .Infof ("updating openebs addon" )
4950
51+ hcli , err := NewHelm ()
52+ if err != nil {
53+ return fmt .Errorf ("failed to create helm client: %w" , err )
54+ }
55+ defer hcli .Close ()
56+
5057 nextChartVersion := os .Getenv ("INPUT_OPENEBS_CHART_VERSION" )
5158 if nextChartVersion != "" {
5259 logrus .Infof ("using input override from INPUT_OPENEBS_CHART_VERSION: %s" , nextChartVersion )
5360 } else {
5461 logrus .Infof ("fetching the latest openebs chart version" )
55- latest , err := LatestChartVersion (openebsRepo , "openebs" )
62+ latest , err := LatestChartVersion (hcli , openebsRepo , "openebs" )
5663 if err != nil {
5764 return fmt .Errorf ("failed to get the latest openebs chart version: %v" , err )
5865 }
@@ -68,7 +75,7 @@ var updateOpenEBSAddonCommand = &cli.Command{
6875 }
6976
7077 logrus .Infof ("mirroring openebs chart version %s" , nextChartVersion )
71- if err := MirrorChart (openebsRepo , "openebs" , nextChartVersion ); err != nil {
78+ if err := MirrorChart (hcli , openebsRepo , "openebs" , nextChartVersion ); err != nil {
7279 return fmt .Errorf ("failed to mirror openebs chart: %v" , err )
7380 }
7481
@@ -77,7 +84,7 @@ var updateOpenEBSAddonCommand = &cli.Command{
7784
7885 logrus .Infof ("updating openebs images" )
7986
80- err : = updateOpenEBSAddonImages (c .Context , withproto , nextChartVersion , nextChartVersion )
87+ err = updateOpenEBSAddonImages (c .Context , hcli , withproto , nextChartVersion , nextChartVersion )
8188 if err != nil {
8289 return fmt .Errorf ("failed to update openebs images: %w" , err )
8390 }
@@ -95,9 +102,15 @@ var updateOpenEBSImagesCommand = &cli.Command{
95102 Action : func (c * cli.Context ) error {
96103 logrus .Infof ("updating openebs images" )
97104
105+ hcli , err := NewHelm ()
106+ if err != nil {
107+ return fmt .Errorf ("failed to create helm client: %w" , err )
108+ }
109+ defer hcli .Close ()
110+
98111 current := openebs .Metadata
99112
100- err : = updateOpenEBSAddonImages (c .Context , current .Location , current .Version , current .Version )
113+ err = updateOpenEBSAddonImages (c .Context , hcli , current .Location , current .Version , current .Version )
101114 if err != nil {
102115 return fmt .Errorf ("failed to update openebs images: %w" , err )
103116 }
@@ -108,7 +121,7 @@ var updateOpenEBSImagesCommand = &cli.Command{
108121 },
109122}
110123
111- func updateOpenEBSAddonImages (ctx context.Context , chartURL string , chartVersion string , linuxUtilsVersion string ) error {
124+ func updateOpenEBSAddonImages (ctx context.Context , hcli helm. Client , chartURL string , chartVersion string , linuxUtilsVersion string ) error {
112125 newmeta := release.AddonMetadata {
113126 Version : chartVersion ,
114127 Location : chartURL ,
@@ -121,7 +134,7 @@ func updateOpenEBSAddonImages(ctx context.Context, chartURL string, chartVersion
121134 }
122135
123136 logrus .Infof ("extracting images from chart version %s" , chartVersion )
124- images , err := GetImagesFromOCIChart ( chartURL , "openebs" , chartVersion , values )
137+ images , err := helm . ExtractImagesFromOCIChart ( hcli , chartURL , "openebs" , chartVersion , values )
125138 if err != nil {
126139 return fmt .Errorf ("failed to get images from openebs chart: %w" , err )
127140 }
0 commit comments