validation

package
v1.11.36 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 27 Imported by: 2

Documentation

Index

Constants

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")

	RouteTableDeleteErr = func(parentVirtualServices, parentRouteTables []*core.ResourceRef) error {
		return errors.Errorf("Deletion blocked because active Routes delegate to this Route Table. Remove delegate actions to this route table from the virtual services: %v and the route tables: %v, then try again", parentVirtualServices, parentRouteTables)
	}
	VirtualServiceDeleteErr = func(parentGateways []*core.ResourceRef) error {
		return errors.Errorf("Deletion blocked because active Gateways reference this Virtual Service. Remove refs to this virtual service from the gateways: %v, then try again", parentGateways)
	}

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

	GlooValidationResponseLengthError = func(resp *validation.GlooValidationServiceResponse) error {
		return errors.Errorf("Expected Gloo validation response to contain 1 report, but contained %d", len(resp.GetValidationReports()))
	}
)

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), defaultOpts []grpc.CallOption) (*connectionRefreshingValidationClient, error)

func NewValidator

func NewValidator(cfg ValidatorConfig) *validator

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 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
	UpstreamReports *UpstreamReports
}

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 Validator

type Validator interface {
	v1.ApiSyncer
	ValidateList(ctx context.Context, ul *unstructured.UnstructuredList, dryRun bool) (*Reports, *multierror.Error)
	ValidateGateway(ctx context.Context, gw *v1.Gateway, dryRun bool) (*Reports, error)
	ValidateVirtualService(ctx context.Context, vs *v1.VirtualService, dryRun bool) (*Reports, error)
	ValidateDeleteVirtualService(ctx context.Context, vs *core.ResourceRef, dryRun bool) error
	ValidateRouteTable(ctx context.Context, rt *v1.RouteTable, dryRun bool) (*Reports, error)
	ValidateDeleteRouteTable(ctx context.Context, rt *core.ResourceRef, dryRun bool) error
	ValidateUpstream(ctx context.Context, us *gloov1.Upstream, dryRun bool) (*Reports, error)
	ValidateDeleteUpstream(ctx context.Context, us *core.ResourceRef, dryRun bool) error
	ValidateDeleteSecret(ctx context.Context, secret *core.ResourceRef, dryRun bool) error
}

type ValidatorConfig added in v0.20.3

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

func NewValidatorConfig added in v0.20.3

func NewValidatorConfig(
	translator translator.Translator,
	validationClient validation.GlooValidationServiceClient,
	ignoreProxyValidationFailure, allowWarnings bool,
) ValidatorConfig

Jump to

Keyboard shortcuts

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