Skip to content

Commit

Permalink
stub api-gateway-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
jm96441n committed Jan 25, 2024
1 parent d54f197 commit 8f82437
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions control-plane/controllers/resources/api-gateway-controller.go
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 resources

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"
)

// APIGatewayController reconciles a APIGateway object.
type APIGatewayController struct {
client.Client
Log logr.Logger
Scheme *runtime.Scheme
Controller *ConsulResourceController
}

// +kubebuilder:rbac:groups=mesh.consul.hashicorp.com,resources=tcproute,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=mesh.consul.hashicorp.com,resources=tcproute/status,verbs=get;update;patch

func (r *APIGatewayController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Controller.ReconcileResource(ctx, r, req, &meshv2beta1.APIGateway{})
}

func (r *APIGatewayController) Logger(name types.NamespacedName) logr.Logger {
return r.Log.WithValues("request", name)
}

func (r *APIGatewayController) UpdateStatus(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
return r.Status().Update(ctx, obj, opts...)
}

func (r *APIGatewayController) SetupWithManager(mgr ctrl.Manager) error {
return setupWithManager(mgr, &meshv2beta1.APIGateway{}, r)
}

0 comments on commit 8f82437

Please sign in to comment.