failoverservice

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalDnsSuffix = ".global"
)

Variables

View Source
var (
	MissingHostname             = eris.New("Missing required field \"hostname\".")
	HostnameMissingGlobalSuffix = func(hostname string) error {
		return eris.Errorf("Provided hostname %s is missing required suffix \"%s\".", hostname, GlobalDnsSuffix)
	}
	MissingPort            = eris.New("Missing required field \"port\".")
	MissingMeshes          = eris.New("Missing required field \"meshes\".")
	MissingServices        = eris.New("There must be at least one service declared for the FailoverService.")
	BackingServiceNotFound = func(serviceRef *skv2core.ClusterObjectRef) error {
		return eris.Errorf("Backing service %s.%s.%s not found in GlooMesh discovery resources.",
			serviceRef.GetName(),
			serviceRef.GetNamespace(),
			serviceRef.GetClusterName())
	}
	MeshNotFound = func(meshRef *skv2core.ObjectRef, serviceRef *skv2core.ClusterObjectRef) error {
		return eris.Errorf("Mesh %s.%s for service %s.%s.%s not found in GlooMesh discovery resources.",
			meshRef.GetName(),
			meshRef.GetNamespace(),
			serviceRef.GetName(),
			serviceRef.GetNamespace(),
			serviceRef.GetClusterName())
	}
	UnsupportedMeshType = func(meshType interface{}, mesh *discoveryv1alpha2.Mesh) error {
		return eris.Errorf("Unsupported Mesh type %T for Mesh %s.%s", meshType, mesh.GetName(), mesh.GetNamespace())
	}
	UnsupportedServiceType = func(serviceType interface{}) error {
		return eris.Errorf("Unsupported service type %T", serviceType)
	}
	MeshWithoutParentVM = func(mesh *discoveryv1alpha2.Mesh) error {
		return eris.Errorf("Mesh %s.%s is not grouped in a VirtualMesh.", mesh.GetName(), mesh.GetNamespace())
	}
	MultipleParentVirtualMeshes = func(virtualMeshes []*networkingv1alpha2.VirtualMesh) error {
		var virtualMeshNames []string
		for _, vm := range virtualMeshes {
			virtualMeshNames = append(virtualMeshNames, fmt.Sprintf("%s.%s", vm.GetName(), vm.GetNamespace()))
		}
		return eris.Errorf("Services belong to multiple different parent VirtualMeshes: [%s]", strings.Join(virtualMeshNames, ", "))
	}
	MissingOutlierDetection = func(trafficTarget *discoveryv1alpha2.TrafficTarget) error {
		return eris.Errorf("Service %s.%s.%s does not have any TrafficPolicies that apply OutlierDetection settings.",
			trafficTarget.Spec.GetKubeService().GetRef().GetName(),
			trafficTarget.Spec.GetKubeService().GetRef().GetNamespace(),
			trafficTarget.Spec.GetKubeService().GetRef().GetClusterName())
	}
)

Functions

This section is empty.

Types

type FailoverServiceValidator

type FailoverServiceValidator interface {
	// Set the validation status for FailoverServices in the Inputs
	Validate(inputs Inputs, failoverService *networkingv1alpha2.FailoverServiceSpec) []error
}

A valid FailoverService must satisfy the following constraints:

1. TargetService must exist 2. Must consist of at least 1 failover service. 3. All declared failover services must exist. 4. All declared failover services must be owned by a supported Mesh type (currently only Istio). 5. All declared failover services must exist in the same VirtualMesh, or belong to a common parent Mesh. 6. All declared failover services must have OutlierDetection settings declared in a TP (grab this from the TrafficTarget status). 7. All targeted Meshes must be of a supported type.

func NewFailoverServiceValidator

func NewFailoverServiceValidator() FailoverServiceValidator

type Inputs

type Inputs struct {
	TrafficTargets discoveryv1alpha2sets.TrafficTargetSet
	// For validation
	KubeClusters  v1alpha1sets.KubernetesClusterSet
	Meshes        discoveryv1alpha2sets.MeshSet
	VirtualMeshes networkingv1alpha2sets.VirtualMeshSet
}

Directories

Path Synopsis
Package mock_validation is a generated GoMock package.
Package mock_validation is a generated GoMock package.

Jump to

Keyboard shortcuts

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