validation

package
v1.22.4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 32 Imported by: 2

README

When creating a new resource Group extend the Validator.go methodModificationIsSupported() and DeletionIsSupported().

We will also have to update the Webhook Validator helm values as well in install/helm/gloo/templates/5-gateway-validation-webhook-configuration.yaml

Documentation

Index

Constants

View Source
const GatewayGroup = "gateway.solo.io"
View Source
const (
	InvalidSnapshotErrMessage = "validation is disabled due to an invalid resource which has been written to storage. " +
		"Please correct any Rejected resources to re-enable validation."
)

Variables

View Source
var (
	NotReadyErr             = errors.Errorf("validation is not yet available. Waiting for first snapshot")
	HasNotReceivedFirstSync = errors.New("proxy validation called before the validation server received its first sync of resources")

	WrappedUnmarshalErr = func(err error) error {
		return errors.Wrap(err, unmarshalErrMsg)
	}

	BreakingErrorLogMsg = "Breaking errors found, not revalidating against original snapshot"
)

Functions

func MakeNotificationChannel added in v1.2.8

func MakeNotificationChannel(ctx context.Context, client validation.GlooValidationServiceClient) (<-chan struct{}, error)

func NewConnectionRefreshingValidationClient added in v0.20.3

func NewConnectionRefreshingValidationClient(constructValidationClient func() (validation.GlooValidationServiceClient, error)) (*connectionRefreshingValidationClient, error)

func NewValidator

func NewValidator(cfg ValidatorConfig) *validator

func UnmarshalResource added in v1.13.0

func UnmarshalResource(kubeJson []byte, resource resources.Resource) error

UnmarshalResource is the same as the solo-kit pkg/utils/protoutils.Unmarshal() except it does not set the status of the resource since validation does not write the resources, this is ok. Validation will only store the state of a resource to the copy of the snapshot.

Types

type ClientConstructor added in v0.20.3

type ClientConstructor func() (client validation.GlooValidationServiceClient, e error)

func RetryOnUnavailableClientConstructor added in v0.20.3

func RetryOnUnavailableClientConstructor(ctx context.Context, serverAddress string) ClientConstructor

the constructor returned here is not threadsafe; call from a lock

type GlooValidationResponseLengthError added in v1.9.0

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

This error is a struct so it can be checked with errors.As

func (GlooValidationResponseLengthError) Error added in v1.16.5

type GlooValidatorFunc added in v1.13.0

type GlooValidatorFunc = func(ctx context.Context, proxy *gloov1.Proxy,
	resource resources.Resource, shouldDelete bool,
) ([]*gloovalidation.GlooValidationReport, error)

type ProxyReports added in v0.20.3

type ProxyReports []*validation.ProxyReport

type Reports added in v1.9.0

type Reports struct {
	Proxies      []*gloov1.Proxy
	ProxyReports *ProxyReports
}

func (*Reports) GetProxies added in v1.9.0

func (r *Reports) GetProxies() []*gloov1.Proxy

type UpstreamReports added in v1.9.0

type UpstreamReports []*validation.ResourceReport

type ValidationIncompleteError added in v1.19.23

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

ValidationIncompleteError means gloo validation did not complete: the validation server had not received its first sync, or an envoy validation fork was interrupted. It is a struct so it can be checked with errors.As.

func (ValidationIncompleteError) Error added in v1.19.23

func (ValidationIncompleteError) Unwrap added in v1.19.23

func (e ValidationIncompleteError) Unwrap() error

Unwrap keeps the wrapped cause reachable through errors.Is and errors.As.

type Validator

type Validator interface {
	gloov1snap.ApiSyncer
	// ValidateList will validate a list of resources
	ValidateList(ctx context.Context, ul *unstructured.UnstructuredList, dryRun bool) (*Reports, *multierror.Error)
	// ValidateModifiedGvk validate the creation or update of a resource.
	ValidateModifiedGvk(ctx context.Context, gvk schema.GroupVersionKind, resource resources.Resource, dryRun bool) (*Reports, error)
	// ValidateDeletedGvk validate the deletion of a resource.
	ValidateDeletedGvk(ctx context.Context, gvk schema.GroupVersionKind, resource resources.Resource, dryRun bool) error
}

type ValidatorConfig added in v0.20.3

type ValidatorConfig struct {
	Translator                            translator.Translator
	GlooValidator                         GlooValidatorFunc
	ExtensionValidator                    syncerValidation.Validator
	AllowWarnings                         bool
	DisableValidationAgainstPreviousState bool
}

Jump to

Keyboard shortcuts

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