-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NET-6536 Adds stub of GatewayClass controller into v2 controllers (#3245
) * Adds stub of GatewayClass controller into v2 controllers * regen without weird spaces * Update control-plane/config-entries/controllersv2/gateway_class_controller.go --------- Co-authored-by: Nathan Coleman <[email protected]>
- Loading branch information
Showing
6 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
control-plane/config-entries/controllersv2/gateway_class_controller.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package controllersv2 | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/go-logr/logr" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/types" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
meshv2beta1 "github.com/hashicorp/consul-k8s/control-plane/api/mesh/v2beta1" | ||
) | ||
|
||
// GatewayClassController reconciles a MeshGateway object. | ||
type GatewayClassController struct { | ||
client.Client | ||
Log logr.Logger | ||
Scheme *runtime.Scheme | ||
MeshConfigController *MeshConfigController | ||
} | ||
|
||
// +kubebuilder:rbac:groups=mesh.consul.hashicorp.com,resources=gatewayclass,verbs=get;list;watch;create;update;patch;delete | ||
// +kubebuilder:rbac:groups=mesh.consul.hashicorp.com,resources=gatewayclass/status,verbs=get;update;patch | ||
|
||
func (r *GatewayClassController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
return r.MeshConfigController.ReconcileEntry(ctx, r, req, &meshv2beta1.GatewayClass{}) | ||
} | ||
|
||
func (r *GatewayClassController) Logger(name types.NamespacedName) logr.Logger { | ||
return r.Log.WithValues("request", name) | ||
} | ||
|
||
func (r *GatewayClassController) UpdateStatus(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error { | ||
return r.Status().Update(ctx, obj, opts...) | ||
} | ||
|
||
func (r *GatewayClassController) SetupWithManager(mgr ctrl.Manager) error { | ||
return setupWithManager(mgr, &meshv2beta1.GatewayClass{}, r) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters