userd_k8s

package
v2.4.10-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks struct {
	SetDNSSearchPath func(ctx context.Context, in *daemon.Paths, opts ...grpc.CallOption) (*empty.Empty, error)
}

type Cluster

type Cluster struct {
	*Config

	LocalIntercepts map[string]string
	// contains filtered or unexported fields
}

k8sCluster is a Kubernetes cluster reference

func NewCluster

func NewCluster(c context.Context, kubeFlags *Config, mappedNamespaces []string, callbacks Callbacks) (*Cluster, error)

func (*Cluster) ActualNamespace

func (kc *Cluster) ActualNamespace(namespace string) string

func (*Cluster) AddLocalOnlyIntercept

func (kc *Cluster) AddLocalOnlyIntercept(c context.Context, spec *manager.InterceptSpec) (*rpc.InterceptResult, error)

AddLocalOnlyIntercept adds a local-only intercept

func (*Cluster) Client

func (kc *Cluster) Client() *kates.Client

func (*Cluster) Deployments added in v2.3.7

func (kc *Cluster) Deployments(c context.Context, namespace string) ([]kates.Object, error)

Deployments returns all deployments found in the given Namespace

func (*Cluster) DetectIngressBehavior

func (kc *Cluster) DetectIngressBehavior(c context.Context) ([]*manager.IngressInfo, error)

TOOO: Move this to traffic-manager

func (*Cluster) FindAgain added in v2.3.7

func (kc *Cluster) FindAgain(c context.Context, obj kates.Object) (kates.Object, error)

FindAgain returns a fresh version of the given object.

func (*Cluster) FindDeployment

func (kc *Cluster) FindDeployment(c context.Context, namespace, name string) (*kates.Deployment, error)

FindDeployment returns a deployment with the given name in the given namespace or nil if no such deployment could be found.

func (*Cluster) FindPod

func (kc *Cluster) FindPod(c context.Context, namespace, name string) (*kates.Pod, error)

FindPod returns a pod with the given name in the given namespace or nil if no such replica set could be found.

func (*Cluster) FindPodFromSelector added in v2.4.4

func (kc *Cluster) FindPodFromSelector(c context.Context, namespace string, selector map[string]string) (*kates.Pod, error)

FindPodFromSelector returns a pod with the given name-hex-hex

func (*Cluster) FindSvc

func (kc *Cluster) FindSvc(c context.Context, namespace, name string) (*kates.Service, error)

FindSvc finds a service with the given name in the given Namespace and returns either a copy of that service or nil if no such service could be found.

func (*Cluster) FindWorkload added in v2.3.7

func (kc *Cluster) FindWorkload(c context.Context, namespace, name, workloadKind string) (kates.Object, error)

FindWorkload returns a workload for the given name, namespace, and workloadKind. The workloadKind is optional. A search is performed in the following order if it is empty:

  1. Deployments
  2. ReplicaSets
  3. StatefulSets

The first match is returned.

func (*Cluster) GetClusterId

func (kc *Cluster) GetClusterId(ctx context.Context) string

func (*Cluster) Pods added in v2.3.7

func (kc *Cluster) Pods(c context.Context, namespace string) ([]*kates.Pod, error)

Pods returns all pods found in the given Namespace

func (*Cluster) RemoveLocalOnlyIntercept

func (kc *Cluster) RemoveLocalOnlyIntercept(c context.Context, name, namespace string) error

func (*Cluster) ReplicaSets added in v2.3.7

func (kc *Cluster) ReplicaSets(c context.Context, namespace string) ([]kates.Object, error)

ReplicaSets returns all replica sets found in the given Namespace

func (*Cluster) RunWatchers

func (kc *Cluster) RunWatchers(c context.Context) (err error)

RunWatchers runs a set of Kubernetes watchers that provide information from the cluster which is then used for controlling the outbound connectivity of the cluster.

Initially, a watcher that watches the namespaces is created. Once it produces its first snapshot, some filtering is done on the list in that snapshot and then one watcher for each resulting namespace is created that watches pods and services. When their snapshot arrives, these pods and services are used when creating IP-tables that are sent to the NAT-logic in the daemon.

The filtered list of namespaces is also used for creating a DNS search path which is propagated to the DNS-resolver in the daemon.

When an update arrives in the namespace watcher, it will refresh the DNS-search path and the current set of watchers so that new watchers are added for added namespaces and watchers for namespaces that have been will be cancelled.

If a pods and services watcher receives an update, it will send an updated IP-table to the daemon.

func (*Cluster) SetInterceptedNamespaces

func (kc *Cluster) SetInterceptedNamespaces(c context.Context, interceptedNamespaces map[string]struct{})

func (*Cluster) SetMappedNamespaces

func (kc *Cluster) SetMappedNamespaces(c context.Context, namespaces []string)

func (*Cluster) StatefulSets added in v2.3.7

func (kc *Cluster) StatefulSets(c context.Context, namespace string) ([]kates.Object, error)

StatefulSets returns all stateful sets found in the given Namespace

func (*Cluster) WaitUntilReady

func (kc *Cluster) WaitUntilReady(ctx context.Context) error

type Config

type Config struct {
	Namespace string // default cluster namespace.
	Context   string
	Server    string

	ConfigFlags *kates.ConfigFlags
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(c context.Context, flagMap map[string]string) (*Config, error)

func (*Config) ContextServiceAndFlagsEqual added in v2.4.1

func (kf *Config) ContextServiceAndFlagsEqual(okf *Config) bool

ContextServiceAndFlagsEqual determines if this instance is equal to the given instance with respect to context, server, and flag arguments.

func (*Config) GetManagerNamespace added in v2.4.6

func (kf *Config) GetManagerNamespace() string

type ResourceFinder added in v2.4.7

type ResourceFinder interface {
	FindDeployment(c context.Context, namespace, name string) (*kates.Deployment, error)
	FindPod(c context.Context, namespace, name string) (*kates.Pod, error)
	FindSvc(c context.Context, namespace, name string) (*kates.Service, error)
}

Jump to

Keyboard shortcuts

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