validation

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const LOGGER_NAME string = "k8s-resource-validator"

Variables

This section is empty.

Functions

func LogViolations added in v0.1.1

func LogViolations(ctx context.Context, violations []common.Violation, thresholdLevelForErrors int) error

LogViolations() writes violations to a logger. It is a convenience method. You may choose to write violations to the log in a different format.

ctx is expected to contain the logger

thresholdLevelForErrors specifies that violations of this level or below are considered errors; others are info

Types

type K8SProvider

type K8SProvider struct {
	Dynamic   dynamic.Interface
	ClientSet kubernetes.Interface
}

type Validation

type Validation struct {
	Client                            *K8SProvider
	Resources                         []unstructured.Unstructured
	AbortValidationConfigMapField     string
	AbortValidationConfigMapName      string
	AbortValidationConfigMapNamespace string

	PreValidated bool
	// contains filtered or unexported fields
}

func NewValidation

func NewValidation(ctx context.Context) (*Validation, error)

func (*Validation) SetAbortFunc

func (v *Validation) SetAbortFunc(abortFunc common.AbortFunc)

func (*Validation) SetAppFileSystem added in v0.2.1

func (v *Validation) SetAppFileSystem(appFs afero.Fs)

func (*Validation) SetClient

func (v *Validation) SetClient(client *K8SProvider)

func (*Validation) SetContext added in v0.2.1

func (v *Validation) SetContext(context context.Context)

If this function is not called, a new client will be created in preValidate()

func (*Validation) SetLogger added in v0.2.1

func (v *Validation) SetLogger(logger logr.Logger)

func (*Validation) Validate

func (v *Validation) Validate(validators []common.Validator) ([]common.Violation, error)

returns a slice of violations (empty if no violations are found)

Jump to

Keyboard shortcuts

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