You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/13 15:26:33 UTC

[GitHub] [apisix-ingress-controller] gxthrj opened a new pull request #680: WIP: add full compare when ingress startup

gxthrj opened a new pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [x] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   - Related issues
   #587 
   
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r710607607



##########
File path: utils/kind-with-registry.sh
##########
@@ -54,7 +54,7 @@ fi
 echo "Registry Host: ${reg_host}"
 
 # create a cluster with the local registry enabled in containerd
-cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --config=-
+cat <<EOF | kind create cluster --image kindest/node:v1.21.2 --name "${KIND_CLUSTER_NAME}" --config=-

Review comment:
       I added it in my env for installation. This is not the feature of this PR. 
   Will add another PR for this.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r710610390



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)

Review comment:
       the variable `*A6` has changed to `map[string]string`, but keep `*K8S` using `sync.Map`.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj merged pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj merged pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680


   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r710613079



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			wns := make(map[string]struct{}, len(nsList.Items))
+			for _, v := range nsList.Items {
+				wns[v.Name] = struct{}{}
+			}
+			c.watchingNamespace = wns
+		}
+	}
+	for ns := range c.watchingNamespace {
+		// ApisixRoute
+		opts := v1.ListOptions{}
+		retRoutes, err := c.kubeClient.APISIXClient.ApisixV2beta1().ApisixRoutes(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, r := range retRoutes.Items {
+				tc, err := c.translator.TranslateRouteV2beta1NotStrictly(&r)
+				if err != nil {
+					panic(err)
+				} else {
+					// routes
+					for _, route := range tc.Routes {
+						routeMapK8S.Store(route.ID, route.ID)
+					}
+					// streamRoutes
+					for _, stRoute := range tc.StreamRoutes {
+						streamRouteMapK8S.Store(stRoute.ID, stRoute.ID)
+					}
+					// upstreams
+					for _, upstream := range tc.Upstreams {
+						upstreamMapK8S.Store(upstream.ID, upstream.ID)
+					}
+					// ssl
+					for _, ssl := range tc.SSL {
+						sslMapK8S.Store(ssl.ID, ssl.ID)
+					}
+				}
+			}
+		}
+		// todo ApisixUpstream
+		// ApisixUpstream should be synced with ApisixRoute resource
+
+		// ApisixSSL
+		retSSL, err := c.kubeClient.APISIXClient.ApisixV1().ApisixTlses(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, s := range retSSL.Items {
+				ssl, err := c.translator.TranslateSSL(&s)
+				if err != nil {
+					panic(err)
+				} else {
+					sslMapK8S.Store(ssl.ID, ssl.ID)
+				}
+			}
+		}
+		// ApisixConsumer
+		retConsumer, err := c.kubeClient.APISIXClient.ApisixV2alpha1().ApisixConsumers(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, con := range retConsumer.Items {
+				consumer, err := c.translator.TranslateApisixConsumer(&con)
+				if err != nil {
+					panic(err)
+				} else {
+					consumerMapK8S.Store(consumer.Username, consumer.Username)
+				}
+			}
+		}
+	}
+
+	// 2.get all cache routes
+	c.listRouteCache(routeMapA6)

Review comment:
       That is because the cache has been verified before. cc https://github.com/apache/apisix-ingress-controller/blob/master/pkg/ingress/controller.go#L389 




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r708768142



##########
File path: utils/kind-with-registry.sh
##########
@@ -54,7 +54,7 @@ fi
 echo "Registry Host: ${reg_host}"
 
 # create a cluster with the local registry enabled in containerd
-cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --config=-
+cat <<EOF | kind create cluster --image kindest/node:v1.21.2 --name "${KIND_CLUSTER_NAME}" --config=-

Review comment:
       Version should be set as configurable.

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)

Review comment:
       Panic here is not so friendly. We may just retry the comparison, as it's meaningless for the Ingress controller to skip the comparison and go ahead if the communication with Kubernetes is broken.

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			wns := make(map[string]struct{}, len(nsList.Items))
+			for _, v := range nsList.Items {
+				wns[v.Name] = struct{}{}
+			}
+			c.watchingNamespace = wns
+		}
+	}
+	for ns := range c.watchingNamespace {
+		// ApisixRoute
+		opts := v1.ListOptions{}
+		retRoutes, err := c.kubeClient.APISIXClient.ApisixV2beta1().ApisixRoutes(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, r := range retRoutes.Items {
+				tc, err := c.translator.TranslateRouteV2beta1NotStrictly(&r)
+				if err != nil {
+					panic(err)
+				} else {
+					// routes
+					for _, route := range tc.Routes {
+						routeMapK8S.Store(route.ID, route.ID)
+					}
+					// streamRoutes
+					for _, stRoute := range tc.StreamRoutes {
+						streamRouteMapK8S.Store(stRoute.ID, stRoute.ID)
+					}
+					// upstreams
+					for _, upstream := range tc.Upstreams {
+						upstreamMapK8S.Store(upstream.ID, upstream.ID)
+					}
+					// ssl
+					for _, ssl := range tc.SSL {
+						sslMapK8S.Store(ssl.ID, ssl.ID)
+					}
+				}
+			}
+		}
+		// todo ApisixUpstream
+		// ApisixUpstream should be synced with ApisixRoute resource
+
+		// ApisixSSL
+		retSSL, err := c.kubeClient.APISIXClient.ApisixV1().ApisixTlses(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, s := range retSSL.Items {
+				ssl, err := c.translator.TranslateSSL(&s)
+				if err != nil {
+					panic(err)
+				} else {
+					sslMapK8S.Store(ssl.ID, ssl.ID)
+				}
+			}
+		}
+		// ApisixConsumer
+		retConsumer, err := c.kubeClient.APISIXClient.ApisixV2alpha1().ApisixConsumers(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, con := range retConsumer.Items {
+				consumer, err := c.translator.TranslateApisixConsumer(&con)
+				if err != nil {
+					panic(err)
+				} else {
+					consumerMapK8S.Store(consumer.Username, consumer.Username)
+				}
+			}
+		}
+	}
+
+	// 2.get all cache routes
+	c.listRouteCache(routeMapA6)

Review comment:
       Errors that occurred during the communication with Kubernetes will cause the program to be panicked but were ignored  during the communication  with Apache APISIX, it's wrong.

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			wns := make(map[string]struct{}, len(nsList.Items))
+			for _, v := range nsList.Items {
+				wns[v.Name] = struct{}{}
+			}
+			c.watchingNamespace = wns
+		}
+	}
+	for ns := range c.watchingNamespace {
+		// ApisixRoute
+		opts := v1.ListOptions{}
+		retRoutes, err := c.kubeClient.APISIXClient.ApisixV2beta1().ApisixRoutes(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, r := range retRoutes.Items {
+				tc, err := c.translator.TranslateRouteV2beta1NotStrictly(&r)
+				if err != nil {
+					panic(err)
+				} else {
+					// routes
+					for _, route := range tc.Routes {
+						routeMapK8S.Store(route.ID, route.ID)
+					}
+					// streamRoutes
+					for _, stRoute := range tc.StreamRoutes {
+						streamRouteMapK8S.Store(stRoute.ID, stRoute.ID)
+					}
+					// upstreams
+					for _, upstream := range tc.Upstreams {
+						upstreamMapK8S.Store(upstream.ID, upstream.ID)
+					}
+					// ssl
+					for _, ssl := range tc.SSL {
+						sslMapK8S.Store(ssl.ID, ssl.ID)
+					}
+				}
+			}
+		}
+		// todo ApisixUpstream
+		// ApisixUpstream should be synced with ApisixRoute resource
+
+		// ApisixSSL
+		retSSL, err := c.kubeClient.APISIXClient.ApisixV1().ApisixTlses(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, s := range retSSL.Items {
+				ssl, err := c.translator.TranslateSSL(&s)
+				if err != nil {
+					panic(err)
+				} else {
+					sslMapK8S.Store(ssl.ID, ssl.ID)
+				}
+			}
+		}
+		// ApisixConsumer
+		retConsumer, err := c.kubeClient.APISIXClient.ApisixV2alpha1().ApisixConsumers(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, con := range retConsumer.Items {
+				consumer, err := c.translator.TranslateApisixConsumer(&con)
+				if err != nil {
+					panic(err)
+				} else {
+					consumerMapK8S.Store(consumer.Username, consumer.Username)
+				}
+			}
+		}
+	}
+
+	// 2.get all cache routes
+	c.listRouteCache(routeMapA6)
+	c.listStreamRouteCache(streamRouteMapA6)
+	c.listUpstreamCache(upstreamMapA6)
+	c.listSSLCache(sslMapA6)
+	c.listConsumerCache(consumerMapA6)
+	// 3.compare
+	routeReult := findRedundant(routeMapA6, routeMapK8S)
+	streamRouteReult := findRedundant(streamRouteMapA6, streamRouteMapK8S)
+	upstreamReult := findRedundant(upstreamMapA6, upstreamMapK8S)
+	sslReult := findRedundant(sslMapA6, sslMapK8S)
+	consuemrReult := findRedundant(consumerMapA6, consumerMapK8S)
+	// 4.remove from APISIX
+	c.removeRouteFromA6(routeReult)
+	c.removeStreamRouteFromA6(streamRouteReult)
+	c.removeSSLFromA6(sslReult)
+	c.removeConsumerFromA6(consuemrReult)
+	time.Sleep(5 * time.Second)

Review comment:
       Don't reply on a FIXED WINDOW. Use poll mechanism.

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)

Review comment:
       We should not use `context.TODO()`, use the context passed in `c.run`, using `context.TODO()` is not controllable, for instance, you're running ingress controller on local and the process of communication with kubernetes is stuck, you can't quit the program by just click <Ctrl-C>.

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.

Review comment:
       I'm afraid removing users' data that doesn't create by the APISIX Ingress controller is a **quite dangerous** behavior, people will be confused by this behavior and complain about it.
   
   What we can do is warning users the consequence, we don't have permissions to remove users' data, again, TOO DANGEROUS.
   

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			wns := make(map[string]struct{}, len(nsList.Items))
+			for _, v := range nsList.Items {
+				wns[v.Name] = struct{}{}
+			}
+			c.watchingNamespace = wns
+		}
+	}
+	for ns := range c.watchingNamespace {
+		// ApisixRoute
+		opts := v1.ListOptions{}
+		retRoutes, err := c.kubeClient.APISIXClient.ApisixV2beta1().ApisixRoutes(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			for _, r := range retRoutes.Items {
+				tc, err := c.translator.TranslateRouteV2beta1NotStrictly(&r)
+				if err != nil {
+					panic(err)

Review comment:
       Ditto.

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)
+		} else {
+			wns := make(map[string]struct{}, len(nsList.Items))
+			for _, v := range nsList.Items {
+				wns[v.Name] = struct{}{}
+			}
+			c.watchingNamespace = wns
+		}
+	}
+	for ns := range c.watchingNamespace {
+		// ApisixRoute
+		opts := v1.ListOptions{}
+		retRoutes, err := c.kubeClient.APISIXClient.ApisixV2beta1().ApisixRoutes(ns).List(context.TODO(), opts)
+		if err != nil {
+			panic(err)

Review comment:
       Ditto. We should not panic the program here.

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)

Review comment:
       I didn't see any scenarios that multiple goroutines use these objects, so why to use `sync.Map` here, it's overengineering.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r713680878



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)

Review comment:
       I think if there is an error when list resources,  it should be panic here.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r715306349



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)

Review comment:
       Or I can return the error which will be captured by the upper layer, and finally call the [dief](https://github.com/apache/apisix-ingress-controller/blob/master/cmd/ingress/ingress.go#L34) method to exit the program?




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] tao12345666333 commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r715292388



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,222 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	"github.com/apache/apisix-ingress-controller/pkg/log"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX

Review comment:
       ```suggestion
   // CompareResources used to compare the object IDs in resources and APISIX
   ```

##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)

Review comment:
       I also think the panic here is not friendly. WDYT @lingsamuel 




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d748bcd) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.73%`.
   > The diff coverage is `1.52%`.
   
   > :exclamation: Current head d748bcd differs from pull request most recent head 5b353f4. Consider uploading reports for the commit 5b353f4 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.31%   -0.74%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6097     +130     
   ==========================================
   + Hits         2091     2092       +1     
   - Misses       3625     3754     +129     
     Partials      251      251              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/schema.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9zY2hlbWEuZ28=) | `63.26% <ø> (ø)` | |
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...5b353f4](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r713681063



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)

Review comment:
       Done




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r715305622



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)

Review comment:
       I think it needs the same treatment as [here](https://github.com/apache/apisix-ingress-controller/blob/master/cmd/ingress/ingress.go#L123-L126) because it only runs when starting the Ingress controller.
   
   When `controller.NewController(cfg)` failed, it will `os.Exit(1)`, which has the same effect as `panic` .




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4c23f2b) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.95%`.
   > The diff coverage is `1.16%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.08%   -0.96%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6137     +170     
   ==========================================
   + Hits         2091     2092       +1     
   - Misses       3625     3794     +169     
     Partials      251      251              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/schema.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9zY2hlbWEuZ28=) | `63.26% <ø> (ø)` | |
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...4c23f2b](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (98c7982) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.40%`.
   > The diff coverage is `1.52%`.
   
   > :exclamation: Current head 98c7982 differs from pull request most recent head 9857c7c. Consider uploading reports for the commit 9857c7c to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.63%   -0.41%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6097     +130     
   ==========================================
   + Hits         2091     2112      +21     
   - Misses       3625     3741     +116     
   + Partials      251      244       -7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/schema.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9zY2hlbWEuZ28=) | `63.26% <ø> (ø)` | |
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `37.76% <0.00%> (+2.09%)` | :arrow_up: |
   | [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `30.75% <0.00%> (+3.50%)` | :arrow_up: |
   | [pkg/apisix/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9wbHVnaW4uZ28=) | `100.00% <0.00%> (+20.00%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...9857c7c](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter commented on pull request #680: WIP: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3e848bb) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/1e1be7401ba3707ba660a7d61df5118fc5725eff?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1e1be74) will **decrease** coverage by `0.82%`.
   > The diff coverage is `1.35%`.
   
   > :exclamation: Current head 3e848bb differs from pull request most recent head 3c2dac8. Consider uploading reports for the commit 3c2dac8 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.21%   -0.83%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6114     +147     
   ==========================================
   + Hits         2091     2092       +1     
   - Misses       3625     3771     +146     
     Partials      251      251              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [1e1be74...3c2dac8](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r710608883



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.

Review comment:
       As we discuss in the mailing list, Have changed to logging the differents stauts.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1aa1f43) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.62%`.
   > The diff coverage is `1.16%`.
   
   > :exclamation: Current head 1aa1f43 differs from pull request most recent head bb0bccf. Consider uploading reports for the commit bb0bccf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.41%   -0.63%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6137     +170     
   ==========================================
   + Hits         2091     2112      +21     
   - Misses       3625     3781     +156     
   + Partials      251      244       -7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/schema.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9zY2hlbWEuZ28=) | `63.26% <ø> (ø)` | |
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `37.76% <0.00%> (+2.09%)` | :arrow_up: |
   | [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `30.75% <0.00%> (+3.50%)` | :arrow_up: |
   | [pkg/apisix/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9wbHVnaW4uZ28=) | `100.00% <0.00%> (+20.00%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...bb0bccf](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0a7eced) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.84%`.
   > The diff coverage is `2.61%`.
   
   > :exclamation: Current head 0a7eced differs from pull request most recent head 77e66bf. Consider uploading reports for the commit 77e66bf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.19%   -0.85%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6117     +150     
   ==========================================
   + Hits         2091     2092       +1     
   - Misses       3625     3774     +149     
     Partials      251      251              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/schema.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9zY2hlbWEuZ28=) | `63.26% <ø> (ø)` | |
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   | [pkg/kube/translation/apisix\_upstream.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3Vwc3RyZWFtLmdv) | `88.50% <100.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...77e66bf](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] tao12345666333 commented on a change in pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on a change in pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#discussion_r715307742



##########
File path: pkg/ingress/compare.go
##########
@@ -0,0 +1,271 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package ingress
+
+import (
+	"context"
+	"sync"
+	"time"
+
+	"C"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+	apisix "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
+)
+
+// CompareResources use to compare the object IDs in resources and APISIX
+// Find out the rest of objects in APISIX
+// AND remove them.
+func (c *Controller) CompareResources() {
+	var (
+		routeMapK8S       = new(sync.Map)
+		streamRouteMapK8S = new(sync.Map)
+		upstreamMapK8S    = new(sync.Map)
+		sslMapK8S         = new(sync.Map)
+		consumerMapK8S    = new(sync.Map)
+
+		routeMapA6       = new(sync.Map)
+		streamRouteMapA6 = new(sync.Map)
+		upstreamMapA6    = new(sync.Map)
+		sslMapA6         = new(sync.Map)
+		consumerMapA6    = new(sync.Map)
+	)
+	// todo if watchingNamespace == nil
+	if c.watchingNamespace == nil {
+		opts := v1.ListOptions{}
+		// list all apisixroute resources in all namespaces
+		nsList, err := c.kubeClient.Client.CoreV1().Namespaces().List(context.TODO(), opts)
+		if err != nil {
+			panic(err)

Review comment:
       > Or I can return the error which will be captured by the upper layer, and finally call the dief method to exit the program?
   
   I prefer this one.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (26a4975) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.91%`.
   > The diff coverage is `1.21%`.
   
   > :exclamation: Current head 26a4975 differs from pull request most recent head a085417. Consider uploading reports for the commit a085417 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.12%   -0.92%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6130     +163     
   ==========================================
   + Hits         2091     2092       +1     
   - Misses       3625     3787     +162     
     Partials      251      251              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...a085417](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (eca9c3c) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.91%`.
   > The diff coverage is `1.21%`.
   
   > :exclamation: Current head eca9c3c differs from pull request most recent head a085417. Consider uploading reports for the commit a085417 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.12%   -0.92%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6130     +163     
   ==========================================
   + Hits         2091     2092       +1     
   - Misses       3625     3787     +162     
     Partials      251      251              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...a085417](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] codecov-commenter edited a comment on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-918311743


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#680](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (10876d5) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/5c9cdbe7fc2c28f3023d635dbbd9bc833388a2bf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5c9cdbe) will **decrease** coverage by `0.58%`.
   > The diff coverage is `1.21%`.
   
   > :exclamation: Current head 10876d5 differs from pull request most recent head f4b6174. Consider uploading reports for the commit f4b6174 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #680      +/-   ##
   ==========================================
   - Coverage   35.04%   34.45%   -0.59%     
   ==========================================
     Files          60       61       +1     
     Lines        5967     6130     +163     
   ==========================================
   + Hits         2091     2112      +21     
   - Misses       3625     3774     +149     
   + Partials      251      244       -7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [pkg/ingress/compare.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29tcGFyZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | [pkg/ingress/controller.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvY29udHJvbGxlci5nbw==) | `1.06% <0.00%> (-0.01%)` | :arrow_down: |
   | [pkg/ingress/pod.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2luZ3Jlc3MvcG9kLmdv) | `32.46% <100.00%> (+0.88%)` | :arrow_up: |
   | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `37.76% <0.00%> (+2.09%)` | :arrow_up: |
   | [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `30.75% <0.00%> (+3.50%)` | :arrow_up: |
   | [pkg/apisix/plugin.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwaXNpeC9wbHVnaW4uZ28=) | `100.00% <0.00%> (+20.00%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5c9cdbe...f4b6174](https://codecov.io/gh/apache/apisix-ingress-controller/pull/680?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] tokers commented on pull request #680: feat: add full compare when ingress startup

Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #680:
URL: https://github.com/apache/apisix-ingress-controller/pull/680#issuecomment-921369753


   @gxthrj There are a couple of lint errors, please fix them.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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