-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stub mesh configuration resource controller (#3302)
- Loading branch information
1 parent
925a1c6
commit f8ffba3
Showing
6 changed files
with
92 additions
and
7 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/mesh_configuration_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" | ||
) | ||
|
||
// MeshConfigurationController reconciles a MeshConfiguration object. | ||
type MeshConfigurationController struct { | ||
client.Client | ||
Log logr.Logger | ||
Scheme *runtime.Scheme | ||
Controller *ConsulResourceController | ||
} | ||
|
||
// +kubebuilder:rbac:groups=mesh.consul.hashicorp.com,resources=meshconfiguration,verbs=get;list;watch;create;update;patch;delete | ||
// +kubebuilder:rbac:groups=mesh.consul.hashicorp.com,resources=meshconfiguration/status,verbs=get;update;patch | ||
|
||
func (r *MeshConfigurationController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
return r.Controller.ReconcileEntry(ctx, r, req, &meshv2beta1.MeshConfiguration{}) | ||
} | ||
|
||
func (r *MeshConfigurationController) Logger(name types.NamespacedName) logr.Logger { | ||
return r.Log.WithValues("request", name) | ||
} | ||
|
||
func (r *MeshConfigurationController) UpdateStatus(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error { | ||
return r.Status().Update(ctx, obj, opts...) | ||
} | ||
|
||
func (r *MeshConfigurationController) SetupWithManager(mgr ctrl.Manager) error { | ||
return setupWithManager(mgr, &meshv2beta1.MeshConfiguration{}, 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