validation

package
v1.13.0-beta26 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 26 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 = eris.New("proxy validation called before the validation server received its first sync of resources")

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

	GlooValidationResponseLengthError = func(reports []*gloovalidation.GlooValidationReport) error {
		return errors.Errorf("Expected Gloo validation response to contain 1 report, but contained %d",
			len(reports))
	}
)
View Source
var GvkSupportedDeleteGatewayResources = map[schema.GroupVersionKind]bool{
	v1.VirtualServiceGVK: true,
	v1.RouteTableGVK:     true,
}

GvkSupportedDeleteGatewayResources the current group of resources that can be validated

View Source
var GvkSupportedValidationGatewayResources = map[schema.GroupVersionKind]bool{
	v1.GatewayGVK:        true,
	v1.VirtualServiceGVK: true,
	v1.RouteTableGVK:     true,
}

GvkSupportedValidationGatewayResources the current group of resources that can be validated

Functions

func GetDelegateRef

func GetDelegateRef(delegate *v1.DelegateAction) *core.ResourceRef

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

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 GlooValidatorFunc added in v1.13.0

type GlooValidatorFunc = func(ctx context.Context, proxy *gloov1.Proxy,
	resource resources.Resource, delete 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 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
	// ModificationIsSupported returns whether a resource is supported
	ModificationIsSupported(gvk schema.GroupVersionKind) bool
	// DeletionIsSupported returns whether a deletion of a resource is supported
	DeletionIsSupported(gvk schema.GroupVersionKind) bool
}

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,
	glooValidator GlooValidatorFunc,
	ignoreProxyValidationFailure, allowWarnings bool,
) ValidatorConfig

Jump to

Keyboard shortcuts

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