forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
namespace.go
27 lines (24 loc) · 869 Bytes
/
namespace.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package util
import (
"github.com/openshift/origin/pkg/cmd/util"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Namespace returns the test namespace. The default namespace is set to
// 'integration-test'. You can override it by setting the 'OS_TEST_NAMESPACE'
// environment variable
func Namespace() string {
return util.Env("OS_TEST_NAMESPACE", "integration")
}
// CreateNamespace creates a namespace with the specified name using the provided kubeconfig
// DO NOT USE, use create project instead
func CreateNamespace(clusterAdminKubeConfig, name string) (err error) {
clusterAdminKubeClient, err := GetClusterAdminKubeClient(clusterAdminKubeConfig)
if err != nil {
return err
}
_, err = clusterAdminKubeClient.CoreV1().Namespaces().Create(&corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{Name: name},
})
return err
}