Skip to content

Commit

Permalink
fix: init webhook
Browse files Browse the repository at this point in the history
Signed-off-by: nwaiyatharee <[email protected]>
  • Loading branch information
agoda-devops-container committed Sep 24, 2024
1 parent 83faf8f commit b3636d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/webhook/v1alpha1/workflowrun/mutating_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ func (h *MutatingHandler) Handle(ctx context.Context, req admission.Request) adm
// RegisterMutatingHandler will register workflow mutation handler to the webhook
func RegisterMutatingHandler(mgr manager.Manager) {
server := mgr.GetWebhookServer()
handler := &MutatingHandler{
server.Register("/mutating-core-oam-dev-v1alpha1-workflowruns", &webhook.Admission{Handler: &MutatingHandler{
Decoder: admission.NewDecoder(mgr.GetScheme()),
}
server.Register("/mutating-core-oam-dev-v1alpha1-workflowruns", &webhook.Admission{Handler: handler})
}})
}
5 changes: 4 additions & 1 deletion pkg/webhook/v1alpha1/workflowrun/validating_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,8 @@ func (h *ValidatingHandler) Handle(ctx context.Context, req admission.Request) a
// RegisterValidatingHandler will register application validate handler to the webhook
func RegisterValidatingHandler(mgr manager.Manager, _ controllers.Args) {
server := mgr.GetWebhookServer()
server.Register("/validating-core-oam-dev-v1alpha1-workflowruns", &webhook.Admission{Handler: &ValidatingHandler{}})
server.Register("/validating-core-oam-dev-v1alpha1-workflowruns", &webhook.Admission{Handler: &ValidatingHandler{
Client: mgr.GetClient(),
Decoder: admission.NewDecoder(mgr.GetScheme()),
}})
}

0 comments on commit b3636d4

Please sign in to comment.