Files
capsule/pkg/webhook/pod/runtimeclass_errors.go
Dario Tranchitella a49c57bb5b feat: runtimeclass default support (#1165)
* fix(makefile): no need specifying ginkgo version

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* fix(chore): referring to make using shortcut

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* feat: default runtimeclass webhook

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* feat(helm): default runtimeclass spec

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

---------

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>
2024-08-20 10:50:26 +02:00

30 lines
773 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 podRuntimeClassForbiddenError struct {
runtimeClassName string
spec api.DefaultAllowedListSpec
}
func NewPodRuntimeClassForbidden(runtimeClassName string, spec api.DefaultAllowedListSpec) error {
return &podRuntimeClassForbiddenError{
runtimeClassName: runtimeClassName,
spec: spec,
}
}
func (f podRuntimeClassForbiddenError) Error() (err string) {
err = fmt.Sprintf("Pod Runtime Class %s is forbidden for the current Tenant: ", f.runtimeClassName)
return utils.DefaultAllowedValuesErrorMessage(f.spec, err)
}