@ -102,7 +102,7 @@ type Configuration struct {
// TODO: This function is badly in need of a refactor.
// TODO: This function is badly in need of a refactor.
// TODO: As part of the refactor the duplicate code in cmd/helm/template.go should be removed
// TODO: As part of the refactor the duplicate code in cmd/helm/template.go should be removed
// This code has to do with writing files to disk.
// This code has to do with writing files to disk.
func ( cfg * Configuration ) renderResources ( ch * chart . Chart , values chartutil . Values , releaseName , outputDir string , subNotes , useReleaseName , includeCrds bool , pr postrender . PostRenderer , dryRun bool ) ( [ ] * release . Hook , * bytes . Buffer , string , error ) {
func ( cfg * Configuration ) renderResources ( ch * chart . Chart , values chartutil . Values , releaseName , outputDir string , subNotes , useReleaseName , includeCrds bool , pr postrender . PostRenderer , interactWithRemote bool ) ( [ ] * release . Hook , * bytes . Buffer , string , error ) {
hs := [ ] * release . Hook { }
hs := [ ] * release . Hook { }
b := bytes . NewBuffer ( nil )
b := bytes . NewBuffer ( nil )
@ -120,12 +120,12 @@ func (cfg *Configuration) renderResources(ch *chart.Chart, values chartutil.Valu
var files map [ string ] string
var files map [ string ] string
var err2 error
var err2 error
// A `helm template` or `helm install --dry-run` should not talk to the remote cluster.
// A `helm template` should not talk to the remote cluster. However, commands
// It will break in interesting and exotic ways because other data (e.g. discovery)
// with `--dry-run` should be able to try to connect to the cluster.
// is mocked. It is not up to the template author to decide when the user wants to
// This enables the ability to render 'lookup' functions.
// connect to the cluster. So when the user says to dry run, respect the user's
// It may break in interesting and exotic ways because other data (e.g. discovery)
// wishes and do not connect to the cluster .
// is mocked .
if ! dryRun && cfg . RESTClientGetter != nil {
if interactWithRemote && cfg . RESTClientGetter != nil {
restConfig , err := cfg . RESTClientGetter . ToRESTConfig ( )
restConfig , err := cfg . RESTClientGetter . ToRESTConfig ( )
if err != nil {
if err != nil {
return hs , b , "" , err
return hs , b , "" , err