k8s

package
v0.0.0-...-7b4a977 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNamespaceServiceAccountAnnotation

func GetNamespaceServiceAccountAnnotation(ns *v1.Namespace, namespaceKey string) []string

GetNamespaceServiceAccountAnnotation reads the "iam.amazonaws.com/allowed-serviceAccounts" annotation off a namespace and splits them as a JSON list (["serviceAccount1", "serviceAccount2", "serviceAccount3"])

func NamespaceIndexFunc

func NamespaceIndexFunc(obj interface{}) ([]string, error)

NamespaceIndexFunc maps a namespace to it's name.

func PodIPIndexFunc

func PodIPIndexFunc(obj interface{}) ([]string, error)

PodIPIndexFunc maps a given Pod to it's IP for caching.

Types

type Client

type Client struct {
	*kubernetes.Clientset
	// contains filtered or unexported fields
}

Client represents a kubernetes client.

func NewClient

func NewClient(master, kubeconfig string) (*Client, error)

NewClient returns a new kubernetes client.

func (*Client) ListNamespaces

func (k8s *Client) ListNamespaces() []string

ListNamespaces returns the underlying set of namespaces being managed/indexed

func (*Client) ListPodIPs

func (k8s *Client) ListPodIPs() []string

ListPodIPs returns the underlying set of pods being managed/indexed

func (*Client) NamespaceByName

func (k8s *Client) NamespaceByName(namespaceName string) (*v1.Namespace, error)

NamespaceByName retrieves a namespace by it's given name. Returns an error if there are no namespaces available

func (*Client) PodByIP

func (k8s *Client) PodByIP(IP string) (*v1.Pod, error)

PodByIP provides the representation of the pod itself being cached keyed off of it's IP Returns an error if there are multiple pods attempting to be keyed off of the same IP (Which happens when they of type `hostNetwork: true`)

func (*Client) WatchForNamespaces

func (k8s *Client) WatchForNamespaces(nsEventLogger cache.ResourceEventHandler) cache.InformerSynced

WatchForNamespaces watches for namespaces changes.

func (*Client) WatchForPods

func (k8s *Client) WatchForPods(podEventLogger cache.ResourceEventHandler) cache.InformerSynced

WatchForPods watches for pod changes.

type NamespaceHandler

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

NamespaceHandler outputs change events from K8.

func NewNamespaceHandler

func NewNamespaceHandler(namespaceKey string) *NamespaceHandler

NewNamespaceHandler returns a new namespace handler.

func (*NamespaceHandler) OnAdd

func (h *NamespaceHandler) OnAdd(obj interface{})

OnAdd called with a namespace is added to k8s.

func (*NamespaceHandler) OnDelete

func (h *NamespaceHandler) OnDelete(obj interface{})

OnDelete called with a namespace is removed from k8s.

func (*NamespaceHandler) OnUpdate

func (h *NamespaceHandler) OnUpdate(oldObj, newObj interface{})

OnUpdate called with a namespace is updated inside k8s.

type PodHandler

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

PodHandler represents a pod handler.

func NewPodHandler

func NewPodHandler(iamServiceAccountKey string) *PodHandler

NewPodHandler constructs a pod handler given the relevant IAM ServiceAccount Key

func (*PodHandler) OnAdd

func (p *PodHandler) OnAdd(obj interface{})

OnAdd is called when a pod is added.

func (*PodHandler) OnDelete

func (p *PodHandler) OnDelete(obj interface{})

OnDelete is called when a pod is deleted.

func (*PodHandler) OnUpdate

func (p *PodHandler) OnUpdate(oldObj, newObj interface{})

OnUpdate is called when a pod is modified.

Jump to

Keyboard shortcuts

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