Files
capsule/pkg/webhook/pod/imagepullpolicy_errors.go
Oliver Bähler 3682283352 chore: add license headers (#1504)
* chore: add nwa

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

* chore: update helm-schema version

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

* chore: update helm-schema version

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

---------

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
2025-06-13 07:31:04 +02: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, ", "))
}