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 26, 2021
1 parent 039b09e commit e0dfabd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 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
11 changes: 4 additions & 7 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 Expand Up @@ -178,7 +175,7 @@ type CELInterceptor struct {
Overlays []CELOverlay `json:"overlays,omitempty"`
}

// CELOverlay provides a way to modify the request body using DeprecatedCEL expressions
// CELOverlay provides a way to modify the request body using CEL expressions
type CELOverlay struct {
Key string `json:"key,omitempty"`
Expression string `json:"expression,omitempty"`
Expand Down

0 comments on commit e0dfabd

Please sign in to comment.