-
Notifications
You must be signed in to change notification settings - Fork 32
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
How to create a new namespace in a project using this client? #16
Comments
Hi @JeffreyDD , I see that it isn't very straight forward to create a I have found that the create function, which is only available at the root, has access to some sort of types schema: Lines 433 to 435 in c357e7a
(for a complete list of types, try piece of python: You would expect However, in that same block you see how the Post method is build up, to get an understanding of what information could be provided as data you can explore the API trough the Rancher GUI (e.g. https:///v3/cluster//namespaces --> Create Operation). I came up with the following: cluster = client.by_id_cluster('c-6lhz6')
namespaces=cluster.namespaces()
client._post(namespaces.createTypes[namespaces.resourceType],data={'name':'new','projectId':'c-6lhz6:p-xvqq2'}) That created a namespace named 'new' in my 'default' project, whereas off-course the id's will differ in your case. |
It looks like this is answered so going to close this issue, if not feel free to reopen |
Based on what @rule88 said, I´ve found this:
The trick is connect the client to the right api url, on which the namespace object type exists Hope this help others like me trying to use the python client. |
I'm trying to create a namespace inside a project, but have not been able to find the proper method to do so. I have been able to create projects, apply actions, but I can't seem to find any way to create a namespace, either as an action on a project or cluster, nor using
client.create
.I'm using the master branch of this client with rancher API version 3
Some of the things I've tried so far:
I've noticed that namespaces are managed as a subresource of
clusters
, and are accessible through the API as such (rancher_namespace = self.rancher_client.
), but how can I get these through this client? I've read through the source code and can't seem to find any way to accomplish this, can someone maybe point me in the right direction?The text was updated successfully, but these errors were encountered: