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/v2/go/rancher2"
"github.com/pulumi/pulumi/sdk/v2/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);
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)
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.
- opts ResourceOptions
- A bag of options that control this 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:
- Project
Id 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)
- Container
Resource NamespaceLimit Container Resource Limit Args 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)
- Resource
Quota NamespaceResource Quota Args Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- Wait
For boolCluster Wait for cluster becomes active. Default
false
(bool)
- Project
Id 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)
- Container
Resource NamespaceLimit Container Resource Limit 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)
- Resource
Quota NamespaceResource Quota Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- Wait
For boolCluster Wait for cluster becomes active. Default
false
(bool)
- project
Id 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)
- container
Resource NamespaceLimit Container Resource Limit 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)
- resource
Quota NamespaceResource Quota Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- wait
For booleanCluster 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_ Namespacelimit Container Resource Limit Args 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 NamespaceResource Quota Args Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- wait_
for_ boolcluster 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)
- Container
Resource NamespaceLimit Container Resource Limit Args 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)
- Project
Id 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)- Resource
Quota NamespaceResource Quota Args Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- Wait
For boolCluster Wait for cluster becomes active. Default
false
(bool)
- Annotations map[string]interface{}
Annotations for Node Pool object (map)
- Container
Resource NamespaceLimit Container Resource Limit 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)
- Project
Id 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)- Resource
Quota NamespaceResource Quota Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- Wait
For boolCluster Wait for cluster becomes active. Default
false
(bool)
- annotations {[key: string]: any}
Annotations for Node Pool object (map)
- container
Resource NamespaceLimit Container Resource Limit 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)
- project
Id 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)- resource
Quota NamespaceResource Quota Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- wait
For booleanCluster Wait for cluster becomes active. Default
false
(bool)
- annotations Mapping[str, Any]
Annotations for Node Pool object (map)
- container_
resource_ Namespacelimit Container Resource Limit Args 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 NamespaceResource Quota Args Resource quota for namespace. Rancher v2.1.x or higher (list maxitems:1)
- wait_
for_ boolcluster Wait for cluster becomes active. Default
false
(bool)
Supporting Types
NamespaceContainerResourceLimit
- Limits
Cpu string Limit for limits cpu in namespace (string)
- Limits
Memory string Limit for limits memory in namespace (string)
- Requests
Cpu string Limit for requests cpu in namespace (string)
- Requests
Memory string Limit for requests memory in namespace (string)
- Limits
Cpu string Limit for limits cpu in namespace (string)
- Limits
Memory string Limit for limits memory in namespace (string)
- Requests
Cpu string Limit for requests cpu in namespace (string)
- Requests
Memory string Limit for requests memory in namespace (string)
- limits
Cpu string Limit for limits cpu in namespace (string)
- limits
Memory string Limit for limits memory in namespace (string)
- requests
Cpu string Limit for requests cpu in namespace (string)
- requests
Memory 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
Namespace
Resource Quota Limit Args Resource quota limit for namespace (list maxitems:1)
- Limit
Namespace
Resource Quota Limit Resource quota limit for namespace (list maxitems:1)
- limit
Namespace
Resource Quota Limit Resource quota limit for namespace (list maxitems:1)
- limit
Namespace
Resource Quota Limit Args Resource quota limit for namespace (list maxitems:1)
NamespaceResourceQuotaLimit
- Config
Maps string Limit for config maps in namespace (string)
- Limits
Cpu string Limit for limits cpu in namespace (string)
- Limits
Memory string Limit for limits memory in namespace (string)
- Persistent
Volume stringClaims Limit for persistent volume claims in namespace (string)
- Pods string
Limit for pods in namespace (string)
- Replication
Controllers string Limit for replication controllers in namespace (string)
- Requests
Cpu string Limit for requests cpu in namespace (string)
- Requests
Memory string Limit for requests memory in namespace (string)
- Requests
Storage string Limit for requests storage in namespace (string)
- Secrets string
Limit for secrets in namespace (string)
- Services string
- Services
Load stringBalancers Limit for services load balancers in namespace (string)
- Services
Node stringPorts Limit for services node ports in namespace (string)
- Config
Maps string Limit for config maps in namespace (string)
- Limits
Cpu string Limit for limits cpu in namespace (string)
- Limits
Memory string Limit for limits memory in namespace (string)
- Persistent
Volume stringClaims Limit for persistent volume claims in namespace (string)
- Pods string
Limit for pods in namespace (string)
- Replication
Controllers string Limit for replication controllers in namespace (string)
- Requests
Cpu string Limit for requests cpu in namespace (string)
- Requests
Memory string Limit for requests memory in namespace (string)
- Requests
Storage string Limit for requests storage in namespace (string)
- Secrets string
Limit for secrets in namespace (string)
- Services string
- Services
Load stringBalancers Limit for services load balancers in namespace (string)
- Services
Node stringPorts Limit for services node ports in namespace (string)
- config
Maps string Limit for config maps in namespace (string)
- limits
Cpu string Limit for limits cpu in namespace (string)
- limits
Memory string Limit for limits memory in namespace (string)
- persistent
Volume stringClaims Limit for persistent volume claims in namespace (string)
- pods string
Limit for pods in namespace (string)
- replication
Controllers string Limit for replication controllers in namespace (string)
- requests
Cpu string Limit for requests cpu in namespace (string)
- requests
Memory string Limit for requests memory in namespace (string)
- requests
Storage string Limit for requests storage in namespace (string)
- secrets string
Limit for secrets in namespace (string)
- services string
- services
Load stringBalancers Limit for services load balancers in namespace (string)
- services
Node stringPorts 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_ strclaims 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_ strbalancers Limit for services load balancers in namespace (string)
- services_
node_ strports 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 <project_id>.<namespaces_id>
<project_id>
is in the format <cluster_id>:<id>
, but
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 samecluster_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.