Documentation
¶
Overview ¶
Copyright The Shipwright Contributors
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func All(ctx context.Context, validations ...BuildPath) error
- func BuildParameters(parameterDefinitions []buildapi.Parameter, ...) (bool, buildapi.BuildReason, string)
- func BuildRunFields(buildRun *buildapi.BuildRun) (string, string)
- func BuildRunNodeSelector(nodeSelector map[string]string) (bool, string, string)
- func BuildRunParameters(parameterDefinitions []buildapi.Parameter, ...) (bool, string, string)
- func BuildRunRuntimeClassName(runtimeClassName *string) (bool, string, string)
- func BuildRunSchedulerName(schedulerName *string) (bool, string, string)
- func BuildRunStepResources(strategySteps []buildapi.Step, ...) (bool, string, string)
- func BuildRunTolerations(tolerations []corev1.Toleration) (bool, string, string)
- func BuildRunVolumes(strategyVolumes []buildapi.BuildStrategyVolume, ...) (bool, string, string)
- func BuildStepResources(strategySteps []buildapi.Step, ...) (bool, buildapi.BuildReason, string)
- func BuildVolumes(strategyVolumes []buildapi.BuildStrategyVolume, ...) (bool, buildapi.BuildReason, string)
- func ValidateMultiArchPreflight(platforms []buildapi.ImagePlatform, nodeSelector map[string]string, ...) (bool, string, string)
- func ValidateNodeAvailability(platforms []buildapi.ImagePlatform, nodes []corev1.Node) (bool, string, string)
- func ValidateOutputNodeSelector(nodeSelector map[string]string) (bool, string, string)
- func ValidatePipelineRunExecutor(executor string) (bool, string, string)
- func ValidatePlatforms(platforms []buildapi.ImagePlatform) (bool, string, string)
- type BuildNameRef
- type BuildPath
- type BuildSpecOutputValidator
- type Credentials
- type Env
- type NodeSelectorRef
- type OwnerRef
- type RuntimeClassNameRef
- type SchedulerNameRef
- type SourceRef
- type SourceURLRef
- type Strategy
- type TolerationsRef
- type Trigger
Constants ¶
const ( // Secrets for validating secret references in Build objects Secrets = "secrets" // Strategies for validating strategy references in Build objects Strategies = "strategy" // SourceURL for validating the source URL in Build objects SourceURL = "sourceurl" // Sources for validating `spec.sources` entries Source = "source" // Output for validating `spec.output` entry Output = "output" // BuildName for validating `metadata.name` entry BuildName = "buildname" // Envs for validating `spec.env` entries Envs = "env" // OwnerReferences for validating the ownerreferences between a Build // and BuildRun objects OwnerReferences = "ownerreferences" // Triggers for validating the `.spec.triggers` entries Triggers = "triggers" // NodeSelector for validating `spec.nodeSelector` entry NodeSelector = "nodeselector" // Tolerations for validating `spec.tolerations` entry Tolerations = "tolerations" // SchedulerName for validating `spec.schedulerName` entry SchedulerName = "schedulername" // RuntimeClassName for validating `spec.runtimeClassName` entry RuntimeClassName = "runtimeclassname" )
Variables ¶
This section is empty.
Functions ¶
func BuildParameters ¶ added in v0.9.0
func BuildParameters(parameterDefinitions []buildapi.Parameter, buildParamValues []buildapi.ParamValue) (bool, buildapi.BuildReason, string)
BuildParameters validates that the parameter values specified in Build are suitable for what is defined in the BuildStrategy
func BuildRunFields ¶ added in v0.9.0
BuildRunFields runs field validations against a BuildRun to detect disallowed field combinations and issues
func BuildRunNodeSelector ¶ added in v0.15.0
BuildRunNodeSelector is used to validate nodeSelectors in the BuildRun object
func BuildRunParameters ¶ added in v0.9.0
func BuildRunParameters(parameterDefinitions []buildapi.Parameter, buildParamValues []buildapi.ParamValue, buildRunParamValues []buildapi.ParamValue) (bool, string, string)
BuildRunParameters validates that the parameter values specified in Build and BuildRun are suitable for what is defined in the BuildStrategy
func BuildRunRuntimeClassName ¶ added in v0.19.0
BuildRunRuntimeClassName is used to validate the runtimeClassName in the BuildRun object
func BuildRunSchedulerName ¶ added in v0.15.0
BuildSchedulerName is used to validate the schedulerName in the BuildRun object
func BuildRunStepResources ¶ added in v0.19.0
func BuildRunStepResources(strategySteps []buildapi.Step, buildRunStepResources []buildapi.StepResourceOverride) (bool, string, string)
BuildRunStepResources validates that all step resource overrides in the BuildRun reference steps that exist in the build strategy.
func BuildRunTolerations ¶ added in v0.15.0
func BuildRunTolerations(tolerations []corev1.Toleration) (bool, string, string)
BuildRunTolerations is used to validate tolerations in the BuildRun object
func BuildRunVolumes ¶ added in v0.10.0
func BuildRunVolumes(strategyVolumes []buildapi.BuildStrategyVolume, buildVolumes []buildapi.BuildVolume) (bool, string, string)
BuildRunVolumes is used to validate volumes in the BuildRun object
func BuildStepResources ¶ added in v0.19.0
func BuildStepResources(strategySteps []buildapi.Step, buildStepResources []buildapi.StepResourceOverride) (bool, buildapi.BuildReason, string)
BuildStepResources validates that all step resource overrides in the Build reference steps that exist in the build strategy.
func BuildVolumes ¶ added in v0.10.0
func BuildVolumes(strategyVolumes []buildapi.BuildStrategyVolume, buildVolumes []buildapi.BuildVolume) (bool, buildapi.BuildReason, string)
BuildVolumes is used to validate volumes in the Build object
func ValidateMultiArchPreflight ¶ added in v0.20.0
func ValidateMultiArchPreflight(platforms []buildapi.ImagePlatform, nodeSelector map[string]string, executor string) (bool, string, string)
ValidateMultiArchPreflight runs platform, nodeSelector, and executor checks before the reconciler lists Nodes. If this returns (true, "", ""), the caller may List Nodes and then call ValidateNodeAvailability.
func ValidateNodeAvailability ¶ added in v0.20.0
func ValidateNodeAvailability(platforms []buildapi.ImagePlatform, nodes []corev1.Node) (bool, string, string)
ValidateNodeAvailability checks that, for each requested platform, the cluster has at least one node that is Ready, is not unschedulable, and has kubernetes.io/os and kubernetes.io/arch labels matching that platform.
func ValidateOutputNodeSelector ¶ added in v0.20.0
ValidateOutputNodeSelector checks that nodeSelector does not conflict with output platform scheduling.
func ValidatePipelineRunExecutor ¶ added in v0.20.0
ValidatePipelineRunExecutor checks that the controller is configured with PipelineRun executor mode, which is required for multi-arch builds to orchestrate per-platform PipelineTasks.
func ValidatePlatforms ¶ added in v0.20.0
func ValidatePlatforms(platforms []buildapi.ImagePlatform) (bool, string, string)
ValidatePlatforms validates spec.output.platforms when non-empty.
Types ¶
type BuildNameRef ¶ added in v0.6.0
BuildNameRef contains all required fields to validate a build name
func NewBuildName ¶ added in v0.9.0
func NewBuildName(build *buildapi.Build) *BuildNameRef
func (*BuildNameRef) ValidatePath ¶ added in v0.6.0
func (b *BuildNameRef) ValidatePath(_ context.Context) error
ValidatePath implements BuildPath interface and validates that build name is a valid label value
type BuildPath ¶
BuildPath is an interface that holds a ValidatePath() function for validating different Build spec paths
type BuildSpecOutputValidator ¶ added in v0.13.0
BuildSpecOutputValidator implements validation interface to add validations for `buildapi.spec.output`.
func (*BuildSpecOutputValidator) ValidatePath ¶ added in v0.13.0
func (b *BuildSpecOutputValidator) ValidatePath(_ context.Context) error
type Credentials ¶ added in v0.4.0
Credentials contains all required fields to validate a Build spec secrets definitions
func NewCredentials ¶ added in v0.9.0
func NewCredentials(client client.Client, build *buildapi.Build) *Credentials
func (Credentials) ValidatePath ¶ added in v0.4.0
func (s Credentials) ValidatePath(ctx context.Context) error
ValidatePath implements BuildPath interface and validates that all referenced secrets under spec exists
type Env ¶ added in v0.6.0
Env implements the Env interface to add validations for the `buildapi.spec.env` slice.
type NodeSelectorRef ¶ added in v0.14.0
NodeSelectorRef contains all required fields to validate a node selector
func NewNodeSelector ¶ added in v0.14.0
func NewNodeSelector(build *buildapi.Build) *NodeSelectorRef
func (*NodeSelectorRef) ValidatePath ¶ added in v0.14.0
func (b *NodeSelectorRef) ValidatePath(_ context.Context) error
ValidatePath implements BuildPath interface and validates that NodeSelector keys/values are valid labels
type RuntimeClassNameRef ¶ added in v0.19.0
RuntimeClassNameRef contains all required fields to validate a RuntimeClassName
func NewRuntimeClassName ¶ added in v0.19.0
func NewRuntimeClassName(build *buildapi.Build) *RuntimeClassNameRef
func (*RuntimeClassNameRef) ValidatePath ¶ added in v0.19.0
func (b *RuntimeClassNameRef) ValidatePath(_ context.Context) error
ValidatePath implements BuildPath interface and validates that RuntimeClassName values are valid
type SchedulerNameRef ¶ added in v0.15.0
SchedulerNameRef contains all required fields to validate a Scheduler name
func NewSchedulerName ¶ added in v0.15.0
func NewSchedulerName(build *buildapi.Build) *SchedulerNameRef
func (*SchedulerNameRef) ValidatePath ¶ added in v0.15.0
func (b *SchedulerNameRef) ValidatePath(_ context.Context) error
ValidatePath implements BuildPath interface and validates that SchedulerName values are valid
type SourceRef ¶ added in v0.13.0
SourcesRef implements RuntimeRef interface to add validations for `buildapi.spec.source`.
func NewSourceRef ¶ added in v0.13.0
NewSourcesRef instantiate a new SourcesRef passing the build object pointer along.
type SourceURLRef ¶
SourceURLRef contains all required fields to validate a Build spec source definition
func NewSourceURL ¶ added in v0.9.0
func NewSourceURL(client client.Client, build *buildapi.Build) *SourceURLRef
func (SourceURLRef) MarkBuildStatus ¶
func (s SourceURLRef) MarkBuildStatus(b *buildapi.Build, reason buildapi.BuildReason, msg string)
MarkBuildStatus updates a Build Status fields
func (SourceURLRef) ValidatePath ¶
func (s SourceURLRef) ValidatePath(ctx context.Context) error
ValidatePath implements BuildPath interface and validates that the spec.source.url exists. This validation only applies to endpoints that do not require authentication.
type Strategy ¶ added in v0.4.0
Strategy contains all required fields to validate a Build spec strategy definition
func NewStrategies ¶ added in v0.9.0
type TolerationsRef ¶ added in v0.15.0
TolerationsRef contains all required fields to validate tolerations
func NewTolerations ¶ added in v0.15.0
func NewTolerations(build *buildapi.Build) *TolerationsRef
func (*TolerationsRef) ValidatePath ¶ added in v0.15.0
func (b *TolerationsRef) ValidatePath(_ context.Context) error
ValidatePath implements BuildPath interface and validates that tolerations key/operator/value are valid
type Trigger ¶ added in v0.11.0
type Trigger struct {
// contains filtered or unexported fields
}
Trigger implements the interface BuildPath with the objective of applying validations against the `.spec.trigger` related attributes.
func NewTrigger ¶ added in v0.11.0
NewTrigger instantiate Trigger validation helper.