Skip to content

Commit

Permalink
Add a namespace parameter for Helm charts. (#160)
Browse files Browse the repository at this point in the history
This corresponds to the `--namespace` arg to `helm template`.
  • Loading branch information
pgavlin authored Aug 23, 2018
1 parent 7016a8a commit 6eb05e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pack/nodejs/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export namespace v2 {
chart: string;
version: string;

namespace?: string;
values?: any;
transformations?: ((o: any) => void)[];
fetchOpts?: FetchOpts;
Expand Down Expand Up @@ -59,8 +60,9 @@ export namespace v2 {
const chart = `${shell.quote([chartDir.name])}/${shell.quote([config.chart])}`;
const release = shell.quote([releaseName]);
const values = shell.quote([overrides.name]);
const namespaceArg = config.namespace ? `--namespace ${shell.quote([config.namespace])}` : "";
const yamlStream = execSync(
`helm template ${chart} --name ${release} --values ${values}`
`helm template ${chart} --name ${release} --values ${values} ${namespaceArg}`
).toString();
this.resources = k8s.yaml.parse({
yaml: [yamlStream],
Expand Down
4 changes: 3 additions & 1 deletion pkg/gen/node-templates/helm.ts.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export namespace v2 {
chart: string;
version: string;
namespace?: string;
values?: any;
transformations?: ((o: any) => void)[];
fetchOpts?: FetchOpts;
Expand Down Expand Up @@ -59,8 +60,9 @@ export namespace v2 {
const chart = `${shell.quote([chartDir.name])}/${shell.quote([config.chart])}`;
const release = shell.quote([releaseName]);
const values = shell.quote([overrides.name]);
const namespaceArg = config.namespace ? `--namespace ${shell.quote([config.namespace])}` : "";
const yamlStream = execSync(
`helm template ${chart} --name ${release} --values ${values}`
`helm template ${chart} --name ${release} --values ${values} ${namespaceArg}`
).toString();
this.resources = k8s.yaml.parse({
yaml: [yamlStream],
Expand Down

0 comments on commit 6eb05e6

Please sign in to comment.