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:
[email protected]


Reply via email to