@@ -106,10 +106,8 @@ type NelmClient struct {
106106 labels map [string ]string
107107 annotations map [string ]string
108108
109- opts * CommonOptions
110- actions NelmActions
111- virtualChart bool
112- modulePath string
109+ opts * CommonOptions
110+ actions NelmActions
113111}
114112
115113// GetReleaseLabels returns a specific label value from the release.
@@ -161,14 +159,6 @@ func (c *NelmClient) WithExtraAnnotations(annotations map[string]string) {
161159 }
162160}
163161
164- func (c * NelmClient ) WithVirtualChart (virtual bool ) {
165- c .virtualChart = virtual
166- }
167-
168- func (c * NelmClient ) WithModulePath (path string ) {
169- c .modulePath = path
170- }
171-
172162// GetAnnotations returns the annotations for testing purposes
173163func (c * NelmClient ) GetAnnotations () map [string ]string {
174164 return c .annotations
@@ -232,33 +222,22 @@ func (c *NelmClient) UpgradeRelease(releaseName string, chart *chart.Chart, valu
232222
233223 // Prepare chart options based on whether this is a virtual chart
234224 opts := action.ReleaseInstallOptions {
235- Chart : c .modulePath ,
236- ExtraLabels : c .labels ,
237- ExtraAnnotations : extraAnnotations ,
238- KubeContext : c .opts .KubeContext ,
239- NoInstallCRDs : true ,
240- ReleaseHistoryLimit : int (c .opts .HistoryMax ),
241- ReleaseLabels : releaseLabels ,
242- ReleaseStorageDriver : c .opts .HelmDriver ,
243- Timeout : c .opts .Timeout ,
244- ValuesFilesPaths : valuesPaths ,
245- ValuesSets : setValues ,
246- ForceAdoption : true ,
247- NoPodLogs : true ,
248- }
249-
250- if c .virtualChart {
251- logger .Info ("NELM: Using virtual chart mode" ,
252- slog .String ("defaultName" , chart .Metadata .Name ),
253- slog .String ("defaultVersion" , chart .Metadata .Version ),
254- slog .String ("defaultAPIVersion" , chart .Metadata .APIVersion ),
255- slog .String ("modulePath" , c .modulePath ),
256- slog .Bool ("usePrebuiltChart" , true ),
257- slog .Int ("chartTemplatesCount" , len (chart .Templates )),
258- slog .Int ("chartRawCount" , len (chart .Raw )))
259- opts .DefaultChartAPIVersion = chart .Metadata .APIVersion
260- opts .DefaultChartName = chart .Metadata .Name
261- opts .DefaultChartVersion = chart .Metadata .Version
225+ Chart : chart .Metadata .Name ,
226+ DefaultChartVersion : chart .Metadata .Version ,
227+ DefaultChartName : chart .Metadata .Name ,
228+ DefaultChartAPIVersion : chart .Metadata .APIVersion ,
229+ ExtraLabels : c .labels ,
230+ ExtraAnnotations : extraAnnotations ,
231+ KubeContext : c .opts .KubeContext ,
232+ NoInstallCRDs : true ,
233+ ReleaseHistoryLimit : int (c .opts .HistoryMax ),
234+ ReleaseLabels : releaseLabels ,
235+ ReleaseStorageDriver : c .opts .HelmDriver ,
236+ Timeout : c .opts .Timeout ,
237+ ValuesFilesPaths : valuesPaths ,
238+ ValuesSets : setValues ,
239+ ForceAdoption : true ,
240+ NoPodLogs : true ,
262241 }
263242
264243 if err = c .actions .ReleaseInstall (context .TODO (), releaseName , namespace , opts ); err != nil {
@@ -407,37 +386,21 @@ func (c *NelmClient) Render(releaseName string, chart *chart.Chart, valuesPaths,
407386
408387 // Prepare chart render options based on whether this is a virtual chart
409388 renderOpts := action.ChartRenderOptions {
410- OutputFilePath : "/dev/null" , // No output file, we want to return the manifest as a string
411- ExtraLabels : c .labels ,
412- ExtraAnnotations : extraAnnotations ,
413- KubeContext : c .opts .KubeContext ,
414- ReleaseName : releaseName ,
415- ReleaseNamespace : namespace ,
416- ReleaseStorageDriver : c .opts .HelmDriver ,
417- Remote : true ,
418- ValuesFilesPaths : valuesPaths ,
419- ValuesSets : setValues ,
420- ForceAdoption : true ,
421- }
422-
423- if c .virtualChart {
424- // For virtual charts, use default chart fields and empty chart path
425- // The chart object passed to this method already contains filtered files
426- c .logger .Info ("NELM Render: Using virtual chart mode" ,
427- slog .String ("defaultName" , chart .Metadata .Name ),
428- slog .String ("defaultVersion" , chart .Metadata .Version ),
429- slog .String ("defaultAPIVersion" , chart .Metadata .APIVersion ),
430- slog .String ("modulePath" , c .modulePath ),
431- slog .Bool ("usePrebuiltChart" , true ))
432- renderOpts .Chart = ""
433- renderOpts .DefaultChartAPIVersion = chart .Metadata .APIVersion
434- renderOpts .DefaultChartName = chart .Metadata .Name
435- renderOpts .DefaultChartVersion = chart .Metadata .Version
436- } else {
437- // For regular charts, use the module path
438- c .logger .Info ("NELM Render: Using regular chart mode" ,
439- slog .String ("chartPath" , c .modulePath ))
440- renderOpts .Chart = c .modulePath
389+ Chart : chart .ChartPath (),
390+ DefaultChartAPIVersion : chart .Metadata .APIVersion ,
391+ DefaultChartName : chart .Metadata .Name ,
392+ DefaultChartVersion : chart .Metadata .Version ,
393+ OutputFilePath : "/dev/null" , // No output file, we want to return the manifest as a string
394+ ExtraLabels : c .labels ,
395+ ExtraAnnotations : extraAnnotations ,
396+ KubeContext : c .opts .KubeContext ,
397+ ReleaseName : releaseName ,
398+ ReleaseNamespace : namespace ,
399+ ReleaseStorageDriver : c .opts .HelmDriver ,
400+ Remote : true ,
401+ ValuesFilesPaths : valuesPaths ,
402+ ValuesSets : setValues ,
403+ ForceAdoption : true ,
441404 }
442405
443406 chartRenderResult , err := c .actions .ChartRender (context .TODO (), renderOpts )
0 commit comments