Files
capsule/pkg/runtime/admission/utils.go
T
Oliver BählerandGitHub b783d03f44 fix: avoid rejection when users are classified as administrators (#1941)
* 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>
2026-06-02 14:17:27 +02:00

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)
}