Files
capsule/pkg/webhook/pod/imagepullpolicy_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

28 lines
785 B
Go

// Copyright 2020-2023 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, ", "))
}