k8s

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FinalizerMeshMembers           = "finalizers.appmesh.k8s.aws/mesh-members"
	FinalizerVirtualGatewayMembers = "finalizers.appmesh.k8s.aws/virtualgateway-members"
	FinalizerAWSAppMeshResources   = "finalizers.appmesh.k8s.aws/aws-appmesh-resources"
	FinalizerAWSCloudMapResources  = "finalizers.appmesh.k8s.aws/aws-cloudmap-resources"
)
View Source
const (
	ConditionAWSCloudMapHealthy = "conditions.appmesh.k8s.aws/aws-cloudmap-healthy"
)
View Source
const (
	//NamespaceIndexKey to index objects in datastore
	NamespaceIndexKey = "namespace"
)

Variables

This section is empty.

Functions

func GetPodCondition

func GetPodCondition(pod *corev1.Pod, conditionType corev1.PodConditionType) *corev1.PodCondition

GetPodCondition will get pointer to Pod's existing condition.

func HasFinalizer

func HasFinalizer(obj metav1.Object, finalizer string) bool

HasFinalizer tests whether k8s object has specified finalizer

func NamespaceKeyIndexFunc added in v1.3.0

func NamespaceKeyIndexFunc() cache.IndexFunc

NamespaceKeyIndexFunc returns indexers to index objects in datastore using namespace

func NamespacedName

func NamespacedName(obj metav1.Object) types.NamespacedName

NamespacedName returns the namespaced name for k8s objects

func UpdatePodCondition

func UpdatePodCondition(pod *corev1.Pod, conditionType corev1.PodConditionType, status corev1.ConditionStatus, reason *string, message *string) bool

UpdatePodCondition will update Pod's condition. returns whether it's updated.

Types

type APIObject

type APIObject interface {
	metav1.Object
	runtime.Object
}

type Controller added in v1.3.0

type Controller interface {
	// StartController starts the controller. Will block the calling routine
	StartController(dataStore cache.Indexer, stopChanel chan struct{})
	// GetDataStore returns the data store once it has synced with the API Server
	GetDataStore() cache.Indexer
}

Controller Interface implemented by PodController

type Converter added in v1.3.0

type Converter interface {
	// ConvertObject takes an object and returns the modified object which will be
	// stored in the data store
	ConvertObject(originalObj interface{}) (convertedObj interface{}, err error)
	// ConvertList takes an object and returns the modified list of objects which
	// will be returned to the Simple Pager function to aggregate the list pagination
	// response
	ConvertList(originalList interface{}) (convertedList interface{}, err error)
	// Resource returns the K8s resource name to list/watch
	Resource() string
	// ResourceType returns the k8s object to list/watch
	ResourceType() runtime.Object
}

Converter for converting k8s object and object list used in watches and list operation

type CustomController added in v1.3.0

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

CustomController is an Informer which converts Pod Objects and notifies corresponding event handlers via Channels

func NewCustomController added in v1.3.0

func NewCustomController(clientSet *kubernetes.Clientset, pageLimit int64, namesspace string, converter Converter, resyncPeriod time.Duration,
	retryOnError bool, eventNotificationChan chan<- GenericEvent, log logr.Logger) *CustomController

NewCustomController returns a new podController object

func (*CustomController) GetDataStore added in v1.3.0

func (c *CustomController) GetDataStore() cache.Indexer

GetDataStore returns the data store when it has successfully synced with API Server

func (*CustomController) StartController added in v1.3.0

func (c *CustomController) StartController(stopChanel <-chan struct{})

StartController starts the custom controller by doing a list and watch on the specified k8s resource. The controller would store the converted k8s object in the provided indexer. The stop channel should be notified to stop the controller

type EventType added in v1.3.0

type EventType int

EventType identifies type of PodEvent (CREATE/UPDATE/DELETE)

const (
	// CREATE event for given object
	CREATE EventType = 1

	// DELETE event for given object
	DELETE EventType = 2

	// UPDATE event for given object
	UPDATE EventType = 3
)

type FinalizerManager

type FinalizerManager interface {
	AddFinalizers(ctx context.Context, obj APIObject, finalizers ...string) error
	RemoveFinalizers(ctx context.Context, obj APIObject, finalizers ...string) error
}

func NewDefaultFinalizerManager

func NewDefaultFinalizerManager(k8sClient client.Client, log logr.Logger) FinalizerManager

type GenericEvent added in v1.3.0

type GenericEvent struct {
	EventType

	// Meta is the ObjectMeta from the incoming request
	Meta metav1.Object

	// Object is the object from the incoming request
	Object runtime.Object

	// OldMeta is the ObjectMeta of existing object.Only populated for DELETE and UPDATE requests.
	OldMeta metav1.Object

	// OldObject is the existing object. Only populated for DELETE and UPDATE requests.
	OldObject runtime.Object
}

GenericEvent is a wrapper for Create/Update/Delete Events

type NotificationChannel added in v1.3.0

type NotificationChannel struct {
	Source <-chan GenericEvent
	// contains filtered or unexported fields
}

NotificationChannel monitors channels of type Create/Update/Delete

func (*NotificationChannel) InjectStopChannel added in v1.3.0

func (cs *NotificationChannel) InjectStopChannel(stop <-chan struct{}) error

InjectStopChannel is internal should be called only by the Controller. It is used to inject the stop channel initialized by the ControllerManager.

func (*NotificationChannel) Start added in v1.3.0

Start implements Source and should only be called by the Controller.

func (*NotificationChannel) String added in v1.3.0

func (cs *NotificationChannel) String() string

type PodsRepository added in v1.3.0

type PodsRepository interface {
	GetPod(namespace string, name string) (*v1.Pod, error)
	ListPodsWithMatchingLabels(opts client.ListOptions) (*v1.PodList, error)
}

PodsRepository represents an interface with all the common operations on pod objects

func NewPodsRepository added in v1.3.0

func NewPodsRepository(customController *CustomController) PodsRepository

NewPodsRepository returns a new PodsRepository

Jump to

Keyboard shortcuts

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