k8s

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 26 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
)

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.

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(log 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 IgnoreApps

func IgnoreApps(apps ...string) ResourceFilterOption

IgnoreApps add the given apps to the list of apps to ignore. An app is a Kubernetes object with an "app" label, the name of the app being the value of the label.

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