Files
capsule/pkg/webhook/pod/priorityclass_errors.go
Dario Tranchitella 0830b3629e chore(header): moving to new neutral organization
Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>
2023-10-16 21:29:23 +02:00

30 lines
786 B
Go

// Copyright 2020-2023 Project Capsule Authors.
// SPDX-License-Identifier: Apache-2.0
package pod
import (
"fmt"
"github.com/projectcapsule/capsule/pkg/api"
"github.com/projectcapsule/capsule/pkg/webhook/utils"
)
type podPriorityClassForbiddenError struct {
priorityClassName string
spec api.DefaultAllowedListSpec
}
func NewPodPriorityClassForbidden(priorityClassName string, spec api.DefaultAllowedListSpec) error {
return &podPriorityClassForbiddenError{
priorityClassName: priorityClassName,
spec: spec,
}
}
func (f podPriorityClassForbiddenError) Error() (err string) {
msg := fmt.Sprintf("Pod Priority Class %s is forbidden for the current Tenant: ", f.priorityClassName)
return utils.DefaultAllowedValuesErrorMessage(f.spec, msg)
}