MCPcopy Create free account
hub / github.com/devspace-sh/devspace / CreateNamespace

Method CreateNamespace

e2e/kube/kube.go:80–92  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

78}
79
80func (k *KubeHelper) CreateNamespace(name string) (string, error) {
81 name = strings.ToLower(name + "-" + randutil.GenerateRandomString(5))
82 _, err := k.client.KubeClient().CoreV1().Namespaces().Create(context.TODO(), &corev1.Namespace{
83 ObjectMeta: metav1.ObjectMeta{
84 Name: name,
85 },
86 }, metav1.CreateOptions{})
87 if err != nil && !kerrors.IsAlreadyExists(err) {
88 return "", err
89 }
90
91 return name, nil
92}
93
94func (k *KubeHelper) DeleteNamespace(name string) error {
95 err := k.client.KubeClient().CoreV1().Namespaces().Delete(context.TODO(), name, metav1.DeleteOptions{})

Callers 15

deploy.goFile · 0.80
init.goFile · 0.80
inject.goFile · 0.80
pullsecrets.goFile · 0.80
proxycommands.goFile · 0.80
terminal.goFile · 0.80
portforward.goFile · 0.80
imports.goFile · 0.80
localregistry.goFile · 0.80
ssh.goFile · 0.80
pipelines.goFile · 0.80
replacepods.goFile · 0.80

Calls 2

GenerateRandomStringFunction · 0.92
KubeClientMethod · 0.65

Tested by

no test coverage detected