mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-08-23 14:36:54 +00:00
* chore * perfromance improvements Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * perfromance improvements Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * feat(performance): removed duplicate client calls from all admission paths Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * feat(performance): removed duplicate client calls from all admission paths Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * feat(performance): removed duplicate client calls from all admission paths Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * feat(performance): removed duplicate client calls from all admission paths Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * feat(performance): removed duplicate client calls from all admission paths Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * feat(performance): removed duplicate client calls from all admission paths Signed-off-by: Oliver Baehler <oliver@sudo-i.net> * feat(performance): removed duplicate client calls from all admission paths Signed-off-by: Oliver Baehler <oliver@sudo-i.net> --------- Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
36 lines
844 B
Go
36 lines
844 B
Go
// Copyright 2020-2026 Project Capsule Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package quota
|
|
|
|
import (
|
|
"k8s.io/apimachinery/pkg/api/resource"
|
|
|
|
celruntime "github.com/projectcapsule/capsule/pkg/runtime/cel"
|
|
"github.com/projectcapsule/capsule/pkg/runtime/jsonpath"
|
|
)
|
|
|
|
// Overlay for Global/Namespace CustomQuotas.
|
|
type MatchedQuota struct {
|
|
Key string
|
|
Name string
|
|
Namespace string
|
|
Path string
|
|
CompiledPath *jsonpath.CompiledJSONPath
|
|
CEL string
|
|
CompiledCEL *celruntime.CompiledExpression
|
|
Operation Operation
|
|
Limit resource.Quantity
|
|
Used resource.Quantity
|
|
IsGlobal bool
|
|
SourceRank int
|
|
}
|
|
|
|
func MakeCustomQuotaCacheKey(namespace, name string) string {
|
|
return namespace + "/" + name
|
|
}
|
|
|
|
func MakeGlobalCustomQuotaCacheKey(name string) string {
|
|
return "C/" + name
|
|
}
|