mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-05-14 21:36:35 +00:00
* feat(webhook): add watchdog webhook to core Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * fix(controller): ensure managed metadata for namespaces on update Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore(controller): refactor core webhooks to generics Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: fix helm plugin installation Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: rename webhook to tenant-label Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> --------- Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
42 lines
891 B
Go
42 lines
891 B
Go
// Copyright 2020-2025 Project Capsule Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
//nolint:dupl
|
|
package route
|
|
|
|
import (
|
|
capsulewebhook "github.com/projectcapsule/capsule/internal/webhook"
|
|
)
|
|
|
|
type namespace struct {
|
|
handlers []capsulewebhook.Handler
|
|
}
|
|
|
|
func NamespaceValidation(handler ...capsulewebhook.Handler) capsulewebhook.Webhook {
|
|
return &namespace{handlers: handler}
|
|
}
|
|
|
|
func (w *namespace) GetHandlers() []capsulewebhook.Handler {
|
|
return w.handlers
|
|
}
|
|
|
|
func (w *namespace) GetPath() string {
|
|
return "/namespaces"
|
|
}
|
|
|
|
type namespacePatch struct {
|
|
handlers []capsulewebhook.Handler
|
|
}
|
|
|
|
func NamespaceMutation(handlers ...capsulewebhook.Handler) capsulewebhook.Webhook {
|
|
return &namespacePatch{handlers: handlers}
|
|
}
|
|
|
|
func (w *namespacePatch) GetHandlers() []capsulewebhook.Handler {
|
|
return w.handlers
|
|
}
|
|
|
|
func (w *namespacePatch) GetPath() string {
|
|
return "/namespace-patch"
|
|
}
|