namespaces

package
v0.0.0-...-351f9be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NamespaceGroupVersionResource = schema.GroupVersionResource{
	Group:    "",
	Version:  "v1",
	Resource: "namespaces",
}

NamespaceGroupVersionResource is the required Group Version Resource for accessing namespaces in a cluster, using the dynamic client.

Functions

func ContainerDefaultResourceLimit

func ContainerDefaultResourceLimit(limitsCPU, limitsMemory, requestsCPU, requestsMemory string) string

ContainerDefaultResourceLimit sets the container default resource limit in a string limitsCPU and requestsCPU in form of "3m" limitsMemory and requestsMemory in the form of "3Mi"

func CreateNamespace

func CreateNamespace(client *rancher.Client, clusterID, projectName, namespaceName, containerDefaultResourceLimit string, labels, annotations map[string]string) (*coreV1.Namespace, error)

CreateNamespace is a helper function that uses the dynamic client to create a namespace on a project. It registers a delete function with a wait.WatchWait to ensure the namspace is deleted cleanly.

func GetNamespaceByName

func GetNamespaceByName(client *rancher.Client, clusterID, namespaceName string) (*corev1.Namespace, error)

GetNamespaceByName is a helper function that returns the namespace by name in a specific cluster, uses ListNamespaces to get the namespace.

Types

type NamespaceList

type NamespaceList struct {
	Items []corev1.Namespace
}

NamespaceList is a struct that contains a list of namespaces.

func ListNamespaces

func ListNamespaces(client *rancher.Client, clusterID string, listOpts metav1.ListOptions) (*NamespaceList, error)

ListNamespaces is a helper function that uses the dynamic client to list namespaces in a cluster with its list options.

func (*NamespaceList) Names

func (list *NamespaceList) Names() []string

Names is a method that accepts NamespaceList as a receiver, returns each namespace name in the list as a new slice of strings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL