Skip to content
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

allow the helm deploy to default the namespace value from an environment variable if there is no value in the YAML #496

Closed
jstrachan opened this issue Apr 28, 2018 · 4 comments · Fixed by #497

Comments

@jstrachan
Copy link
Contributor

jstrachan commented Apr 28, 2018

in dev mode its handy to let developers spin up separate namespaces and work on the code and redeploy them without clashing with other developers. i.e. each developer should probably have a separate deploy namespace.

Right now to do this you need each developer to edit the skaffold.yaml file and update the deploy.helm.namespace value to something unique to avoid developers overwriting each other.

It would be nice to be able to define an environment variable, say, SKAFFOLD_DEPLOY_NAMESPACE which if there is no explicit namespace in deploy.helm.namespace then the $SKAFFOLD_DEPLOY_NAMESPACE is used and if thats not available then use the current namespace.

We may want to use separate namespaces for building as deploying. For example; there may be a shared namespace with, say, secrets for pushing to docker registries, dealing with helm repos or downloading artifacts (say, maven) from a maven proxy server etc. So multiple developers can be building in the same namespace; but its common to want to deploy in separate namespaces.

Thats certainly the way its looking for Jenkins X; for building stuff; use a shared team namespace but use separate Preview Environments to deploy code.

So it'd make things easier for developers using Jenkins X if we can point the, say, SKAFFOLD_DEPLOY_NAMESPACE environment variable at each individual developers Development Environment namespace; so that developers don't have to edit any code to avoid clashing

jstrachan added a commit to jstrachan/skaffold that referenced this issue Apr 30, 2018
lets allow an environment variable to be used to define the helm deploy namespace
fixes GoogleContainerTools#496
jstrachan added a commit to jstrachan/skaffold that referenced this issue Apr 30, 2018
lets allow an environment variable to be used to define the helm deploy namespace
fixes GoogleContainerTools#496
@jstrachan
Copy link
Contributor Author

BTW we just got skaffold dev -p dev working great inside a DevPod in Jenkins X! We're using our own temporary patched skaffold binary for now until we can upstream the various PRs

Folks can sync the source code from their laptop to the DevPod via jx sync which uses ksync to do the synchronisation.

In Jenkins X all the DevPods are in the same namespace as the Jenkins and all the CI/CD build pods; so that the RBAC and secrets can be easily shared for using maven/npm/docker registries etc. Though each developer gets their own Edit environment so that the incremental deploys of apps are isolated by default.

@aeweidne
Copy link

aeweidne commented May 1, 2018

I would prefer letting Profiles reference environment variables so that the configuration of the dev tool is transparent to everyone that looks at the file. Just my 2 cents, but I prefer to avoid opaque magic like environment variables taking effect in a configuration file that doesn't reference them.

@afrittoli
Copy link
Contributor

Being able to specify the namespace would be great, having a CLI flag for skaffold run would be nice as well. When running skaffold in CI different namespaces could host deployments for different PR, until such pull requests are merged and the deployment can be deleted.

afrittoli added a commit to afrittoli/skaffold that referenced this issue May 23, 2018
Add a CLI flag "namespace" to the run command to override the
namespace for all helm deployments defined in the pipeline.

Fixes GoogleContainerTools#496
@afrittoli
Copy link
Contributor

I added a PR that allows to override the namespace via CLI.
This only partially helps for the CI case, since the release name must also be different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants