Namespace

Provides a Rancher v2 Namespace resource. This can be used to create namespaces for Rancher v2 environments and retrieve their information.

Example Usage

using Pulumi;
using Rancher2 = Pulumi.Rancher2;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new rancher2 Namespace
        var foo = new Rancher2.Namespace("foo", new Rancher2.NamespaceArgs
        {
            ContainerResourceLimit = new Rancher2.Inputs.NamespaceContainerResourceLimitArgs
            {
                LimitsCpu = "20m",
                LimitsMemory = "20Mi",
                RequestsCpu = "1m",
                RequestsMemory = "1Mi",
            },
            Description = "foo namespace",
            ProjectId = "<PROJECT_ID>",
            ResourceQuota = new Rancher2.Inputs.NamespaceResourceQuotaArgs
            {
                Limit = new Rancher2.Inputs.NamespaceResourceQuotaLimitArgs
                {
                    LimitsCpu = "100m",
                    LimitsMemory = "100Mi",
                    RequestsStorage = "1Gi",
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-rancher2/sdk/v3/go/rancher2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := rancher2.NewNamespace(ctx, "foo", &rancher2.NamespaceArgs{
			ContainerResourceLimit: &rancher2.NamespaceContainerResourceLimitArgs{
				LimitsCpu:      pulumi.String("20m"),
				LimitsMemory:   pulumi.String("20Mi"),
				RequestsCpu:    pulumi.String("1m"),
				RequestsMemory: pulumi.String("1Mi"),
			},
			Description: pulumi.String("foo namespace"),
			ProjectId:   pulumi.String("<PROJECT_ID>"),
			ResourceQuota: &rancher2.NamespaceResourceQuotaArgs{
				Limit: &rancher2.NamespaceResourceQuotaLimitArgs{
					LimitsCpu:       pulumi.String("100m"),
					LimitsMemory:    pulumi.String("100Mi"),
					RequestsStorage: pulumi.String("1Gi"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_rancher2 as rancher2

# Create a new rancher2 Namespace
foo = rancher2.Namespace("foo",
    container_resource_limit=rancher2.NamespaceContainerResourceLimitArgs(
        limits_cpu="20m",
        limits_memory="20Mi",
        requests_cpu="1m",
        requests_memory="1Mi",
    ),
    description="foo namespace",
    project_id="<PROJECT_ID>",
    resource_quota=rancher2.NamespaceResourceQuotaArgs(
        limit=rancher2.NamespaceResourceQuotaLimitArgs(
            limits_cpu="100m",
            limits_memory="100Mi",
            requests_storage="1Gi",
        ),
    ))
import * as pulumi from "@pulumi/pulumi";
import * as rancher2 from "@pulumi/rancher2";

// Create a new rancher2 Namespace
const foo = new rancher2.Namespace("foo", {
    containerResourceLimit: {
        limitsCpu: "20m",
        limitsMemory: "20Mi",
        requestsCpu: "1m",
        requestsMemory: "1Mi",
    },
    description: "foo namespace",
    projectId: "<PROJECT_ID>",
    resourceQuota: {
        limit: {
            limitsCpu: "100m",
            limitsMemory: "100Mi",
            requestsStorage: "1Gi",
        },
    },
});

Create a Namespace Resource

new Namespace(name: string, args: NamespaceArgs, opts?: CustomResourceOptions);
@overload
def Namespace(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              annotations: Optional[Mapping[str, Any]] = None,
              container_resource_limit: Optional[NamespaceContainerResourceLimitArgs] = None,
              description: Optional[str] = None,
              labels: Optional[Mapping[str, Any]] = None,
              name: Optional[str] = None,
              project_id: Optional[str] = None,
              resource_quota: Optional[NamespaceResourceQuotaArgs] = None,
              wait_for_cluster: Optional[bool] = None)
@overload
def Namespace(resource_name: str,
              args: NamespaceArgs,
              opts: Optional[ResourceOptions] = None)
func NewNamespace(ctx *Context, name string, args NamespaceArgs, opts ...ResourceOption) (*Namespace, error)
public Namespace(string name, NamespaceArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args NamespaceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args NamespaceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NamespaceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NamespaceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Namespace Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Namespace resource accepts the following input properties:

ProjectId string
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
Annotations Dictionary<string, object>
Annotations for Node Pool object (map)
ContainerResourceLimit NamespaceContainerResourceLimitArgs
Default containers resource limits on namespace (List maxitem:1)
Description string
A namespace description (string)
Labels Dictionary<string, object>
Labels for Node Pool object (map)
Name string
The name of the namespace (string)
ResourceQuota NamespaceResourceQuotaArgs
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
WaitForCluster bool
Wait for cluster becomes active. Default false (bool)
ProjectId string
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
Annotations map[string]interface{}
Annotations for Node Pool object (map)
ContainerResourceLimit NamespaceContainerResourceLimit
Default containers resource limits on namespace (List maxitem:1)
Description string
A namespace description (string)
Labels map[string]interface{}
Labels for Node Pool object (map)
Name string
The name of the namespace (string)
ResourceQuota NamespaceResourceQuota
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
WaitForCluster bool
Wait for cluster becomes active. Default false (bool)
projectId string
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
annotations {[key: string]: any}
Annotations for Node Pool object (map)
containerResourceLimit NamespaceContainerResourceLimitArgs
Default containers resource limits on namespace (List maxitem:1)
description string
A namespace description (string)
labels {[key: string]: any}
Labels for Node Pool object (map)
name string
The name of the namespace (string)
resourceQuota NamespaceResourceQuotaArgs
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
waitForCluster boolean
Wait for cluster becomes active. Default false (bool)
project_id str
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
annotations Mapping[str, Any]
Annotations for Node Pool object (map)
container_resource_limit NamespaceContainerResourceLimitArgs
Default containers resource limits on namespace (List maxitem:1)
description str
A namespace description (string)
labels Mapping[str, Any]
Labels for Node Pool object (map)
name str
The name of the namespace (string)
resource_quota NamespaceResourceQuotaArgs
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
wait_for_cluster bool
Wait for cluster becomes active. Default false (bool)

Outputs

All input properties are implicitly available as output properties. Additionally, the Namespace resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Namespace Resource

Get an existing Namespace resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NamespaceState, opts?: CustomResourceOptions): Namespace
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        annotations: Optional[Mapping[str, Any]] = None,
        container_resource_limit: Optional[NamespaceContainerResourceLimitArgs] = None,
        description: Optional[str] = None,
        labels: Optional[Mapping[str, Any]] = None,
        name: Optional[str] = None,
        project_id: Optional[str] = None,
        resource_quota: Optional[NamespaceResourceQuotaArgs] = None,
        wait_for_cluster: Optional[bool] = None) -> Namespace
func GetNamespace(ctx *Context, name string, id IDInput, state *NamespaceState, opts ...ResourceOption) (*Namespace, error)
public static Namespace Get(string name, Input<string> id, NamespaceState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Annotations Dictionary<string, object>
Annotations for Node Pool object (map)
ContainerResourceLimit NamespaceContainerResourceLimitArgs
Default containers resource limits on namespace (List maxitem:1)
Description string
A namespace description (string)
Labels Dictionary<string, object>
Labels for Node Pool object (map)
Name string
The name of the namespace (string)
ProjectId string
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
ResourceQuota NamespaceResourceQuotaArgs
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
WaitForCluster bool
Wait for cluster becomes active. Default false (bool)
Annotations map[string]interface{}
Annotations for Node Pool object (map)
ContainerResourceLimit NamespaceContainerResourceLimit
Default containers resource limits on namespace (List maxitem:1)
Description string
A namespace description (string)
Labels map[string]interface{}
Labels for Node Pool object (map)
Name string
The name of the namespace (string)
ProjectId string
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
ResourceQuota NamespaceResourceQuota
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
WaitForCluster bool
Wait for cluster becomes active. Default false (bool)
annotations {[key: string]: any}
Annotations for Node Pool object (map)
containerResourceLimit NamespaceContainerResourceLimitArgs
Default containers resource limits on namespace (List maxitem:1)
description string
A namespace description (string)
labels {[key: string]: any}
Labels for Node Pool object (map)
name string
The name of the namespace (string)
projectId string
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
resourceQuota NamespaceResourceQuotaArgs
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
waitForCluster boolean
Wait for cluster becomes active. Default false (bool)
annotations Mapping[str, Any]
Annotations for Node Pool object (map)
container_resource_limit NamespaceContainerResourceLimitArgs
Default containers resource limits on namespace (List maxitem:1)
description str
A namespace description (string)
labels Mapping[str, Any]
Labels for Node Pool object (map)
name str
The name of the namespace (string)
project_id str
The project id where assign namespace. It’s on the form project_id=<cluster_id>:<id>. Updating <id> part on same <cluster_id> namespace will be moved between projects (string)
resource_quota NamespaceResourceQuotaArgs
Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
wait_for_cluster bool
Wait for cluster becomes active. Default false (bool)

Supporting Types

NamespaceContainerResourceLimit

LimitsCpu string
Limit for limits cpu in namespace (string)
LimitsMemory string
Limit for limits memory in namespace (string)
RequestsCpu string
Limit for requests cpu in namespace (string)
RequestsMemory string
Limit for requests memory in namespace (string)
LimitsCpu string
Limit for limits cpu in namespace (string)
LimitsMemory string
Limit for limits memory in namespace (string)
RequestsCpu string
Limit for requests cpu in namespace (string)
RequestsMemory string
Limit for requests memory in namespace (string)
limitsCpu string
Limit for limits cpu in namespace (string)
limitsMemory string
Limit for limits memory in namespace (string)
requestsCpu string
Limit for requests cpu in namespace (string)
requestsMemory string
Limit for requests memory in namespace (string)
limits_cpu str
Limit for limits cpu in namespace (string)
limits_memory str
Limit for limits memory in namespace (string)
requests_cpu str
Limit for requests cpu in namespace (string)
requests_memory str
Limit for requests memory in namespace (string)

NamespaceResourceQuota

Limit NamespaceResourceQuotaLimitArgs
Resource quota limit for namespace (list maxitems:1)
Limit NamespaceResourceQuotaLimit
Resource quota limit for namespace (list maxitems:1)
limit NamespaceResourceQuotaLimitArgs
Resource quota limit for namespace (list maxitems:1)
limit NamespaceResourceQuotaLimitArgs
Resource quota limit for namespace (list maxitems:1)

NamespaceResourceQuotaLimit

ConfigMaps string
Limit for config maps in namespace (string)
LimitsCpu string
Limit for limits cpu in namespace (string)
LimitsMemory string
Limit for limits memory in namespace (string)
PersistentVolumeClaims string
Limit for persistent volume claims in namespace (string)
Pods string
Limit for pods in namespace (string)
ReplicationControllers string
Limit for replication controllers in namespace (string)
RequestsCpu string
Limit for requests cpu in namespace (string)
RequestsMemory string
Limit for requests memory in namespace (string)
RequestsStorage string
Limit for requests storage in namespace (string)
Secrets string
Limit for secrets in namespace (string)
Services string
ServicesLoadBalancers string
Limit for services load balancers in namespace (string)
ServicesNodePorts string
Limit for services node ports in namespace (string)
ConfigMaps string
Limit for config maps in namespace (string)
LimitsCpu string
Limit for limits cpu in namespace (string)
LimitsMemory string
Limit for limits memory in namespace (string)
PersistentVolumeClaims string
Limit for persistent volume claims in namespace (string)
Pods string
Limit for pods in namespace (string)
ReplicationControllers string
Limit for replication controllers in namespace (string)
RequestsCpu string
Limit for requests cpu in namespace (string)
RequestsMemory string
Limit for requests memory in namespace (string)
RequestsStorage string
Limit for requests storage in namespace (string)
Secrets string
Limit for secrets in namespace (string)
Services string
ServicesLoadBalancers string
Limit for services load balancers in namespace (string)
ServicesNodePorts string
Limit for services node ports in namespace (string)
configMaps string
Limit for config maps in namespace (string)
limitsCpu string
Limit for limits cpu in namespace (string)
limitsMemory string
Limit for limits memory in namespace (string)
persistentVolumeClaims string
Limit for persistent volume claims in namespace (string)
pods string
Limit for pods in namespace (string)
replicationControllers string
Limit for replication controllers in namespace (string)
requestsCpu string
Limit for requests cpu in namespace (string)
requestsMemory string
Limit for requests memory in namespace (string)
requestsStorage string
Limit for requests storage in namespace (string)
secrets string
Limit for secrets in namespace (string)
services string
servicesLoadBalancers string
Limit for services load balancers in namespace (string)
servicesNodePorts string
Limit for services node ports in namespace (string)
config_maps str
Limit for config maps in namespace (string)
limits_cpu str
Limit for limits cpu in namespace (string)
limits_memory str
Limit for limits memory in namespace (string)
persistent_volume_claims str
Limit for persistent volume claims in namespace (string)
pods str
Limit for pods in namespace (string)
replication_controllers str
Limit for replication controllers in namespace (string)
requests_cpu str
Limit for requests cpu in namespace (string)
requests_memory str
Limit for requests memory in namespace (string)
requests_storage str
Limit for requests storage in namespace (string)
secrets str
Limit for secrets in namespace (string)
services str
services_load_balancers str
Limit for services load balancers in namespace (string)
services_node_ports str
Limit for services node ports in namespace (string)

Import

Namespaces can be imported using the namespace ID in the format <project_id>.<namespace_id>

 $ pulumi import rancher2:index/namespace:Namespace foo &lt;project_id&gt;.&lt;namespaces_id&gt;

<project_id> is in the format <cluster_id>:<id>, but part is optional:

  • If full project_id is provided, <project_id>=<cluster_id>:<id>, the namespace’ll be assigned to corresponding cluster project once it’s imported.

  • If <id> part is omitted <project_id>=<cluster_id>, the namespace’ll not be assigned to any project. To move it into a project, <project_id>=<cluster_id>:<id> needs to be updated in tf file. Namespace movement is only supported inside same cluster_id.

Package Details

Repository
https://github.com/pulumi/pulumi-rancher2
License
Apache-2.0
Notes
This Pulumi package is based on the rancher2 Terraform Provider.