You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2021/05/13 09:07:39 UTC

[GitHub] [submarine] kevin85421 commented on a change in pull request #586: SUBMARINE 819. Create namespace for single user

kevin85421 commented on a change in pull request #586:
URL: https://github.com/apache/submarine/pull/586#discussion_r631670381



##########
File path: submarine-cloud-v2/controller.go
##########
@@ -1134,21 +1142,28 @@ func (c *Controller) syncHandler(workqueueItem WorkQueueItem) error {
 		c.charts = nil
 
 		// Delete namespace: Delete all namespaced resources, ex: POD, Deployment, ... etc.
+		err = c.kubeclientset.CoreV1().Namespaces().Delete(context.TODO(), newNamespace, metav1.DeleteOptions{})
+		if err != nil {
+			return err
+		}
+		klog.Info("Delete Namespace: ", newNamespace)
+
 		err = c.kubeclientset.CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{})
 		if err != nil {
 			return err
 		}
+		klog.Info("Delete Namespace: ", namespace)

Review comment:
       These lines can be removed.

##########
File path: submarine-cloud-v2/controller.go
##########
@@ -1134,21 +1142,28 @@ func (c *Controller) syncHandler(workqueueItem WorkQueueItem) error {
 		c.charts = nil
 
 		// Delete namespace: Delete all namespaced resources, ex: POD, Deployment, ... etc.
+		err = c.kubeclientset.CoreV1().Namespaces().Delete(context.TODO(), newNamespace, metav1.DeleteOptions{})
+		if err != nil {
+			return err
+		}
+		klog.Info("Delete Namespace: ", newNamespace)
+
 		err = c.kubeclientset.CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{})
 		if err != nil {
 			return err
 		}
+		klog.Info("Delete Namespace: ", namespace)
 
-		// Delete non-namespaced resources (ex: PersistentVolume)
-		err = c.kubeclientset.CoreV1().PersistentVolumes().Delete(context.TODO(), "submarine-database-pv--"+namespace, metav1.DeleteOptions{})
+		err = c.kubeclientset.CoreV1().PersistentVolumes().Delete(context.TODO(), "submarine-database-pv--"+newNamespace, metav1.DeleteOptions{})
 		if err != nil {
 			return err
 		}
 
-		err = c.kubeclientset.CoreV1().PersistentVolumes().Delete(context.TODO(), "submarine-tensorboard-pv--"+namespace, metav1.DeleteOptions{})
+		err = c.kubeclientset.CoreV1().PersistentVolumes().Delete(context.TODO(), "submarine-tensorboard-pv--"+newNamespace, metav1.DeleteOptions{})
 		if err != nil {
 			return err
 		}
+		klog.Info("Delete pv")

Review comment:
       This line can be removed.

##########
File path: submarine-cloud-v2/main.go
##########
@@ -19,17 +19,18 @@ package main
 
 import (
 	"flag"
-	kubeinformers "k8s.io/client-go/informers"
-	"k8s.io/client-go/kubernetes"
-	"k8s.io/client-go/rest"
-	"k8s.io/client-go/tools/clientcmd"
-	"k8s.io/klog/v2"

Review comment:
       Why do we change these lines? My code formatter `gofmt` does not change these lines.

##########
File path: submarine-cloud-v2/controller.go
##########
@@ -1134,21 +1142,28 @@ func (c *Controller) syncHandler(workqueueItem WorkQueueItem) error {
 		c.charts = nil
 
 		// Delete namespace: Delete all namespaced resources, ex: POD, Deployment, ... etc.
+		err = c.kubeclientset.CoreV1().Namespaces().Delete(context.TODO(), newNamespace, metav1.DeleteOptions{})
+		if err != nil {
+			return err
+		}
+		klog.Info("Delete Namespace: ", newNamespace)
+
 		err = c.kubeclientset.CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{})
 		if err != nil {
 			return err
 		}
+		klog.Info("Delete Namespace: ", namespace)
 
-		// Delete non-namespaced resources (ex: PersistentVolume)

Review comment:
       This line is very important. Do not remove it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org