mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-08-22 14:07:10 +00:00
feat: upstream enterprise preview --------- Signed-off-by: Oliver Baehler <oliver@sudo-i.net> Co-authored-by: CorentinPtrl <pitrel.corentin@gmail.com>
27 lines
431 B
Go
27 lines
431 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 normalizePath(p string) string {
|
|
if p == "" {
|
|
return ""
|
|
}
|
|
|
|
p = "/" + strings.TrimLeft(p, "/")
|
|
|
|
return path.Clean(p)
|
|
}
|