validators

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AM0001 = types.Validator{
	Code:        "AM0001",
	Name:        "default_channel",
	Description: "Ensure defaultChannel is present in list of channels",
	Runner:      validateDefaultChannel,
}
View Source
var AM0002 = types.Validator{
	Code:        "AM0002",
	Name:        "label_format",
	Description: "Validates whether label follows the format 'api.openshift.com/addon-<id>'",
	Runner:      validateAddonLabel,
}
View Source
var AM0004 = types.Validator{
	Code:        "AM0004",
	Name:        "icon_base64",
	Description: "Ensure that `icon` in Addon metadata is rightfully base64 encoded",
	Runner:      ValidateIconBase64,
}
View Source
var AM0005 = types.Validator{
	Code:        "AM0005",
	Name:        "test_harness",
	Description: "Ensure that an addon has a valid testharness image",
	Runner:      ValidateTestHarness,
}
View Source
var AM0006 = types.Validator{
	Code:        "AM0006",
	Name:        "dms_snitchnamepostfix",
	Description: "Ensure `deadmanssnitch.snitchNamePostFix` doesn't begin with 'hive-'",
	Runner:      ValidateDmsSnitchNamePostFix,
}
View Source
var AM0007 = types.Validator{
	Code:        "AM0007",
	Name:        "csv_install_modes",
	Description: "Validate installMode is supported.",
	Runner:      validateCSVInstallModes,
}
View Source
var AM0008 = types.Validator{
	Code:        "AM0008",
	Name:        "ensure_namespace",
	Description: "Ensure that the target namespace is listed in the set of channels listed",
	Runner:      ValidateNamespace,
}
View Source
var AM0009 = types.Validator{
	Code:        "AM0009",
	Name:        "addon_parameters",
	Description: "Ensure `addOnParameters` section in the addon metadata is rightfully defined",
	Runner:      ValidateAddonParameters,
}
View Source
var AM0010 = types.Validator{
	Code:        "AM0010",
	Name:        "k8s_resource_and_field_names",
	Description: "Validates k8s namespaces, labels, and annotations within Addon metadata against k8s standards",
	Runner:      Validatek8sResourceAndFieldNames,
}
View Source
var AM0011 = types.Validator{
	Code:        "AM0011",
	Name:        "sku_validation",
	Description: "Validates whether a SKU Rule exists in OCM for quota provided in addon metadata",
	Runner:      ValidateOCMSKUExists,
}
View Source
var AM0012 = types.Validator{
	Code:        "AM0012",
	Name:        "csv_permissions",
	Description: "validates the permissions specified in the csv",
	Runner:      validateCsvRbac,
}

Registry - holds all registered Validators

Functions

func CLIMiddlewares added in v0.7.0

func CLIMiddlewares(v types.Validator) types.Validator

CLIMiddlewares - wraps a validator with all CLI Middlewares. Order is important!

func Error added in v0.7.0

func Error(err error) types.ValidatorResult

func Fail added in v0.7.0

func Fail(msgs ...string) types.ValidatorResult

func GenerateOCMSKUValidator added in v0.8.0

func GenerateOCMSKUValidator(ocm OCMClient) types.ValidateFunc

func IsOCMServerSideError added in v0.8.0

func IsOCMServerSideError(err error) bool

IsOCMServerSideError determines if the given error is both an instance of OCMError and was caused by a server-side issue.

func NewValidatorsRegistry added in v0.8.0

func NewValidatorsRegistry() *defaultRegistry

func RetryMiddleware added in v0.7.0

func RetryMiddleware(v types.Validator) types.Validator

func RetryableError added in v0.7.0

func RetryableError(err error) types.ValidatorResult

RetryableError - used by the Retry middleware to automatically re-run validators

func Success added in v0.7.0

func Success() types.ValidatorResult

func ValidateAddonParameters added in v0.7.0

func ValidateAddonParameters(mb types.MetaBundle) types.ValidatorResult

func ValidateDmsSnitchNamePostFix added in v0.7.0

func ValidateDmsSnitchNamePostFix(mb types.MetaBundle) types.ValidatorResult

func ValidateIconBase64 added in v0.6.0

func ValidateIconBase64(mb types.MetaBundle) types.ValidatorResult

ValidateIconBase64 validates 'icon' in the addon metadata is rightfully base64 encoded

func ValidateNamespace added in v0.6.0

func ValidateNamespace(mb types.MetaBundle) types.ValidatorResult

func ValidateOCMSKUExists added in v0.8.0

func ValidateOCMSKUExists(mb types.MetaBundle) types.ValidatorResult

func ValidateTestHarness added in v0.6.0

func ValidateTestHarness(mb types.MetaBundle) types.ValidatorResult

func Validatek8sResourceAndFieldNames added in v0.8.0

func Validatek8sResourceAndFieldNames(mb types.MetaBundle) types.ValidatorResult

Types

type CSVSpec added in v0.7.0

type CSVSpec struct {
	InstallModes []operatorsv1alpha1.InstallMode `json:"installModes"`
}

type OCMClient added in v0.8.0

type OCMClient interface {
	QuotaRuleGetter
	// Stuck here until OCM Client can be injected via Params...
	CloseConnection() error
}

OCMClient abstracts behavior required for validators which request data from OCM to be implemented by OCM API clients.

type OCMError added in v0.8.0

type OCMError interface {
	// ServerSide returns 'true' if an instance of OCMError was caused
	// by a server-side issue.
	ServerSide() bool
}

OCMError abstracts behavior required for validators to identify the underlying causes of OCM related errors.

type QuotaRuleGetter added in v0.10.0

type QuotaRuleGetter interface {
	QuotaRuleExists(context.Context, string) (bool, error)
}

Jump to

Keyboard shortcuts

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