validation

package
v0.0.0-...-71898da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package validation provides UpgradeConfig CR validation tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ValidationBuilder

type ValidationBuilder interface {
	NewClient(configmanager.ConfigManager) (Validator, error)
}

ValidationBuilder is a interface that enables ValidationBuiler implementations

func NewBuilder

func NewBuilder() ValidationBuilder

NewBuilder returns a validationBuilder object that implements the ValidationBuilder interface.

type ValidationConfig

type ValidationConfig struct {
	Validation validation `yaml:"validation"`
}

ValidationConfig holds fields that control version validation

func (*ValidationConfig) IsValid

func (cfg *ValidationConfig) IsValid() error

IsValid returns a nil error when the UpgradeConfigManagerConfig is valid

type Validator

type Validator interface {
	IsValidUpgradeConfig(c client.Client, uC *upgradev1alpha1.UpgradeConfig, cV *configv1.ClusterVersion, logger logr.Logger) (ValidatorResult, error)
}

Validator knows how to validate UpgradeConfig CRs.

type ValidatorResult

type ValidatorResult struct {
	// Indicates that the UpgradeConfig is semantically and syntactically valid
	IsValid bool
	// Indicates that the UpgradeConfig should be actioned to conduct an upgrade
	IsAvailableUpdate bool
	// A message associated with the validation result
	Message string
}

ValidatorResult returns a type that enables validation of upgradeconfigs

type VersionComparison

type VersionComparison int

VersionComparison is an in used to compare versions

const (
	// VersionUnknown is of type VersionComparision and is used to idicate an unknown version
	VersionUnknown VersionComparison = iota - 2
	// VersionDowngrade is of type VersionComparision and is used to idicate an version downgrade
	VersionDowngrade
	// VersionEqual is of type VersionComparision and is used to idicate version are equal
	VersionEqual
	// VersionUpgrade is of type VersionComparision and is used to idicate version is able to upgrade
	VersionUpgrade
)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL