k8s

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP returns the non loopback local IP of the host

func NodeNameFilter

func NodeNameFilter(nodeName string) internalinterfaces.TweakListOptionsFunc

NodeNameFilter will tweak the options to include the node name as field selector.

Types

type Client

type Client interface {
	// Start just starts any informers required.
	Start(<-chan struct{})
	// GetPod returns the pod object based on name and namespce
	GetPod(namespace, name string) (v1.Pod, error)
	// GetPodInfo returns the pod name, namespace & replica set name for a given pod ip
	GetPodInfo(podip string) (podns, podname, rsName string, selectors *metav1.LabelSelector, err error)
	// ListPodIds pod matching azure identity or nil
	ListPodIds(podns, podname string) (map[string][]aadpodid.AzureIdentity, error)
	// ListPodIdsWithBinding pod matching azure identity or nil
	ListPodIdsWithBinding(podns string, labels map[string]string) ([]aadpodid.AzureIdentity, error)
	// GetSecret returns secret the secretRef represents
	GetSecret(secretRef *v1.SecretReference) (*v1.Secret, error)
	// ListPodIdentityExceptions returns list of azurepodidentityexceptions
	ListPodIdentityExceptions(namespace string) (*[]aadpodid.AzurePodIdentityException, error)
}

Client api client

func NewFakeClient

func NewFakeClient() (Client, error)

NewFakeClient new fake kubernetes api client

func NewKubeClient

func NewKubeClient(nodeName string, scale, isStandardMode bool) (Client, error)

NewKubeClient new kubernetes api client

type FakeClient

type FakeClient struct {
}

FakeClient implements Interface

func (*FakeClient) GetPod

func (c *FakeClient) GetPod(podns, podname string) (v1.Pod, error)

GetPod returns fake pod object and nil error

func (*FakeClient) GetPodInfo

func (c *FakeClient) GetPodInfo(podip string) (podns, podname, rsName string, selectors *metav1.LabelSelector, err error)

GetPodInfo returns fake pod name, namespace and replicaset

func (*FakeClient) GetSecret

func (c *FakeClient) GetSecret(secretRef *v1.SecretReference) (*v1.Secret, error)

GetSecret returns secret the secretRef represents

func (*FakeClient) ListPodIdentityExceptions

func (c *FakeClient) ListPodIdentityExceptions(ns string) (*[]aadpodid.AzurePodIdentityException, error)

ListPodIdentityExceptions for pod

func (*FakeClient) ListPodIds

func (c *FakeClient) ListPodIds(podns, podname string) (map[string][]aadpodid.AzureIdentity, error)

ListPodIds for pod

func (*FakeClient) ListPodIdsWithBinding

func (c *FakeClient) ListPodIdsWithBinding(podns string, labels map[string]string) ([]aadpodid.AzureIdentity, error)

ListPodIdsWithBinding for pod

func (*FakeClient) Start

func (c *FakeClient) Start(exit <-chan struct{})

Start - for starting informer clients in the fake Client

type KubeClient

type KubeClient struct {
	// Main Kubernetes client
	ClientSet kubernetes.Interface
	// Crd client used to access our CRD resources.
	CrdClient   *crd.Client
	PodInformer cache.SharedIndexInformer
	// contains filtered or unexported fields
}

KubeClient k8s client

func (*KubeClient) GetPod

func (c *KubeClient) GetPod(namespace, name string) (v1.Pod, error)

GetPod returns pod that matches namespace and name

func (*KubeClient) GetPodInfo

func (c *KubeClient) GetPodInfo(podip string) (podns, poddname, rsName string, labels *metav1.LabelSelector, err error)

GetPodInfo get pod ns,name from apiserver

func (*KubeClient) GetSecret

func (c *KubeClient) GetSecret(secretRef *v1.SecretReference) (*v1.Secret, error)

GetSecret returns secret the secretRef represents

func (*KubeClient) ListPodIdentityExceptions

func (c *KubeClient) ListPodIdentityExceptions(ns string) (*[]aadpodid.AzurePodIdentityException, error)

ListPodIdentityExceptions lists azurepodidentityexceptions

func (*KubeClient) ListPodIds

func (c *KubeClient) ListPodIds(podns, podname string) (map[string][]aadpodid.AzureIdentity, error)

ListPodIds lists matching ids for pod or error

func (*KubeClient) ListPodIdsWithBinding

func (c *KubeClient) ListPodIdsWithBinding(podns string, labels map[string]string) ([]aadpodid.AzureIdentity, error)

ListPodIdsWithBinding list matching ids for pod based on the bindings

func (*KubeClient) Start

func (c *KubeClient) Start(exit <-chan struct{})

Start the corresponding starts

func (*KubeClient) Sync

func (c *KubeClient) Sync(exit <-chan struct{})

Sync syncs the cache from the K8s client.

Jump to

Keyboard shortcuts

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