Sfoglia il codice sorgente

update create namespace

Alexander Belanger 4 anni fa
parent
commit
9930999893
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      internal/kubernetes/agent.go

+ 2 - 2
internal/kubernetes/agent.go

@@ -250,13 +250,13 @@ func (a *Agent) ListNamespaces() (*v1.NamespaceList, error) {
 // CreateNamespace creates a namespace with the given name.
 // CreateNamespace creates a namespace with the given name.
 func (a *Agent) CreateNamespace(name string) (*v1.Namespace, error) {
 func (a *Agent) CreateNamespace(name string) (*v1.Namespace, error) {
 	// check if namespace exists
 	// check if namespace exists
-	checkNS, _ := a.Clientset.CoreV1().Namespaces().Get(
+	checkNS, err := a.Clientset.CoreV1().Namespaces().Get(
 		context.TODO(),
 		context.TODO(),
 		name,
 		name,
 		metav1.GetOptions{},
 		metav1.GetOptions{},
 	)
 	)
 
 
-	if checkNS != nil {
+	if err == nil && checkNS != nil {
 		return checkNS, nil
 		return checkNS, nil
 	}
 	}