Skip to content

Commit

Permalink
Wire up webhhook with v1beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyom committed May 24, 2021
1 parent bc25d1d commit 67fc621
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 7 additions & 0 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
9 changes: 3 additions & 6 deletions pkg/apis/triggers/v1beta1/trigger_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 67fc621

Please sign in to comment.