Skip to content

Commit

Permalink
Merge pull request #2954 from justinsb/no_with_name
Browse files Browse the repository at this point in the history
controllerbuilder: don't add log name
  • Loading branch information
google-oss-prow[bot] authored Oct 21, 2024
2 parents 22080fc + 81f7055 commit e422d90
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions dev/tools/controllerbuilder/template/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)
const (
ctrlName = "{{.KCCService}}-{{.ProtoResource | ToLower }}-controller"
)
func init() {
registry.RegisterModel(krm.{{.Kind}}GVK, New{{.Kind}}Model)
}
Expand Down Expand Up @@ -142,7 +138,7 @@ type {{.Kind}}Adapter struct {
var _ directbase.Adapter = &{{.Kind}}Adapter{}
func (a *{{.Kind}}Adapter) Find(ctx context.Context) (bool, error) {
log := klog.FromContext(ctx).WithName(ctrlName)
log := klog.FromContext(ctx)
log.V(2).Info("getting {{.Kind}}", "name", a.id.External)
req := &{{.KCCService}}pb.Get{{.ProtoResource}}Request{Name: a.id.External}
Expand All @@ -159,7 +155,7 @@ func (a *{{.Kind}}Adapter) Find(ctx context.Context) (bool, error) {
}
func (a *{{.Kind}}Adapter) Create(ctx context.Context, createOp *directbase.CreateOperation) error {
log := klog.FromContext(ctx).WithName(ctrlName)
log := klog.FromContext(ctx)
log.V(2).Info("creating {{.ProtoResource}}", "name", a.id.External)
mapCtx := &direct.MapContext{}
Expand Down Expand Up @@ -198,7 +194,7 @@ func (a *{{.Kind}}Adapter) Create(ctx context.Context, createOp *directbase.Crea
}
func (a *{{.Kind}}Adapter) Update(ctx context.Context, updateOp *directbase.UpdateOperation) error {
log := klog.FromContext(ctx).WithName(ctrlName)
log := klog.FromContext(ctx)
log.V(2).Info("updating {{.ProtoResource}}", "name", a.id.External)
mapCtx := &direct.MapContext{}
Expand Down Expand Up @@ -271,7 +267,7 @@ func (a *{{.Kind}}Adapter) Export(ctx context.Context) (*unstructured.Unstructur
// Delete implements the Adapter interface.
func (a *{{.Kind}}Adapter) Delete(ctx context.Context, deleteOp *directbase.DeleteOperation) (bool, error) {
log := klog.FromContext(ctx).WithName(ctrlName)
log := klog.FromContext(ctx)
log.V(2).Info("deleting {{.ProtoResource}}", "name", a.id.External)
req := &{{.KCCService}}pb.Delete{{.ProtoResource}}Request{Name: a.id.External}
Expand Down

0 comments on commit e422d90

Please sign in to comment.