Skip to content

How to create a new namespace in a project using this client? #16

Closed
@JeffreyDD

Description

@JeffreyDD

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:

rancher_namespace = self.rancher_client.create(type='namespace', clusterId=rancher_cluster.id, projectId=rancher_project.id, name=name)
# KeyError: 'namespace'

rancher_cluster = self.rancher_client.by_id_cluster(rancher_project.clusterId);
rancher_namespace = rancher_cluster.namespaces().create()

rancher_namespace = self.rancher_client.create_namespace()

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions