common

package
v3.11.1-0...-4446e78 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package common defines the types and functions that are shared by multiple commands in the cmd package.

Index

Constants

View Source
const (
	// LeaseDuration is the default duration for the leader election lease.
	LeaseDuration = 90 * time.Second
	// RenewDeadline is the default duration for the leader renewal.
	RenewDeadline = 60 * time.Second
	// RetryPeriod is the default duration for the leader electrion retrial.
	RetryPeriod = 30 * time.Second
)

Variables

This section is empty.

Functions

func CreateResourceLock

func CreateResourceLock(cb *ClientBuilder, componentNamespace, componentName string) resourcelock.Interface

CreateResourceLock returns an interface for the resource lock.

Types

type ClientBuilder

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

ClientBuilder can create a variety of kubernetes client interface with its embeded rest.Config.

func NewClientBuilder

func NewClientBuilder(kubeconfig string) (*ClientBuilder, error)

NewClientBuilder returns a *ClientBuilder with the given kubeconfig.

func (*ClientBuilder) APIExtClientOrDie

func (cb *ClientBuilder) APIExtClientOrDie(name string) apiext.Interface

ClientOrDie returns the kubernetes client interface for extended kubernetes objects.

func (*ClientBuilder) ConfigClientOrDie

func (cb *ClientBuilder) ConfigClientOrDie(name string) configclientset.Interface

ClientOrDie returns the kubernetes client interface for security related kubernetes objects such as pod security policy, security context.

func (*ClientBuilder) KubeClientOrDie

func (cb *ClientBuilder) KubeClientOrDie(name string) kubernetes.Interface

ClientOrDie returns the kubernetes client interface for general kubernetes objects.

func (*ClientBuilder) MachineConfigClientOrDie

func (cb *ClientBuilder) MachineConfigClientOrDie(name string) mcfgclientset.Interface

ClientOrDie returns the kubernetes client interface for machine config.

type ControllerContext

type ControllerContext struct {
	ClientBuilder *ClientBuilder

	NamespacedInformerFactory     mcfginformers.SharedInformerFactory
	InformerFactory               mcfginformers.SharedInformerFactory
	KubeInformerFactory           informers.SharedInformerFactory
	KubeNamespacedInformerFactory informers.SharedInformerFactory
	APIExtInformerFactory         apiextinformers.SharedInformerFactory

	AvailableResources map[schema.GroupVersionResource]bool

	Stop <-chan struct{}

	InformersStarted chan struct{}

	KubeInformersStarted chan struct{}

	ResyncPeriod func() time.Duration
}

ControllerContext stores all the informers for a variety of kubernetes objects.

func CreateControllerContext

func CreateControllerContext(cb *ClientBuilder, stop <-chan struct{}, targetNamespace string) *ControllerContext

CreateControllerContext creates the ControllerContext with the ClientBuilder.

Jump to

Keyboard shortcuts

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