Skip to content

Commit

Permalink
fix(render): support for --kube-context param when --validate option …
Browse files Browse the repository at this point in the history
…used

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed May 23, 2022
1 parent 04a2045 commit 91869a8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmd/werf/render/render.go
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/spf13/cobra"
helm_v3 "helm.sh/helm/v3/cmd/helm"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli/values"
Expand All @@ -19,7 +18,6 @@ import (
"github.com/werf/werf/cmd/werf/common"
"github.com/werf/werf/pkg/build"
"github.com/werf/werf/pkg/config/deploy_params"
"github.com/werf/werf/pkg/deploy/helm"
"github.com/werf/werf/pkg/deploy/helm/chart_extender"
"github.com/werf/werf/pkg/deploy/helm/chart_extender/helpers"
"github.com/werf/werf/pkg/deploy/secrets_manager"
Expand Down Expand Up @@ -96,6 +94,14 @@ func NewCmd() *cobra.Command {
common.SetupRepoOptions(&commonCmdData, cmd, common.RepoDataOptions{OptionalRepo: true})
common.SetupFinalRepo(&commonCmdData, cmd)

common.SetupKubeConfig(&commonCmdData, cmd)
common.SetupKubeConfigBase64(&commonCmdData, cmd)
common.SetupKubeContext(&commonCmdData, cmd)

common.SetupStatusProgressPeriod(&commonCmdData, cmd)
common.SetupHooksStatusProgressPeriod(&commonCmdData, cmd)
common.SetupReleasesHistoryMax(&commonCmdData, cmd)

common.SetupDockerConfig(&commonCmdData, cmd, "Command needs granted permissions to read, pull and push images into the specified repo and to pull base images")
common.SetupInsecureRegistry(&commonCmdData, cmd)
common.SetupInsecureHelmDependencies(&commonCmdData, cmd)
Expand Down Expand Up @@ -210,6 +216,8 @@ func runRender(ctx context.Context) error {
}
}()

common.SetupOndemandKubeInitializer(*commonCmdData.KubeContext, *commonCmdData.KubeConfig, *commonCmdData.KubeConfigBase64, *commonCmdData.KubeConfigPathMergeList)

namespace, err := deploy_params.GetKubernetesNamespace(*commonCmdData.Namespace, *commonCmdData.Environment, werfConfig)
if err != nil {
return err
Expand Down Expand Up @@ -379,8 +387,8 @@ func runRender(ctx context.Context) error {
wc.SetServiceValues(vals)
}

actionConfig := new(action.Configuration)
if err := helm.InitActionConfig(ctx, nil, namespace, helm_v3.Settings, helmRegistryClientHandler, actionConfig, helm.InitActionConfigOptions{}); err != nil {
actionConfig, err := common.NewActionConfig(ctx, common.GetOndemandKubeInitializer(), namespace, &commonCmdData, helmRegistryClientHandler)
if err != nil {
return err
}

Expand Down

0 comments on commit 91869a8

Please sign in to comment.