Skip to content

Commit

Permalink
controller: removes unnecessary gvks setter (envoyproxy#330)
Browse files Browse the repository at this point in the history
**Commit Message**

This removes the unnecessary code path of settings object kinds during
the reconciliation of AIGatewayRoute. Previously, it existed only
because there was a check in tests/controller.

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Loong <long0dai@foxmail.com>
  • Loading branch information
mathetake authored and daixiang0 committed Feb 19, 2025
1 parent f4e2d02 commit 651e38d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
9 changes: 0 additions & 9 deletions internal/controller/ai_gateway_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ func (c *aiGatewayRouteController) Reconcile(ctx context.Context, req reconcile.
return ctrl.Result{}, err
}

// https://github.com/kubernetes-sigs/controller-runtime/issues/1517#issuecomment-844703142
gvks, unversioned, err := c.client.Scheme().ObjectKinds(&aiGatewayRoute)
if err != nil {
panic(err)
}
if !unversioned && len(gvks) == 1 {
aiGatewayRoute.SetGroupVersionKind(gvks[0])
}

if err := c.ensuresExtProcConfigMapExists(ctx, &aiGatewayRoute); err != nil {
logger.Error(err, "failed to reconcile extProc config map")
condition := metav1.Condition{
Expand Down
1 change: 0 additions & 1 deletion tests/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ func TestAIGatewayRouteController(t *testing.T) {
// Verify that they are the same.
created := item.(*aigv1a1.AIGatewayRoute)
require.Equal(t, "myroute", created.Name)
require.Equal(t, "AIGatewayRoute", created.Kind)

created.TypeMeta = metav1.TypeMeta{} // This will be populated by the controller internally, so we ignore it.
require.Equal(t, origin, created)
Expand Down

0 comments on commit 651e38d

Please sign in to comment.