k8s

package
v2.5.6 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package k8s is a generated GoMock package.

Package k8s is a generated GoMock package.

Index

Constants

View Source
const (
	// Ingress events
	IngressEventReasonConflictingIngressClass = "ConflictingIngressClass"
	IngressEventReasonFailedLoadGroupID       = "FailedLoadGroupID"
	IngressEventReasonFailedAddFinalizer      = "FailedAddFinalizer"
	IngressEventReasonFailedRemoveFinalizer   = "FailedRemoveFinalizer"
	IngressEventReasonFailedUpdateStatus      = "FailedUpdateStatus"
	IngressEventReasonFailedBuildModel        = "FailedBuildModel"
	IngressEventReasonFailedDeployModel       = "FailedDeployModel"
	IngressEventReasonSuccessfullyReconciled  = "SuccessfullyReconciled"

	// Service events
	ServiceEventReasonFailedAddFinalizer     = "FailedAddFinalizer"
	ServiceEventReasonFailedRemoveFinalizer  = "FailedRemoveFinalizer"
	ServiceEventReasonFailedUpdateStatus     = "FailedUpdateStatus"
	ServiceEventReasonFailedCleanupStatus    = "FailedCleanupStatus"
	ServiceEventReasonFailedBuildModel       = "FailedBuildModel"
	ServiceEventReasonFailedDeployModel      = "FailedDeployModel"
	ServiceEventReasonSuccessfullyReconciled = "SuccessfullyReconciled"

	// TargetGroupBinding events
	TargetGroupBindingEventReasonFailedAddFinalizer     = "FailedAddFinalizer"
	TargetGroupBindingEventReasonFailedRemoveFinalizer  = "FailedRemoveFinalizer"
	TargetGroupBindingEventReasonFailedUpdateStatus     = "FailedUpdateStatus"
	TargetGroupBindingEventReasonFailedCleanup          = "FailedCleanup"
	TargetGroupBindingEventReasonBackendNotFound        = "BackendNotFound"
	TargetGroupBindingEventReasonSuccessfullyReconciled = "SuccessfullyReconciled"
)

Variables

This section is empty.

Functions

func ExtractNodeInstanceID

func ExtractNodeInstanceID(node *corev1.Node) (string, error)

func GetNodeCondition

func GetNodeCondition(node *corev1.Node, conditionType corev1.NodeConditionType) *corev1.NodeCondition

GetNodeCondition will get pointer to Node's existing condition. returns nil if no matching condition found.

func GetPodCondition

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

GetPodCondition will get pointer to Pod's existing condition. returns nil if no matching condition found.

func HasFinalizer

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

HasFinalizer tests whether k8s object has specified finalizer

func IsPodContainersReady

func IsPodContainersReady(pod *corev1.Pod) bool

IsPodContainersReady returns whether pod is containersReady.

func IsPodHasReadinessGate

func IsPodHasReadinessGate(pod *corev1.Pod, conditionType corev1.PodConditionType) bool

func LookupContainerPort

func LookupContainerPort(pod *corev1.Pod, port intstr.IntOrString) (int64, error)

LookupContainerPort returns the numerical containerPort for specific port on Pod.

func LookupServicePort

func LookupServicePort(svc *corev1.Service, port intstr.IntOrString) (corev1.ServicePort, error)

LookupServicePort returns the ServicePort structure for specific port on service.

func NamespacedName

func NamespacedName(obj metav1.Object) types.NamespacedName

NamespacedName returns the namespaced name for k8s objects

func NewDefaultPodInfoRepo

func NewDefaultPodInfoRepo(getter cache.Getter, watchNamespace string, logger logr.Logger) *defaultPodInfoRepo

NewDefaultPodInfoRepo constructs new defaultPodInfoRepo. * watchNamespace is the namespace to monitor pod spec.

  • if watchNamespace is "", this repo monitors pods in all namespaces
  • if watchNamespace is not "", this repo monitors pods in specific namespace

func NewSecretsManager

func NewSecretsManager(clientSet kubernetes.Interface, secretsEventChan chan<- event.GenericEvent, logger logr.Logger) *defaultSecretsManager

func ToSliceOfNamespacedNames

func ToSliceOfNamespacedNames[T metav1.ObjectMetaAccessor](s []T) []types.NamespacedName

ToSliceOfNamespacedNames gets the slice of types.NamespacedName from the input slice s

func UpdatePodCondition

func UpdatePodCondition(pod *corev1.Pod, condition corev1.PodCondition)

UpdatePodCondition will update Pod to contain specified condition.

Types

type ConversionFunc

type ConversionFunc func(obj interface{}) (interface{}, error)

type ConversionStore

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

ConversionStore implements cache.Store. It converts objects to another type using specified conversionFunc. In store's term, the accumulator for this store is a convert that converts object's latest state into another object.

func NewConversionStore

func NewConversionStore(conversionFunc ConversionFunc, keyFunc cache.KeyFunc) *ConversionStore

NewConversionStore constructs new conversionStore

func (*ConversionStore) Add

func (s *ConversionStore) Add(obj interface{}) error

Add adds the given object to the accumulator associated with the given object's key

func (*ConversionStore) Delete

func (s *ConversionStore) Delete(obj interface{}) error

Delete deletes the given object from the accumulator associated with the given object's key

func (*ConversionStore) Get

func (s *ConversionStore) Get(obj interface{}) (item interface{}, exists bool, err error)

Get returns the accumulator associated with the given object's key

func (*ConversionStore) GetByKey

func (s *ConversionStore) GetByKey(key string) (item interface{}, exists bool, err error)

GetByKey returns the accumulator associated with the given key

func (*ConversionStore) List

func (s *ConversionStore) List() []interface{}

List returns a list of all the currently non-empty accumulators

func (*ConversionStore) ListKeys

func (s *ConversionStore) ListKeys() []string

ListKeys returns a list of all the keys currently associated with non-empty accumulators

func (*ConversionStore) Replace

func (s *ConversionStore) Replace(list []interface{}, resourceVersion string) error

Replace will delete the contents of the store, using instead the given list.

func (*ConversionStore) Resync

func (s *ConversionStore) Resync() error

Resync is meaningless in the terms appearing here

func (*ConversionStore) Update

func (s *ConversionStore) Update(obj interface{}) error

Update updates the given object in the accumulator associated with the given object's key

type FinalizerManager

type FinalizerManager interface {
	AddFinalizers(ctx context.Context, object client.Object, finalizers ...string) error
	RemoveFinalizers(ctx context.Context, object client.Object, finalizers ...string) error
}

func NewDefaultFinalizerManager

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

type MockFinalizerManager

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

MockFinalizerManager is a mock of FinalizerManager interface.

func NewMockFinalizerManager

func NewMockFinalizerManager(ctrl *gomock.Controller) *MockFinalizerManager

NewMockFinalizerManager creates a new mock instance.

func (*MockFinalizerManager) AddFinalizers

func (m *MockFinalizerManager) AddFinalizers(arg0 context.Context, arg1 client.Object, arg2 ...string) error

AddFinalizers mocks base method.

func (*MockFinalizerManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFinalizerManager) RemoveFinalizers

func (m *MockFinalizerManager) RemoveFinalizers(arg0 context.Context, arg1 client.Object, arg2 ...string) error

RemoveFinalizers mocks base method.

type MockFinalizerManagerMockRecorder

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

MockFinalizerManagerMockRecorder is the mock recorder for MockFinalizerManager.

func (*MockFinalizerManagerMockRecorder) AddFinalizers

func (mr *MockFinalizerManagerMockRecorder) AddFinalizers(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call

AddFinalizers indicates an expected call of AddFinalizers.

func (*MockFinalizerManagerMockRecorder) RemoveFinalizers

func (mr *MockFinalizerManagerMockRecorder) RemoveFinalizers(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call

RemoveFinalizers indicates an expected call of RemoveFinalizers.

type MockPodInfoRepo

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

MockPodInfoRepo is a mock of PodInfoRepo interface.

func NewMockPodInfoRepo

func NewMockPodInfoRepo(ctrl *gomock.Controller) *MockPodInfoRepo

NewMockPodInfoRepo creates a new mock instance.

func (*MockPodInfoRepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPodInfoRepo) Get

Get mocks base method.

func (*MockPodInfoRepo) ListKeys

func (m *MockPodInfoRepo) ListKeys(arg0 context.Context) []types.NamespacedName

ListKeys mocks base method.

type MockPodInfoRepoMockRecorder

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

MockPodInfoRepoMockRecorder is the mock recorder for MockPodInfoRepo.

func (*MockPodInfoRepoMockRecorder) Get

func (mr *MockPodInfoRepoMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockPodInfoRepoMockRecorder) ListKeys

func (mr *MockPodInfoRepoMockRecorder) ListKeys(arg0 interface{}) *gomock.Call

ListKeys indicates an expected call of ListKeys.

type PodENIInfo

type PodENIInfo struct {
	// ENIID is the network interface id of the branch interface
	ENIID string `json:"eniId"`

	// PrivateIP is the primary IP of the branch Network interface
	PrivateIP string `json:"privateIp"`
}

PodENIInfo is a json convertible structure that stores the Branch ENI details that can be used by the CNI plugin or the component consuming the resource

type PodInfo

type PodInfo struct {
	Key types.NamespacedName
	UID types.UID

	ContainerPorts []corev1.ContainerPort
	ReadinessGates []corev1.PodReadinessGate
	Conditions     []corev1.PodCondition
	NodeName       string
	PodIP          string

	ENIInfos []PodENIInfo
}

PodInfo contains simplified pod information we cares about. We do so to minimize memory usage.

func (*PodInfo) GetPodCondition

func (i *PodInfo) GetPodCondition(conditionType corev1.PodConditionType) (corev1.PodCondition, bool)

GetPodCondition will get Pod's condition.

func (*PodInfo) HasAnyOfReadinessGates

func (i *PodInfo) HasAnyOfReadinessGates(conditionTypes []corev1.PodConditionType) bool

HasAnyOfReadinessGates returns whether podInfo has any of these readinessGates

func (*PodInfo) IsContainersReady

func (i *PodInfo) IsContainersReady() bool

IsContainersReady returns whether podInfo is ContainersReady.

func (*PodInfo) LookupContainerPort

func (i *PodInfo) LookupContainerPort(port intstr.IntOrString) (int64, error)

LookupContainerPort returns the numerical containerPort for specific port on Pod.

type PodInfoRepo

type PodInfoRepo interface {
	// Get returns PodInfo specified with specific podKey, and whether it exists.
	Get(ctx context.Context, key types.NamespacedName) (PodInfo, bool, error)

	// ListKeys will list the pod keys in this repo.
	ListKeys(ctx context.Context) []types.NamespacedName
}

PodInfoRepo provides access to pod information within cluster. We only store necessary pod information related to our controller to reduce memory usage.

type SecretsManager

type SecretsManager interface {
	// MonitorSecrets manages the individual watches for the given secrets
	MonitorSecrets(ingressGroupID string, secrets []types.NamespacedName)
}

SecretsManager manages the secret resources needed by the controller

type SecretsStore

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

SecretsStore implements cache.Store. It invokes the eventhandler for Add, Update, Delete events

func NewSecretsStore

func NewSecretsStore(secretsEventChan chan<- event.GenericEvent, keyFunc cache.KeyFunc, logger logr.Logger) *SecretsStore

NewSecretsStore constructs new conversionStore

func (*SecretsStore) Add

func (s *SecretsStore) Add(obj interface{}) error

Add adds the given object to the accumulator associated with the given object's key

func (*SecretsStore) Delete

func (s *SecretsStore) Delete(obj interface{}) error

Delete deletes the given object from the accumulator associated with the given object's key

func (*SecretsStore) Get

func (s *SecretsStore) Get(obj interface{}) (item interface{}, exists bool, err error)

Get returns the accumulator associated with the given object's key

func (*SecretsStore) GetByKey

func (s *SecretsStore) GetByKey(key string) (item interface{}, exists bool, err error)

GetByKey returns the accumulator associated with the given key

func (*SecretsStore) List

func (s *SecretsStore) List() []interface{}

List returns a list of all the currently non-empty accumulators

func (*SecretsStore) ListKeys

func (s *SecretsStore) ListKeys() []string

ListKeys returns a list of all the keys currently associated with non-empty accumulators

func (*SecretsStore) Replace

func (s *SecretsStore) Replace(list []interface{}, resourceVersion string) error

Replace will delete the contents of the store, using instead the given list.

func (*SecretsStore) Resync

func (s *SecretsStore) Resync() error

Resync is meaningless in the terms appearing here

func (*SecretsStore) Update

func (s *SecretsStore) Update(obj interface{}) error

Update updates the given object in the accumulator associated with the given object's key

Jump to

Keyboard shortcuts

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