validation

package
v1.15.12 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 29 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))
	}
)

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

type ValidatorConfig added in v0.20.3

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

Jump to

Keyboard shortcuts

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