mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-08-19 04:26:45 +00:00
* fix(controller): decode old object for delete requests Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: modernize golang Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: modernize golang Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * chore: modernize golang Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> * fix: avoid rejection when users are classified as administrators Signed-off-by: Oliver Baehler <oliver@sudo-i.net> --------- Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com> Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
33 lines
542 B
Go
33 lines
542 B
Go
// Copyright 2020-2026 Project Capsule Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
package admission
|
|
|
|
import (
|
|
"path"
|
|
"strings"
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
|
)
|
|
|
|
func Deny(message string) *admission.Response {
|
|
response := admission.Denied(message)
|
|
|
|
return &response
|
|
}
|
|
|
|
func Allow(message string) *admission.Response {
|
|
response := admission.Allowed(message)
|
|
|
|
return &response
|
|
}
|
|
|
|
func normalizePath(p string) string {
|
|
if p == "" {
|
|
return ""
|
|
}
|
|
|
|
p = "/" + strings.TrimLeft(p, "/")
|
|
|
|
return path.Clean(p)
|
|
}
|