-
Notifications
You must be signed in to change notification settings - Fork 51
Fix router controllers dropping tombstone delete events #730
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,6 @@ | |
|
|
||
| {{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} | ||
|
|
||
| {{ template "chart.requirementsSection" . }} | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we dont need this one anymore or what?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this template is still needed the change only affects generated docs to fix invalid markdown it doesn’t remove or deprecate the chart template |
||
| {{ template "chart.valuesSection" . }} | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,6 @@ A Helm chart for deploying Kthena | |
|
|
||
|    | ||
|
|
||
| ## Requirements | ||
|
|
||
| | Repository | Name | Version | | ||
| |------------|------|---------| | ||
| | https://ghcr.io/volcano-sh/charts/kthena | networking | 1.0.0 | | ||
| | https://ghcr.io/volcano-sh/charts/kthena | workload | 1.0.0 | | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? why all instead of partly in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the table was invalid as a whole (column mismatch) and was breaking gen check |
||
| ## Values | ||
|
|
||
| | Key | Type | Default | Description | | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -164,7 +164,7 @@ func (c *GatewayController) syncHandler(key string) error { | |||||||||||
| } | ||||||||||||
|
|
||||||||||||
| func (c *GatewayController) enqueueGateway(obj interface{}) { | ||||||||||||
| key, err := cache.MetaNamespaceKeyFunc(obj) | ||||||||||||
| key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. acceptable(since we also get a DeleteFunc in NewHTTPRouteController or else). kthena/pkg/kthena-router/controller/httproute_controller.go Lines 60 to 64 in a8c9193
k8s standard FYI:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for confirming |
||||||||||||
| if err != nil { | ||||||||||||
| utilruntime.HandleError(err) | ||||||||||||
| return | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| Copyright The Volcano Authors. | ||
| Licensed 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 controller | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/client-go/tools/cache" | ||
| "k8s.io/client-go/util/workqueue" | ||
| gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
|
|
||
| "github.com/volcano-sh/kthena/pkg/kthena-router/datastore" | ||
| ) | ||
|
|
||
| func TestEnqueueGateway(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| obj interface{} | ||
| expectedKey string | ||
| }{ | ||
| { | ||
| name: "normal Gateway object", | ||
| obj: &gatewayv1.Gateway{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "test-gateway", | ||
| Namespace: "default", | ||
| }, | ||
| }, | ||
| expectedKey: "default/test-gateway", | ||
| }, | ||
| { | ||
| name: "tombstone with DeletedFinalStateUnknown", | ||
| obj: cache.DeletedFinalStateUnknown{ | ||
| Key: "default/deleted-gateway", | ||
| Obj: &gatewayv1.Gateway{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "deleted-gateway", | ||
| Namespace: "default", | ||
| }, | ||
| }, | ||
| }, | ||
| expectedKey: "default/deleted-gateway", | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| queue := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any]()) | ||
| defer queue.ShutDown() | ||
|
|
||
| c := &GatewayController{ | ||
| workqueue: queue, | ||
| store: datastore.New(), | ||
| } | ||
|
|
||
| c.enqueueGateway(tt.obj) | ||
|
|
||
| if queue.Len() != 1 { | ||
| t.Fatalf("expected 1 item in queue, got %d", queue.Len()) | ||
| } | ||
|
|
||
| item, shutdown := queue.Get() | ||
| if shutdown { | ||
| t.Fatal("unexpected queue shutdown") | ||
| } | ||
| if item != tt.expectedKey { | ||
| t.Errorf("expected key %q, got %q", tt.expectedKey, item) | ||
| } | ||
| }) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| Copyright The Volcano Authors. | ||
|
|
||
| Licensed 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 controller | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/client-go/tools/cache" | ||
| "k8s.io/client-go/util/workqueue" | ||
| gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
|
|
||
| "github.com/volcano-sh/kthena/pkg/kthena-router/datastore" | ||
| ) | ||
|
|
||
| func TestEnqueueHTTPRoute(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| obj interface{} | ||
| expectedKey string | ||
| }{ | ||
| { | ||
| name: "normal HTTPRoute object", | ||
| obj: &gatewayv1.HTTPRoute{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "test-httproute", | ||
| Namespace: "default", | ||
| }, | ||
| }, | ||
| expectedKey: "default/test-httproute", | ||
| }, | ||
| { | ||
| name: "tombstone with DeletedFinalStateUnknown", | ||
| obj: cache.DeletedFinalStateUnknown{ | ||
| Key: "default/deleted-httproute", | ||
| Obj: &gatewayv1.HTTPRoute{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "deleted-httproute", | ||
| Namespace: "default", | ||
| }, | ||
| }, | ||
| }, | ||
| expectedKey: "default/deleted-httproute", | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| queue := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any]()) | ||
| defer queue.ShutDown() | ||
|
|
||
| c := &HTTPRouteController{ | ||
| workqueue: queue, | ||
| store: datastore.New(), | ||
| } | ||
|
|
||
| c.enqueueHTTPRoute(tt.obj) | ||
|
|
||
| if queue.Len() != 1 { | ||
| t.Fatalf("expected 1 item in queue, got %d", queue.Len()) | ||
| } | ||
|
|
||
| item, shutdown := queue.Get() | ||
| if shutdown { | ||
| t.Fatal("unexpected queue shutdown") | ||
| } | ||
| if item != tt.expectedKey { | ||
| t.Errorf("expected key %q, got %q", tt.expectedKey, item) | ||
| } | ||
| }) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| Copyright The Volcano Authors. | ||
|
|
||
| Licensed 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 controller | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/client-go/tools/cache" | ||
| "k8s.io/client-go/util/workqueue" | ||
| inferencev1 "sigs.k8s.io/gateway-api-inference-extension/api/v1" | ||
|
|
||
| "github.com/volcano-sh/kthena/pkg/kthena-router/datastore" | ||
| ) | ||
|
|
||
| func TestEnqueueInferencePool(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| obj interface{} | ||
| expectedKey string | ||
| }{ | ||
| { | ||
| name: "normal InferencePool object", | ||
| obj: &inferencev1.InferencePool{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "test-pool", | ||
| Namespace: "default", | ||
| }, | ||
| }, | ||
| expectedKey: "default/test-pool", | ||
| }, | ||
| { | ||
| name: "tombstone with DeletedFinalStateUnknown", | ||
| obj: cache.DeletedFinalStateUnknown{ | ||
| Key: "default/deleted-pool", | ||
| Obj: &inferencev1.InferencePool{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "deleted-pool", | ||
| Namespace: "default", | ||
| }, | ||
| }, | ||
| }, | ||
| expectedKey: "default/deleted-pool", | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| queue := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any]()) | ||
| defer queue.ShutDown() | ||
|
|
||
| c := &InferencePoolController{ | ||
| workqueue: queue, | ||
| store: datastore.New(), | ||
| } | ||
|
|
||
| c.enqueueInferencePool(tt.obj) | ||
|
|
||
| if queue.Len() != 1 { | ||
| t.Fatalf("expected 1 item in queue, got %d", queue.Len()) | ||
| } | ||
|
|
||
| item, shutdown := queue.Get() | ||
| if shutdown { | ||
| t.Fatal("unexpected queue shutdown") | ||
| } | ||
| if item != tt.expectedKey { | ||
| t.Errorf("expected key %q, got %q", tt.expectedKey, item) | ||
| } | ||
| }) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#731 (comment)
? so wdum in this one.why different again in above pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change only avoids failing cl on packages with (no test files) actual e2e tests are still executed and will fail the build if they fail ,the goal is to avoid false negatives not to relax real test coverage