k8s

package
v2.0.0-...-ec94ed8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResyncPeriod set the resync period.
	ResyncPeriod = 5 * time.Minute

	// TrafficSplitObjectKind is the name of an SMI object of kind TrafficSplit.
	TrafficSplitObjectKind = "TrafficSplit"
	// TrafficTargetObjectKind is the name of an SMI object of kind TrafficTarget.
	TrafficTargetObjectKind = "TrafficTarget"
	// HTTPRouteGroupObjectKind is the name of an SMI object of kind HTTPRouteGroup.
	HTTPRouteGroupObjectKind = "HTTPRouteGroup"
	// TCPRouteObjectKind is the name of an SMI object of kind TCPRoute.
	TCPRouteObjectKind = "TCPRoute"

	// CoreObjectKinds is a filter for objects to process by the core client.
	CoreObjectKinds = "Deployment|Endpoints|Service|Ingress|Secret|Namespace|Pod|ConfigMap"
	// AccessObjectKinds is a filter for objects to process by the access client.
	AccessObjectKinds = TrafficTargetObjectKind
	// SpecsObjectKinds is a filter for objects to process by the specs client.
	SpecsObjectKinds = HTTPRouteGroupObjectKind + "|" + TCPRouteObjectKind
	// SplitObjectKinds is a filter for objects to process by the split client.
	SplitObjectKinds = TrafficSplitObjectKind
)
View Source
const (
	// LabelName is used for specifying the name of the app.
	LabelName = "app.kubernetes.io/name"
	// LabelComponent is used for specifying a specific component of the app.
	LabelComponent = "app.kubernetes.io/component"
	// LabelPartOf is used for specifying the name of a higher level app it is part of.
	LabelPartOf = "app.kubernetes.io/part-of"
	// LabelServiceName is the name of the label for storing the name of the source service for a shadow service.
	LabelServiceName = "mesh.traefik.io/service-name"
	// LabelServiceNamespace is the name of the label for storing the namespace of the source service for a shadow service.
	LabelServiceNamespace = "mesh.traefik.io/service-namespace"

	// AppName is the name of the app.
	AppName = "traefik-mesh"

	// ComponentProxy is component of type proxy.
	ComponentProxy = "proxy"
	// ComponentShadowService is component of type shadow-service.
	ComponentShadowService = "shadow-service"
)

Variables

This section is empty.

Functions

func CheckSMIVersion

func CheckSMIVersion(client kubernetes.Interface, aclEnabled bool) error

CheckSMIVersion checks if the SMI CRDs versions installed match the supported versions.

func MustParseYaml

func MustParseYaml(content []byte) []runtime.Object

MustParseYaml parses a YAML to objects.

func ProxyLabels

func ProxyLabels() map[string]string

ProxyLabels returns the labels of a proxy.

func ShadowServiceLabels

func ShadowServiceLabels() map[string]string

ShadowServiceLabels returns the labels of a shadow service.

func ShadowServiceSelector

func ShadowServiceSelector() labels.Selector

ShadowServiceSelector creates a label selector for shadow services.

Types

type Client

type Client interface {
	KubernetesClient() kubernetes.Interface
	AccessClient() accessclient.Interface
	SpecsClient() specsclient.Interface
	SplitClient() splitclient.Interface
}

Client is an interface for the various resource controllers.

func NewClient

func NewClient(logger logrus.FieldLogger, masterURL, kubeConfig string) (Client, error)

NewClient creates and returns a ClientWrapper that satisfies the Client interface.

type ClientMock

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

ClientMock holds mock client.

func NewClientMock

func NewClientMock(path string) *ClientMock

NewClientMock create a new client mock.

func (*ClientMock) AccessClient

func (c *ClientMock) AccessClient() accessclient.Interface

AccessClient is used to get the SMI Access clientset.

func (*ClientMock) KubernetesClient

func (c *ClientMock) KubernetesClient() kubeclient.Interface

KubernetesClient is used to get the kubernetes clientset.

func (*ClientMock) SpecsClient

func (c *ClientMock) SpecsClient() specsclient.Interface

SpecsClient is used to get the SMI Specs clientset.

func (*ClientMock) SplitClient

func (c *ClientMock) SplitClient() splitclient.Interface

SplitClient is used to get the SMI Split clientset.

type ClientWrapper

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

ClientWrapper holds the clients for the various resource controllers.

func (*ClientWrapper) AccessClient

func (w *ClientWrapper) AccessClient() accessclient.Interface

AccessClient is used to get the SMI Access clientset.

func (*ClientWrapper) KubernetesClient

func (w *ClientWrapper) KubernetesClient() kubernetes.Interface

KubernetesClient is used to get the kubernetes clientset.

func (*ClientWrapper) SpecsClient

func (w *ClientWrapper) SpecsClient() specsclient.Interface

SpecsClient is used to get the SMI Specs clientset.

func (*ClientWrapper) SplitClient

func (w *ClientWrapper) SplitClient() splitclient.Interface

SplitClient is used to get the SMI Split clientset.

type ResourceFilter

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

ResourceFilter holds resource filtering rules.

func NewResourceFilter

func NewResourceFilter(opts ...ResourceFilterOption) *ResourceFilter

NewResourceFilter creates a new ResourceFilter, configured with the given options.

func (*ResourceFilter) IsIgnored

func (f *ResourceFilter) IsIgnored(obj interface{}) bool

IsIgnored returns true if the resource should be ignored.

type ResourceFilterOption

type ResourceFilterOption func(filter *ResourceFilter)

ResourceFilterOption adds a filtering rule to the given ResourceFilter.

func IgnoreLabel

func IgnoreLabel(name, value string) ResourceFilterOption

IgnoreLabel ignores resources with the given label and value.

func IgnoreNamespaces

func IgnoreNamespaces(namespaces ...string) ResourceFilterOption

IgnoreNamespaces adds the given namespaces to the list of namespaces to ignore.

func IgnoreService

func IgnoreService(namespace, name string) ResourceFilterOption

IgnoreService adds the service to the list of service to ignore.

func WatchNamespaces

func WatchNamespaces(namespaces ...string) ResourceFilterOption

WatchNamespaces add the given namespaces to the list of namespaces to watch.

Jump to

Keyboard shortcuts

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