Skip to content

fix: allow an environment variable to default the deploy namespace #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pkg/skaffold/deploy/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"io"
"os"
"os/exec"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build"
Expand Down Expand Up @@ -106,8 +107,12 @@ func (h *HelmDeployer) deployRelease(out io.Writer, r v1alpha2.HelmRelease, b *b
args = append(args, "upgrade", r.Name, r.ChartPath)
}

if r.Namespace != "" {
args = append(args, "--namespace", r.Namespace)
ns := r.Namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to map the cli arguments to env variables? I think there is. It would be much better to handle that once for all when CLI arguments are parsed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point yeah; in this case we're merging default values from the CLI / env var overriding any missing values in the skaffold.yaml

if ns == "" {
ns = os.Getenv("SKAFFOLD_DEPLOY_NAMESPACE")
}
if ns != "" {
args = append(args, "--namespace", ns)
}
if r.ValuesFilePath != "" {
args = append(args, "-f", r.ValuesFilePath)
Expand Down