Files
capsule/internal/webhook/pod/imagepullpolicy_errors.go
Oliver Bähler 581a8fe60e feat(controller): administration persona (#1739)
* chore(refactor): project and api refactoring

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore(refactor): project and api refactoring

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

---------

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
2025-11-18 16:27:16 +01:00

28 lines
784 B
Go

// Copyright 2020-2025 Project Capsule Authors
// SPDX-License-Identifier: Apache-2.0
package pod
import (
"fmt"
"strings"
)
type imagePullPolicyForbiddenError struct {
usedPullPolicy string
allowedPullPolicies []string
containerName string
}
func NewImagePullPolicyForbidden(usedPullPolicy, containerName string, allowedPullPolicies []string) error {
return &imagePullPolicyForbiddenError{
usedPullPolicy: usedPullPolicy,
containerName: containerName,
allowedPullPolicies: allowedPullPolicies,
}
}
func (f imagePullPolicyForbiddenError) Error() (err string) {
return fmt.Sprintf("ImagePullPolicy %s for container %s is forbidden, use one of the followings: %s", f.usedPullPolicy, f.containerName, strings.Join(f.allowedPullPolicies, ", "))
}