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

avoid throttling #319

Merged
merged 1 commit into from
Feb 10, 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
3 changes: 2 additions & 1 deletion pkg/controller/pod-networking/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package podnetworking

import (
"context"
"time"

aliyunClient "github.com/AliyunContainerService/terway/pkg/aliyun/client"
"github.com/AliyunContainerService/terway/pkg/apis/network.alibabacloud.com/v1beta1"
Expand Down Expand Up @@ -136,7 +137,7 @@ func (m *ReconcilePodNetworking) Reconcile(ctx context.Context, request reconcil

err2 := m.updateStatus(ctx, update, old)
if err != nil {
return reconcile.Result{}, err
return reconcile.Result{RequeueAfter: 30 * time.Second}, nil
}
return reconcile.Result{}, err2
}
Expand Down
20 changes: 2 additions & 18 deletions pkg/controller/pod-networking/predict.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package podnetworking

import (
"reflect"

"github.com/AliyunContainerService/terway/pkg/apis/network.alibabacloud.com/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/predicate"
Expand All @@ -34,23 +32,9 @@ func (p *predicateForPodnetwokringEvent) Update(e event.UpdateEvent) bool {
return false
}

// if current status is not ready sync anyway
if newPodNetworking.Status.Status != v1beta1.NetworkingStatusReady {
if newPodNetworking.Status.Status == "" {
return true
}

oldPodNetworking, ok := e.ObjectOld.(*v1beta1.PodNetworking)
if !ok {
return false
}

oldCopy := oldPodNetworking.DeepCopy()
newCopy := newPodNetworking.DeepCopy()

oldCopy.ResourceVersion = ""
newCopy.ResourceVersion = ""
oldCopy.Status = v1beta1.PodNetworkingStatus{}
newCopy.Status = v1beta1.PodNetworkingStatus{}

return !reflect.DeepEqual(&oldCopy, &newCopy)
return false
}