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

Unable to specify project namespace when performing deploy #233

Closed
deewhyweb opened this issue May 31, 2018 · 4 comments · Fixed by #234
Closed

Unable to specify project namespace when performing deploy #233

deewhyweb opened this issue May 31, 2018 · 4 comments · Fixed by #234
Assignees

Comments

@deewhyweb
Copy link

When running "npm run openshift" the build pod is deployed in whichever project is currently active in the local instance of "oc".
This can cause a problem if the user is not currently active in the correct project.

It would be useful to be able to specify the namespace when invoking the nodeshift deploy task

@lholmquist
Copy link
Member

The openshift-config-loader, https://github.com/bucharest-gold/openshift-config-loader , module is the thing that loads your current oc context(which both nodeshift and the openshift-rest-client use).

I don't see why we couldn't add some flag like -n or --namespace where you specify the namespace you want to target, as long as that namespace is already created on the cluster.

I'm specifically not using "project name" since i think we use project name as the name field from your package.json, and that would get confusing. and i think namespace is the thing that the API docs uses anyway

The only problem i could see is if someone specifies a namespace that they cannot access with the user they are logged in as, which is making me think, do we also need the ability to pass in a token, which would bypass the configloader lookup? That is probably another issue.

@deewhyweb
Copy link
Author

A workaround is to add something like this to the start of the openshift script in package.json:

"oc project samplenode && "

I'm presuming "oc" is a pre-req for using nodeshift?

@lholmquist
Copy link
Member

"I'm presuming "oc" is a pre-req for using nodeshift?"

it is, but it isn't.

It isn't using oc behind the scenes or anything. Basically nodeshift, uses the openshift-config-loader, to read your ~/.kube/config(by default), to get your token and current context(namespace).

This config is then passed to the Openshift-rest-client(the part that makes the API calls).

But a custom config object could be passed in or pointed to using the --configLocation flag.

But, if you know you have oc on your path, then yes, that would be a workaround

@lholmquist
Copy link
Member

Looks like -n is already used in nodeshift as an alias of --nodeVersion, so i guess --namespace is the choice

lholmquist added a commit to lholmquist/nodeshift that referenced this issue Jun 1, 2018
This allows the user to specify a namespace project during the build/deploy. Overrides the namespace that the config loader gets

fixes nodeshift#233
lholmquist added a commit to lholmquist/nodeshift that referenced this issue Jun 1, 2018
This allows the user to specify a namespace project during the build/deploy. Overrides the namespace that the config loader gets

fixes nodeshift#233
@ghost ghost added review and removed in progress labels Jun 1, 2018
lholmquist added a commit to lholmquist/nodeshift that referenced this issue Jun 1, 2018
This allows the user to specify a namespace project during the build/deploy. Overwrites any namespace settings in your OpenShift or Kubernetes configuration files

fixes nodeshift#233
lholmquist added a commit that referenced this issue Jun 1, 2018
This allows the user to specify a namespace project during the build/deploy. Overwrites any namespace settings in your OpenShift or Kubernetes configuration files

fixes #233
@ghost ghost removed the review label Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants