mirror of
https://github.com/helm/helm.git
synced 2026-06-30 19:57:48 +00:00
feat(helm): add ability for --dry-run to do lookup functions
When a helm command is run with the --dry-run flag, it will try to connect to the cluster if the value is 'server' to be able to render lookup functions. Closes #8137 Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
This commit is contained in:
@@ -120,11 +120,9 @@ func (cfg *Configuration) renderResources(ch *chart.Chart, values chartutil.Valu
|
||||
var files map[string]string
|
||||
var err2 error
|
||||
|
||||
// A `helm template` should not talk to the remote cluster. However, commands
|
||||
// with the flag `--dry-run-option` with the value of false, none, or sever
|
||||
// or with the flag `--dry-run` with the value of false should try to interact with the cluster.
|
||||
// It may break in interesting and exotic ways because other data (e.g. discovery)
|
||||
// is mocked.
|
||||
// A `helm template` should not talk to the remote cluster. However, commands with the flag
|
||||
//`--dry-run` with the value of `false`, `none`, or `server` should try to interact with the cluster.
|
||||
// It may break in interesting and exotic ways because other data (e.g. discovery) is mocked.
|
||||
if interactWithRemote && cfg.RESTClientGetter != nil {
|
||||
restConfig, err := cfg.RESTClientGetter.ToRESTConfig()
|
||||
if err != nil {
|
||||
|
||||
@@ -204,13 +204,12 @@ func (i *Install) RunWithContext(ctx context.Context, chrt *chart.Chart, vals ma
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// determine dry run behavior
|
||||
// Determine dry run behavior
|
||||
if i.DryRun || i.DryRunOption == "client" || i.DryRunOption == "server" || i.DryRunOption == "true" {
|
||||
i.DryRun = true
|
||||
}
|
||||
|
||||
var interactWithRemote bool
|
||||
// `helm template` is the only command that Install.APIVersions field will not be nil.
|
||||
if !i.DryRun || i.DryRunOption == "server" {
|
||||
interactWithRemote = true
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ func (u *Upgrade) RunWithContext(ctx context.Context, name string, chart *chart.
|
||||
return nil, errors.Errorf("release name is invalid: %s", name)
|
||||
}
|
||||
|
||||
// determine dry run behavior
|
||||
// Determine dry run behavior
|
||||
if u.DryRun || u.DryRunOption == "client" || u.DryRunOption == "server" || u.DryRunOption == "true" {
|
||||
u.DryRun = true
|
||||
}
|
||||
@@ -239,7 +239,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// determine whether or not to interact with remote
|
||||
// Determine whether or not to interact with remote
|
||||
var interactWithRemote bool
|
||||
if !u.DryRun || u.DryRunOption == "server" {
|
||||
interactWithRemote = true
|
||||
|
||||
Reference in New Issue
Block a user