utils

package
v0.3.25 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationFromProto

func DurationFromProto(p *types.Duration) (time.Duration, error)

DurationFromProto converts a Duration to a time.Duration. DurationFromProto returns an error if the Duration is invalid or is too large to be represented in a time.Duration.

func DurationProto

func DurationProto(d time.Duration) *types.Duration

DurationProto converts a time.Duration to a Duration.

func GetHostForUpstream

func GetHostForUpstream(us *gloov1.Upstream) (string, error)

func GetHostsForUpstream

func GetHostsForUpstream(us *gloov1.Upstream) ([]string, error)

func GetLabelsForUpstream

func GetLabelsForUpstream(us *gloov1.Upstream) map[string]string

func GetNamespaceForUpstream

func GetNamespaceForUpstream(us *gloov1.Upstream) string

func GetPortForUpstream

func GetPortForUpstream(us *gloov1.Upstream) (uint32, error)

func GetUpstreamHostPortsLabels added in v0.3.18

func GetUpstreamHostPortsLabels(us *gloov1.Upstream) (string, uint32, map[string]string, error)

func GetUpstreamKubeSpec added in v0.3.22

func GetUpstreamKubeSpec(us *gloov1.Upstream) (*kubernetes.UpstreamSpec, error)

func HostnameSelected added in v0.3.18

func HostnameSelected(hostname string, selector *v1.PodSelector, upstreams gloov1.UpstreamList) (bool, error)

func HostsForUpstreams added in v0.3.11

func HostsForUpstreams(upstreams gloov1.UpstreamList) ([]string, error)

func LabelsFromUpstreams added in v0.3.18

func LabelsFromUpstreams(upstreams gloov1.UpstreamList) ([]map[string]string, error)

func PodsForSelector

func PodsForSelector(selector *v1.PodSelector, upstreams gloov1.UpstreamList, allPods kubernetes.PodList) (kubernetes.PodList, error)

func PodsForUpstreams

func PodsForUpstreams(upstreams gloov1.UpstreamList, allPods kubernetes.PodList) kubernetes.PodList

func PortsFromUpstreams added in v0.3.18

func PortsFromUpstreams(upstreams gloov1.UpstreamList) ([]uint32, error)

func ServiceHost added in v0.3.22

func ServiceHost(serviceName, serviceNamespace string) string

TODO (ilackarms): consider multi-cluster here

func ServicesForSelector added in v0.3.22

func ServicesForSelector(selector *v1.PodSelector, upstreams gloov1.UpstreamList, allServices kubernetes.ServiceList) (kubernetes.ServiceList, error)

func ServicesForUpstreams added in v0.3.22

func ServicesForUpstreams(upstreams gloov1.UpstreamList, allServices kubernetes.ServiceList) kubernetes.ServiceList

func SubsetName

func SubsetName(labels map[string]string) string

func UpstreamServicesByHost added in v0.3.18

func UpstreamServicesByHost(upstreams gloov1.UpstreamList) (map[string]*UpstreamService, error)

func UpstreamsForPods added in v0.3.23

func UpstreamsForPods(pods kubernetes.PodList, allUpstreams gloov1.UpstreamList) gloov1.UpstreamList

func UpstreamsForSelector

func UpstreamsForSelector(selector *v1.PodSelector, allUpstreams gloov1.UpstreamList) (gloov1.UpstreamList, error)

func ValidateMeshGroups added in v0.3.8

func ValidateMeshGroups(meshes v1.MeshList, meshGroups v1.MeshGroupList, resourceErrs reporter.ResourceErrors)

Types

type RuleSet added in v0.3.8

type RuleSet struct {
	Routing  v1.RoutingRuleList
	Security v1.SecurityRuleList
}

type RulesByMesh added in v0.3.8

type RulesByMesh map[*v1.Mesh]RuleSet

func GroupRulesByMesh added in v0.3.8

func GroupRulesByMesh(
	routingRules v1.RoutingRuleList,
	securityRules v1.SecurityRuleList,
	meshes v1.MeshList,
	meshGroups v1.MeshGroupList,
	resourceErrs reporter.ResourceErrors) RulesByMesh

type UpstreamService added in v0.3.18

type UpstreamService struct {
	Host      string
	LabelSets []map[string]string
	Ports     []uint32
	Upstreams gloov1.UpstreamList // the upstreams this service was created from
}

one (kube) service that maps to multiple upstreams

func ServiceFromHost added in v0.3.18

func ServiceFromHost(host string, upstreams gloov1.UpstreamList) (*UpstreamService, error)

only selects the first upstream in each list with a unique host, drop the others

Jump to

Keyboard shortcuts

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