MortalHappiness commented on a change in pull request #588:
URL: https://github.com/apache/submarine/pull/588#discussion_r633101543
##########
File path: submarine-cloud-v2/controller.go
##########
@@ -1134,6 +1136,17 @@ func (c *Controller) syncHandler(workqueueItem
WorkQueueItem) error {
if err != nil {
return err
}
+
+ // Port-forwarding
+ // TODO:
+ // (1) multi-tenant port-forwarding
+ // (2) Basic operations: on/off/modify (change port)
+ // (3) in-cluster
+ if action == ADD {
+ if !incluster {
+ k8sutil.ServicePortForwardPort(context.TODO(),
newNamespace, "traefik", 32080, 80, color.FgGreen)
+ }
+ }
} else { // Case: DELETE
Review comment:
You do not remove the port forward in delete event. So if the submarine
custom resource is deleted and re-create again, some bug will happen.
##########
File path: submarine-cloud-v2/controller.go
##########
@@ -112,6 +115,7 @@ type WorkQueueItem struct {
// NewController returns a new sample controller
func NewController(
+ incluster bool,
Review comment:
Here you pass `incluster` as parameter but not used.
##########
File path: submarine-cloud-v2/controller.go
##########
@@ -1134,6 +1136,17 @@ func (c *Controller) syncHandler(workqueueItem
WorkQueueItem) error {
if err != nil {
return err
}
+
+ // Port-forwarding
+ // TODO:
+ // (1) multi-tenant port-forwarding
+ // (2) Basic operations: on/off/modify (change port)
+ // (3) in-cluster
+ if action == ADD {
+ if !incluster {
Review comment:
Here the `incluster` still works. But the `incluster` here is actually
the global variable in `main.go`. I think what you want to do is to add this
`incluster` as one attribute of `struct Controller` and use it.
##########
File path: submarine-cloud-v2/controller.go
##########
@@ -1134,6 +1136,17 @@ func (c *Controller) syncHandler(workqueueItem
WorkQueueItem) error {
if err != nil {
return err
}
+
+ // Port-forwarding
+ // TODO:
+ // (1) multi-tenant port-forwarding
+ // (2) Basic operations: on/off/modify (change port)
+ // (3) in-cluster
+ if action == ADD {
+ if !incluster {
+ k8sutil.ServicePortForwardPort(context.TODO(),
newNamespace, "traefik", 32080, 80, color.FgGreen)
+ }
+ }
} else { // Case: DELETE
Review comment:
You do not remove the port forward in delete event. So if the submarine
custom resource is deleted and re-created again, some bugs will happen.
--
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]