@@ -14,6 +14,7 @@ import (
1414
1515 "github.com/deckhouse/deckhouse/pkg/log"
1616 "github.com/werf/nelm/pkg/action"
17+ "github.com/werf/nelm/pkg/common"
1718 nelmLog "github.com/werf/nelm/pkg/log"
1819 "helm.sh/helm/v3/pkg/cli"
1920 "k8s.io/cli-runtime/pkg/genericclioptions"
@@ -41,7 +42,7 @@ type NelmActions interface {
4142 ReleaseInstall (ctx context.Context , name , namespace string , opts action.ReleaseInstallOptions ) error
4243 ReleaseUninstall (ctx context.Context , name , namespace string , opts action.ReleaseUninstallOptions ) error
4344 ReleaseList (ctx context.Context , opts action.ReleaseListOptions ) (* action.ReleaseListResultV1 , error )
44- ChartRender (ctx context.Context , opts action.ChartRenderOptions ) (* action.ChartRenderResultV1 , error )
45+ ChartRender (ctx context.Context , opts action.ChartRenderOptions ) (* action.ChartRenderResultV2 , error )
4546}
4647
4748type DefaultNelmActions struct {}
@@ -62,7 +63,7 @@ func (d *DefaultNelmActions) ReleaseList(ctx context.Context, opts action.Releas
6263 return action .ReleaseList (ctx , opts )
6364}
6465
65- func (d * DefaultNelmActions ) ChartRender (ctx context.Context , opts action.ChartRenderOptions ) (* action.ChartRenderResultV1 , error ) {
66+ func (d * DefaultNelmActions ) ChartRender (ctx context.Context , opts action.ChartRenderOptions ) (* action.ChartRenderResultV2 , error ) {
6667 return action .ChartRender (ctx , opts )
6768}
6869
@@ -112,7 +113,9 @@ type NelmClient struct {
112113// GetReleaseLabels returns a specific label value from the release.
113114func (c * NelmClient ) GetReleaseLabels (releaseName , labelName string ) (string , error ) {
114115 releaseGetResult , err := c .actions .ReleaseGet (context .TODO (), releaseName , * c .opts .Namespace , action.ReleaseGetOptions {
115- KubeContext : c .opts .KubeContext ,
116+ KubeConnectionOptions : common.KubeConnectionOptions {
117+ KubeContextCurrent : c .opts .KubeContext ,
118+ },
116119 OutputNoPrint : true ,
117120 ReleaseStorageDriver : c .opts .HelmDriver ,
118121 })
@@ -165,7 +168,9 @@ func (c *NelmClient) GetAnnotations() map[string]string {
165168
166169func (c * NelmClient ) LastReleaseStatus (releaseName string ) (string , string , error ) {
167170 releaseGetResult , err := c .actions .ReleaseGet (context .TODO (), releaseName , * c .opts .Namespace , action.ReleaseGetOptions {
168- KubeContext : c .opts .KubeContext ,
171+ KubeConnectionOptions : common.KubeConnectionOptions {
172+ KubeContextCurrent : c .opts .KubeContext ,
173+ },
169174 OutputNoPrint : true ,
170175 ReleaseStorageDriver : c .opts .HelmDriver ,
171176 })
@@ -204,7 +209,9 @@ func (c *NelmClient) UpgradeRelease(releaseName, modulePath string, valuesPaths
204209
205210 // First check if release exists
206211 _ , err := c .actions .ReleaseGet (context .Background (), releaseName , namespace , action.ReleaseGetOptions {
207- KubeContext : c .opts .KubeContext ,
212+ KubeConnectionOptions : common.KubeConnectionOptions {
213+ KubeContextCurrent : c .opts .KubeContext ,
214+ },
208215 OutputNoPrint : true ,
209216 ReleaseStorageDriver : c .opts .HelmDriver ,
210217 })
@@ -220,22 +227,28 @@ func (c *NelmClient) UpgradeRelease(releaseName, modulePath string, valuesPaths
220227 }
221228
222229 if err := c .actions .ReleaseInstall (context .TODO (), releaseName , namespace , action.ReleaseInstallOptions {
223- Chart : modulePath ,
224- DefaultChartName : releaseName ,
225- DefaultChartVersion : "0.2.0" ,
226- DefaultChartAPIVersion : "v2" ,
227- ExtraLabels : c .labels ,
228- ExtraAnnotations : extraAnnotations ,
229- KubeContext : c .opts .KubeContext ,
230- NoInstallCRDs : true ,
231- ReleaseHistoryLimit : int (c .opts .HistoryMax ),
232- ReleaseLabels : releaseLabels ,
233- ReleaseStorageDriver : c .opts .HelmDriver ,
234- Timeout : c .opts .Timeout ,
235- ValuesFilesPaths : valuesPaths ,
236- ValuesSets : setValues ,
237- ForceAdoption : true ,
238- NoPodLogs : true ,
230+ KubeConnectionOptions : common.KubeConnectionOptions {
231+ KubeContextCurrent : c .opts .KubeContext ,
232+ },
233+ ValuesOptions : common.ValuesOptions {
234+ ValuesFiles : valuesPaths ,
235+ ValuesSet : setValues ,
236+ },
237+ TrackingOptions : common.TrackingOptions {
238+ NoPodLogs : true ,
239+ },
240+ Chart : modulePath ,
241+ DefaultChartName : releaseName ,
242+ DefaultChartVersion : "0.2.0" ,
243+ DefaultChartAPIVersion : "v2" ,
244+ ExtraLabels : c .labels ,
245+ ExtraAnnotations : extraAnnotations ,
246+ NoInstallStandaloneCRDs : true ,
247+ ReleaseHistoryLimit : int (c .opts .HistoryMax ),
248+ ReleaseLabels : releaseLabels ,
249+ ReleaseStorageDriver : c .opts .HelmDriver ,
250+ Timeout : c .opts .Timeout ,
251+ ForceAdoption : true ,
239252 }); err != nil {
240253 return fmt .Errorf ("install nelm release %q: %w" , releaseName , err )
241254 }
@@ -250,7 +263,9 @@ func (c *NelmClient) UpgradeRelease(releaseName, modulePath string, valuesPaths
250263
251264func (c * NelmClient ) GetReleaseValues (releaseName string ) (utils.Values , error ) {
252265 releaseGetResult , err := c .actions .ReleaseGet (context .TODO (), releaseName , * c .opts .Namespace , action.ReleaseGetOptions {
253- KubeContext : c .opts .KubeContext ,
266+ KubeConnectionOptions : common.KubeConnectionOptions {
267+ KubeContextCurrent : c .opts .KubeContext ,
268+ },
254269 OutputNoPrint : true ,
255270 ReleaseStorageDriver : c .opts .HelmDriver ,
256271 })
@@ -278,7 +293,9 @@ func (c *NelmClient) GetReleaseChecksum(releaseName string) (string, error) {
278293 logger := c .logger .With (slog .String ("release_name" , releaseName ))
279294
280295 releaseGetResult , err := c .actions .ReleaseGet (context .TODO (), releaseName , * c .opts .Namespace , action.ReleaseGetOptions {
281- KubeContext : c .opts .KubeContext ,
296+ KubeConnectionOptions : common.KubeConnectionOptions {
297+ KubeContextCurrent : c .opts .KubeContext ,
298+ },
282299 OutputNoPrint : true ,
283300 ReleaseStorageDriver : c .opts .HelmDriver ,
284301 })
@@ -309,11 +326,15 @@ func (c *NelmClient) DeleteRelease(releaseName string) error {
309326 c .logger .Debug ("nelm release: execute nelm uninstall" , slog .String ("release" , releaseName ))
310327
311328 if err := c .actions .ReleaseUninstall (context .TODO (), releaseName , * c .opts .Namespace , action.ReleaseUninstallOptions {
312- KubeContext : c .opts .KubeContext ,
329+ KubeConnectionOptions : common.KubeConnectionOptions {
330+ KubeContextCurrent : c .opts .KubeContext ,
331+ },
332+ TrackingOptions : common.TrackingOptions {
333+ NoPodLogs : true ,
334+ },
313335 ReleaseHistoryLimit : int (c .opts .HistoryMax ),
314336 ReleaseStorageDriver : c .opts .HelmDriver ,
315337 Timeout : c .opts .Timeout ,
316- NoPodLogs : true ,
317338 }); err != nil {
318339 return fmt .Errorf ("nelm uninstall release %q: %w" , releaseName , err )
319340 }
@@ -336,7 +357,9 @@ func (c *NelmClient) IsReleaseExists(releaseName string) (bool, error) {
336357
337358func (c * NelmClient ) ListReleasesNames () ([]string , error ) {
338359 releaseListResult , err := c .actions .ReleaseList (context .TODO (), action.ReleaseListOptions {
339- KubeContext : c .opts .KubeContext ,
360+ KubeConnectionOptions : common.KubeConnectionOptions {
361+ KubeContextCurrent : c .opts .KubeContext ,
362+ },
340363 OutputNoPrint : true ,
341364 ReleaseStorageDriver : c .opts .HelmDriver ,
342365 })
@@ -381,20 +404,24 @@ func (c *NelmClient) Render(releaseName, modulePath string, valuesPaths, setValu
381404 }
382405
383406 chartRenderResult , err := c .actions .ChartRender (context .TODO (), action.ChartRenderOptions {
407+ KubeConnectionOptions : common.KubeConnectionOptions {
408+ KubeContextCurrent : c .opts .KubeContext ,
409+ },
410+ ValuesOptions : common.ValuesOptions {
411+ ValuesFiles : valuesPaths ,
412+ ValuesSet : setValues ,
413+ },
384414 OutputFilePath : "/dev/null" , // No output file, we want to return the manifest as a string
385415 Chart : modulePath ,
386416 DefaultChartName : releaseName ,
387417 DefaultChartVersion : "0.2.0" ,
388418 DefaultChartAPIVersion : "v2" ,
389419 ExtraLabels : c .labels ,
390420 ExtraAnnotations : extraAnnotations ,
391- KubeContext : c .opts .KubeContext ,
392421 ReleaseName : releaseName ,
393422 ReleaseNamespace : namespace ,
394423 ReleaseStorageDriver : c .opts .HelmDriver ,
395424 Remote : true ,
396- ValuesFilesPaths : valuesPaths ,
397- ValuesSets : setValues ,
398425 ForceAdoption : true ,
399426 })
400427 if err != nil {
0 commit comments