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

Reduce number of CES updates sent to API server in short time for the same CES #23615

Merged
merged 1 commit into from
Mar 7, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions operator/pkg/ciliumendpointslice/endpointslice.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ const (
// Delayed CES Synctime, CES's are synced with k8s-apiserver after certain delay
// Some CES's are delayed to sync with k8s-apiserver.
DelayedCESSyncTime = 15 * time.Second
// Default CES Synctime, sync instantaeously with k8s-apiserver.
DefaultCESSyncTime = 0
// Default CES Synctime, multiple consecutive syncs with k8s-apiserver are
// batched and synced together after a short delay.
DefaultCESSyncTime = 500 * time.Millisecond
)

type CiliumEndpointSliceController struct {
Expand Down
7 changes: 2 additions & 5 deletions operator/pkg/ciliumendpointslice/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,8 @@ func (c *cesMgr) insertCESInWorkQueue(ces *cesTracker, baseDelay time.Duration)
if ces.cesInsertedAt.IsZero() {
ces.cesInsertedAt = time.Now()
}
if baseDelay == DefaultCESSyncTime {
c.queue.Add(ces.ces.GetName())
} else {
c.queue.AddAfter(ces.ces.GetName(), baseDelay)
}

c.queue.AddAfter(ces.ces.GetName(), baseDelay)
}

// Return the CES queue delay in seconds and reset cesInsert time.
Expand Down