@@ -49,11 +49,6 @@ type Chart struct {
4949 // is intended to be read-only and should not be modified
5050 // by callers. Instead, modify the Values field.
5151 OriginalValues * CoderValues
52-
53- // Values contains the effective chart values. This is a
54- // deep copy of OriginalValues, and callers can modify
55- // the values.
56- Values * CoderValues
5752}
5853
5954// CoderValues is a typed Go representation of Coder's values
@@ -306,17 +301,12 @@ func LoadChart(t *testing.T) *Chart {
306301 originalValues , err := ConvertMapToCoderValues (chart .Values , true )
307302 require .NoError (t , err , "error parsing original values" )
308303
309- // Create another copy for users to modify
310- values , err := ConvertMapToCoderValues (chart .Values , true )
311- require .NoError (t , err , "error parsing original values" )
312-
313304 return & Chart {
314305 chart : chart ,
315306 Metadata : chart .Metadata ,
316307 Files : chart .Files ,
317308 Templates : chart .Templates ,
318309 OriginalValues : originalValues ,
319- Values : values ,
320310 }
321311}
322312
@@ -340,27 +330,21 @@ func (c *Chart) Validate() error {
340330 return c .chart .Validate ()
341331}
342332
343- // RenderChart applies the CoderValues to the chart, and returns a list
333+ // Render applies the CoderValues to the chart, and returns a list
344334// of Kubernetes runtime objects, or an error.
345335//
346336// values, options, and capabilities may be nil, in which case the
347337// function will simulate a fresh install to the "coder" namespace
348338// using the "coder" release, default values, and capabilities.
349- func RenderChart ( chrt * chart. Chart , values * CoderValues , options * chartutil.ReleaseOptions , capabilities * chartutil.Capabilities ) ([]runtime.Object , error ) {
339+ func ( c * Chart ) Render ( values * CoderValues , options * chartutil.ReleaseOptions , capabilities * chartutil.Capabilities ) ([]runtime.Object , error ) {
350340 vals , err := ConvertCoderValuesToMap (values )
351341 if err != nil {
352342 return nil , fmt .Errorf ("failed to convert values to map: %w" , err )
353343 }
354344
355345 var opts chartutil.ReleaseOptions
356346 if options == nil {
357- opts = chartutil.ReleaseOptions {
358- Name : "coder" ,
359- Namespace : "coder" ,
360- Revision : 1 ,
361- IsInstall : true ,
362- IsUpgrade : false ,
363- }
347+ opts = DefaultReleaseOptions ()
364348 } else {
365349 opts = * options
366350 }
@@ -369,12 +353,12 @@ func RenderChart(chrt *chart.Chart, values *CoderValues, options *chartutil.Rele
369353 capabilities = chartutil .DefaultCapabilities .Copy ()
370354 }
371355
372- vals , err = chartutil .ToRenderValues (chrt , vals , opts , capabilities )
356+ vals , err = chartutil .ToRenderValues (c . chart , vals , opts , capabilities )
373357 if err != nil {
374358 return nil , fmt .Errorf ("failed to create render values: %w" , err )
375359 }
376360
377- manifests , err := engine .Render (chrt , vals )
361+ manifests , err := engine .Render (c . chart , vals )
378362 if err != nil {
379363 return nil , fmt .Errorf ("failed to render Chart: %w" , err )
380364 }
0 commit comments