From 67fc621a58875c277e0909987e0b547c7b88bc27 Mon Sep 17 00:00:00 2001 From: Dibyo Mukherjee Date: Fri, 23 Apr 2021 14:04:03 -0400 Subject: [PATCH] Wire up webhhook with v1beta1 --- cmd/webhook/main.go | 7 +++++++ pkg/apis/triggers/v1beta1/trigger_types.go | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 71a940981b..f8078459e8 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -22,6 +22,7 @@ import ( "github.com/tektoncd/triggers/pkg/apis/triggers/contexts" "github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1" + "github.com/tektoncd/triggers/pkg/apis/triggers/v1beta1" "k8s.io/apimachinery/pkg/runtime/schema" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" @@ -43,6 +44,12 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ v1alpha1.SchemeGroupVersion.WithKind("TriggerBinding"): &v1alpha1.TriggerBinding{}, v1alpha1.SchemeGroupVersion.WithKind("TriggerTemplate"): &v1alpha1.TriggerTemplate{}, v1alpha1.SchemeGroupVersion.WithKind("Trigger"): &v1alpha1.Trigger{}, + + v1beta1.SchemeGroupVersion.WithKind("ClusterTriggerBinding"): &v1beta1.ClusterTriggerBinding{}, + v1beta1.SchemeGroupVersion.WithKind("EventListener"): &v1beta1.EventListener{}, + v1beta1.SchemeGroupVersion.WithKind("TriggerBinding"): &v1beta1.TriggerBinding{}, + v1beta1.SchemeGroupVersion.WithKind("TriggerTemplate"): &v1beta1.TriggerTemplate{}, + v1beta1.SchemeGroupVersion.WithKind("Trigger"): &v1beta1.Trigger{}, } func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { diff --git a/pkg/apis/triggers/v1beta1/trigger_types.go b/pkg/apis/triggers/v1beta1/trigger_types.go index 558783bb2c..be2df5a24e 100644 --- a/pkg/apis/triggers/v1beta1/trigger_types.go +++ b/pkg/apis/triggers/v1beta1/trigger_types.go @@ -131,13 +131,10 @@ func (ti *TriggerInterceptor) defaultInterceptorKind() { // GetName returns the name for the given interceptor func (ti *TriggerInterceptor) GetName() string { - // This is temporary until we implement #869 - name := "" - switch { - case ti.Ref.Name != "": - name = ti.Ref.Name + if ti.Ref.Name != "" { + return ti.Ref.Name } - return name + return "" } // WebhookInterceptor provides a webhook to intercept and pre-process events