Skip to content

Commit

Permalink
chore: fix GatewayClass controller and logger names after v1 GW API m…
Browse files Browse the repository at this point in the history
…igration (#5178)
  • Loading branch information
pmalek authored Nov 16, 2023
1 parent bab7280 commit f154d10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/controllers/gateway/gateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"reflect"
"strings"
"time"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -143,7 +144,7 @@ func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error {
// start the required gatewayclass controller as well
gwcCTRL := &GatewayClassReconciler{
Client: r.Client,
Log: r.Log.WithName("V1Beta1GatewayClass"),
Log: r.Log.WithName(strings.ToUpper(gatewayapi.V1GroupVersion) + "GatewayClass"),
Scheme: r.Scheme,
CacheSyncTimeout: r.CacheSyncTimeout,
}
Expand Down
4 changes: 3 additions & 1 deletion internal/controllers/gateway/gatewayclass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"reflect"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -63,7 +64,8 @@ type GatewayClassReconciler struct { //nolint:revive

// SetupWithManager sets up the controller with the Manager.
func (r *GatewayClassReconciler) SetupWithManager(mgr ctrl.Manager) error {
c, err := controller.New("V1Beta1GatewayClass", mgr, controller.Options{
name := strings.ToUpper(gatewayapi.V1GroupVersion) + "GatewayClass"
c, err := controller.New(name, mgr, controller.Options{
Reconciler: r,
LogConstructor: func(_ *reconcile.Request) logr.Logger {
return r.Log
Expand Down
6 changes: 5 additions & 1 deletion internal/gatewayapi/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ import (
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

const V1Group = Group(gatewayv1.GroupName)
const (
V1Group = Group(gatewayv1.GroupName)
)

var V1GroupVersion = gatewayv1.GroupVersion.Version

0 comments on commit f154d10

Please sign in to comment.