kubernetes

package
v0.1.41 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: Apache-2.0 Imports: 38 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopySecret added in v0.1.6

func CopySecret(context contextpkg.Context, kubernetes kubernetespkg.Interface, fromNamespace string, fromName string, toNamespace string, toName string) (*core.Secret, error)

func CreateEventRecorder

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

func Exec added in v0.1.4

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

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 GetInternalRegistryHost added in v0.1.7

func GetInternalRegistryHost(context contextpkg.Context, kubernetes kubernetespkg.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 GetSecretTLSCertBytes added in v0.1.7

func GetSecretTLSCertBytes(secret *core.Secret, secretDataKey string) ([]byte, 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 JSONString added in v0.1.6

func JSONString(value interface{}) apiextensions.JSON

func Log

func Log(context contextpkg.Context, 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 NewNotFound added in v0.1.4

func NewNotFound(gk schema.GroupKind, message string) *errorspkg.StatusError

Variation on errorspkg.NewNotFound

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 ReadFromContainer added in v0.1.4

func ReadFromContainer(rest restpkg.Interface, config *restpkg.Config, namespace string, podName string, containerName string, writer io.Writer, sourcePath string) error

func RegistryCredentialsAuth added in v0.1.6

func RegistryCredentialsAuth(username string, password string) string

func SetControllerOfUnstructured

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

controllerObject must also support schema.ObjectKind interface

func WaitForDeletion added in v0.1.7

func WaitForDeletion(log logging.Logger, name string, condition func() bool)

func WaitForDeployment added in v0.1.7

func WaitForDeployment(context contextpkg.Context, kubernetes kubernetespkg.Interface, log logging.Logger, namespace string, appName string) (*apps.Deployment, error)

func WaitForPod added in v0.1.7

func WaitForPod(context contextpkg.Context, kubernetes kubernetespkg.Interface, log logging.Logger, namespace string, appName string) (*core.Pod, error)

func WriteToContainer added in v0.1.4

func WriteToContainer(rest restpkg.Interface, config *restpkg.Config, namespace string, podName string, containerName string, reader io.Reader, targetPath string, permissions *int64) 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 ExecError added in v0.1.11

type ExecError struct {
	Err    error
	Stderr string
}

func NewExecError added in v0.1.11

func NewExecError(err error, stderr string) *ExecError

func (*ExecError) Error added in v0.1.11

func (self *ExecError) Error() string

error interface

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 RegistryCredentials added in v0.1.6

type RegistryCredentials struct {
	Username string
	Password string
}

func NewRegistryCredentials added in v0.1.6

func NewRegistryCredentials(username string, password string) *RegistryCredentials

func NewRegistryCredentialsFromARD added in v0.1.6

func NewRegistryCredentialsFromARD(value ard.Value) (*RegistryCredentials, error)

func (*RegistryCredentials) ToARD added in v0.1.6

func (self *RegistryCredentials) ToARD() ard.Value

type RegistryCredentialsTable added in v0.1.6

type RegistryCredentialsTable map[string]*RegistryCredentials

func NewRegistryCredentialsTableFromARD added in v0.1.6

func NewRegistryCredentialsTableFromARD(value ard.Value) (RegistryCredentialsTable, error)

func NewRegistryCredentialsTableFromSecret added in v0.1.6

func NewRegistryCredentialsTableFromSecret(secret *core.Secret) (RegistryCredentialsTable, error)

func (RegistryCredentialsTable) ToARD added in v0.1.6

func (self RegistryCredentialsTable) ToARD() ard.Value

func (RegistryCredentialsTable) ToDockerConfigJSON added in v0.1.6

func (self RegistryCredentialsTable) ToDockerConfigJSON() (string, error)

func (RegistryCredentialsTable) ToSecret added in v0.1.6

func (self RegistryCredentialsTable) ToSecret(secret *core.Secret) 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