kubernetes

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEventRecorder

func CreateEventRecorder(kubernetes kubernetes.Interface, component string, log *logging.Logger) record.EventRecorder

func FindResourceForKind

func FindResourceForKind(discovery_ discoverypkg.DiscoveryInterface, gvk schema.GroupVersionKind, supportedVerbs ...string) (schema.GroupVersionResource, error)

func FindResourceForUnstructured

func FindResourceForUnstructured(discovery discoverypkg.DiscoveryInterface, object *unstructured.Unstructured, supportedVerbs ...string) (schema.GroupVersionResource, error)

func FindResourcesForKind

func FindResourcesForKind(discovery discoverypkg.DiscoveryInterface, gvk schema.GroupVersionKind, supportedVerbs ...string) ([]schema.GroupVersionResource, error)

func GetConfiguredNamespace

func GetConfiguredNamespace(configPath string, context string) (string, bool)

func GetControllerOf

func GetControllerOf(metaObject meta.Object) (schema.GroupVersionKind, string, error)

func GetFirstPodIP

func GetFirstPodIP(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) (string, error)

func GetFirstPodName

func GetFirstPodName(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) (string, error)

func GetFirstServiceIP

func GetFirstServiceIP(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) (string, error)

func GetInternalRegistryURL

func GetInternalRegistryURL(kubernetesClient kubernetes.Interface) (string, error)

func GetMetaObject

func GetMetaObject(object interface{}, log *logging.Logger) (meta.Object, error)

func GetPodIPs

func GetPodIPs(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) ([]string, error)

func GetPodNames

func GetPodNames(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) ([]string, error)

func GetPods

func GetPods(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) (*core.PodList, error)

func GetServiceIPs

func GetServiceIPs(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) ([]string, error)

func GetServices

func GetServices(context contextpkg.Context, kubernetes kubernetespkg.Interface, namespace string, appName string) (*core.ServiceList, error)

func GetUnstructuredGVK

func GetUnstructuredGVK(object *unstructured.Unstructured) (schema.GroupVersionKind, error)

func Log

func Log(kubernetes kubernetespkg.Interface, namespace string, podName string, containerName string, tail int, follow bool) (io.ReadCloser, error)

func NewConfig

func NewConfig(configPath string, context string) (*rest.Config, error)

func NewConfigForContext

func NewConfigForContext(configPath string, context string) (*rest.Config, error)

func NewConfigFromFlags

func NewConfigFromFlags(masterUrl string, configPath string, context string, log *logging.Logger) (*rest.Config, error)

See: clientcmd.BuildConfigFromFlags

func NewSelfContainedConfig

func NewSelfContainedConfig(restConfig *rest.Config, namespace string) (*api.Config, error)

func NewUnstructuredFromYAMLTemplate

func NewUnstructuredFromYAMLTemplate(code string, data interface{}) (*unstructured.Unstructured, error)

func ParseGVK

func ParseGVK(apiVersion string, kind string) (schema.GroupVersionKind, error)

func SetControllerOfUnstructured

func SetControllerOfUnstructured(object *unstructured.Unstructured, controllerObject meta.Object) error

controllerObject must also support schema.ObjectKind interface

func Shell

func Shell(rest restpkg.Interface, config *restpkg.Config, namespace string, podName string, containerName string, command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

Types

type Dynamic

type Dynamic struct {
	Dynamic         dynamicpkg.Interface
	Discovery       discovery.DiscoveryInterface
	InformerFactory dynamicinformer.DynamicSharedInformerFactory
	Log             *logging.Logger
	// contains filtered or unexported fields
}

func NewDynamic

func NewDynamic(toolName string, dynamic dynamicpkg.Interface, discovery discovery.DiscoveryInterface, namespace string, context context.Context) *Dynamic

func (*Dynamic) AddResourceEventHandler

func (self *Dynamic) AddResourceEventHandler(gvk schema.GroupVersionKind, stopChannel <-chan struct{}, handler cache.ResourceEventHandler) error

func (*Dynamic) AddUnstructuredResourceChangeHandler

func (self *Dynamic) AddUnstructuredResourceChangeHandler(gvk schema.GroupVersionKind, stopChannel <-chan struct{}, onChanged OnChangedFunc) error

func (*Dynamic) AddUnstructuredResourceEventHandlerFuncs

func (self *Dynamic) AddUnstructuredResourceEventHandlerFuncs(gvk schema.GroupVersionKind, stopChannel <-chan struct{}, onAdded OnAddedFunc, onUpdated OnUpdatedFunc, onDeleted OnDeletedFunc) error

func (*Dynamic) CreateControlledResource

func (self *Dynamic) CreateControlledResource(object *unstructured.Unstructured, controllerObject meta.Object, processors *Processors, stopChannel <-chan struct{}) (*unstructured.Unstructured, error)

controllerObject must also support schema.ObjectKind interface

func (*Dynamic) CreateResource

func (self *Dynamic) CreateResource(object *unstructured.Unstructured) (*unstructured.Unstructured, error)

func (*Dynamic) GetInformers

func (self *Dynamic) GetInformers(gvk schema.GroupVersionKind) ([]cache.SharedInformer, []cache.SharedInformer, error)

func (*Dynamic) GetResource

func (self *Dynamic) GetResource(gvk schema.GroupVersionKind, name string, namespace string) (*unstructured.Unstructured, error)

func (*Dynamic) UpdateResource

func (self *Dynamic) UpdateResource(object *unstructured.Unstructured) (*unstructured.Unstructured, error)

type GetControllerObjectFunc

type GetControllerObjectFunc = func(name string, namespace string) (interface{}, error)

type OnAddedFunc

type OnAddedFunc = func(object *unstructured.Unstructured) error

type OnChangedFunc

type OnChangedFunc = func(object *unstructured.Unstructured) error

type OnDeletedFunc

type OnDeletedFunc = func(object *unstructured.Unstructured) error

type OnUpdatedFunc

type OnUpdatedFunc = func(oldObject *unstructured.Unstructured, newObject *unstructured.Unstructured) error

type ProcessFunc

type ProcessFunc = func(object interface{}) (bool, error)

type Processor

type Processor struct {
	Name                string
	GVK                 schema.GroupVersionKind
	Informer            cache.SharedIndexInformer
	Workqueue           workqueue.RateLimitingInterface
	Period              time.Duration
	GetControllerObject GetControllerObjectFunc
	Process             ProcessFunc
	Log                 *logging.Logger
}

func NewProcessor

func NewProcessor(toolName string, name string, informer cache.SharedIndexInformer, period time.Duration, get GetControllerObjectFunc, process ProcessFunc) *Processor

func (*Processor) EnqueueFor

func (self *Processor) EnqueueFor(object interface{})

func (*Processor) HasSynced

func (self *Processor) HasSynced() bool

cache.InformerSynced signature

func (*Processor) Start

func (self *Processor) Start(concurrency uint, stopChannel <-chan struct{})

type Processors

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

func NewProcessors

func NewProcessors(toolName string) *Processors

func (*Processors) Add

func (self *Processors) Add(gvk schema.GroupVersionKind, processor *Processor)

func (*Processors) Control

func (self *Processors) Control(dynamic *Dynamic, controlledGvk schema.GroupVersionKind, stopChannel <-chan struct{}) error

func (*Processors) Get

func (self *Processors) Get(name string) (*Processor, bool)

func (*Processors) HasSynced

func (self *Processors) HasSynced() []cache.InformerSynced

func (*Processors) ShutDown

func (self *Processors) ShutDown()

func (*Processors) Start

func (self *Processors) Start(concurrency uint, stopChannel <-chan struct{})

func (*Processors) WaitForCacheSync

func (self *Processors) WaitForCacheSync(stopChannel <-chan struct{}) error

type UnstructuredResourceEventHandler

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

func NewUnstructuredResourceEventHandler

func NewUnstructuredResourceEventHandler(onAdded OnAddedFunc, onUpdated OnUpdatedFunc, onDeleted OnDeletedFunc) *UnstructuredResourceEventHandler

func (*UnstructuredResourceEventHandler) OnAdd

func (self *UnstructuredResourceEventHandler) OnAdd(object interface{})

cache.ResourceEventHandler interface

func (*UnstructuredResourceEventHandler) OnDelete

func (self *UnstructuredResourceEventHandler) OnDelete(object interface{})

cache.ResourceEventHandler interface

func (*UnstructuredResourceEventHandler) OnUpdate

func (self *UnstructuredResourceEventHandler) OnUpdate(oldObject interface{}, newObject interface{})

cache.ResourceEventHandler interface

Jump to

Keyboard shortcuts

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