Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix up ep resourceVersion comparison and clean up #901

Merged
merged 1 commit into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/ingress/apisix_tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (c *apisixTlsController) onAdd(obj interface{}) {
func (c *apisixTlsController) onUpdate(prev, curr interface{}) {
oldTls := prev.(*configv2beta3.ApisixTls)
newTls := curr.(*configv2beta3.ApisixTls)
if oldTls.GetResourceVersion() == newTls.GetResourceVersion() {
if oldTls.GetResourceVersion() >= newTls.GetResourceVersion() {
return
}
key, err := cache.MetaNamespaceKeyFunc(curr)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingress/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (c *endpointsController) onUpdate(prev, curr interface{}) {
prevEp := prev.(*corev1.Endpoints)
currEp := curr.(*corev1.Endpoints)

if prevEp.GetResourceVersion() == currEp.GetResourceVersion() {
if prevEp.GetResourceVersion() >= currEp.GetResourceVersion() {
return
}
key, err := cache.MetaNamespaceKeyFunc(currEp)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingress/endpointslice.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (c *endpointSliceController) onUpdate(prev, curr interface{}) {
prevEp := prev.(*discoveryv1.EndpointSlice)
currEp := curr.(*discoveryv1.EndpointSlice)

if prevEp.GetResourceVersion() == currEp.GetResourceVersion() {
if prevEp.GetResourceVersion() >= currEp.GetResourceVersion() {
return
}
key, err := cache.MetaNamespaceKeyFunc(currEp)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingress/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (c *secretController) onUpdate(prev, curr interface{}) {
prevSec := prev.(*corev1.Secret)
currSec := curr.(*corev1.Secret)

if prevSec.GetResourceVersion() == currSec.GetResourceVersion() {
if prevSec.GetResourceVersion() >= currSec.GetResourceVersion() {
return
}
key, err := cache.MetaNamespaceKeyFunc(currSec)
Expand Down
5 changes: 2 additions & 3 deletions pkg/ingress/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
networkingv1beta1 "k8s.io/api/networking/v1beta1"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated

"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/cache"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
Expand All @@ -55,7 +54,7 @@ func (c *Controller) verifyGeneration(conditions *[]metav1.Condition, newConditi
}

// recordStatus record resources status
func (c *Controller) recordStatus(at interface{}, reason string, err error, status v1.ConditionStatus, generation int64) {
func (c *Controller) recordStatus(at interface{}, reason string, err error, status metav1.ConditionStatus, generation int64) {
// build condition
message := _commonSuccessMessage
if err != nil {
Expand Down Expand Up @@ -335,7 +334,7 @@ func (c *Controller) ingressPublishAddresses() ([]string, error) {
switch svc.Spec.Type {
case apiv1.ServiceTypeLoadBalancer:
if len(svc.Status.LoadBalancer.Ingress) < 1 {
return addrs, fmt.Errorf(_gatewayLBNotReadyMessage)
return addrs, fmt.Errorf("%s", _gatewayLBNotReadyMessage)
}

for _, ip := range svc.Status.LoadBalancer.Ingress {
Expand Down