validation

package
v0.2.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module added in v0.1.2

func Module() fx.Option

Module provides fx module for configmap validator.

Types

type CMFileValidator

type CMFileValidator interface {
	CheckCMName(name string) bool
	ValidateFile(
		ctx context.Context,
		name string,
		yamlSrc []byte,
	) (bool, string, error)
}

CMFileValidator is an interface for configmap validation.

type CMValidator

type CMValidator struct {
	// contains filtered or unexported fields
}

CMValidator validates the policies configmap.

func NewCMValidator

func NewCMValidator(validators []CMFileValidator) *CMValidator

NewCMValidator creates a NewCMValidator.

func (*CMValidator) ValidateConfigMap

func (v *CMValidator) ValidateConfigMap(ctx context.Context, cm corev1.ConfigMap) (bool, string, error)

ValidateConfigMap checks if configmap is valid

returns: * true, "", nil when config is valid * false, message, nil when config is invalid and * false, "", err on other errors.

func (*CMValidator) ValidateObject

func (v *CMValidator) ValidateObject(
	ctx context.Context,
	req *admissionv1.AdmissionRequest,
) (ok bool, msg string, err error)

ValidateObject checks the validity of a object as a k8s object.

type FxIn added in v0.1.3

type FxIn struct {
	fx.In
	Webhooks   *webhooks.K8sRegistry
	Validators []CMFileValidator `group:"cm-file-validators"`
}

FxIn is a struct that contains all dependencies for configmap validator.

Jump to

Keyboard shortcuts

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