k8s

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPodIP added in v0.5.1

func GetPodIP(pod *corev1.Pod) string

GetPodIP returns the pod IP from the pod status or from the pod annotation.

func HasFinalizer

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

HasFinalizer tests whether k8s object has specified finalizer

func IsServiceHeadless added in v0.5.4

func IsServiceHeadless(svc *corev1.Service) bool

IsServiceHeadless returns true if the service is headless

func LookupContainerPortAndName added in v0.5.1

func LookupContainerPortAndName(pod *corev1.Pod, port intstr.IntOrString, protocol corev1.Protocol) (int32, string, error)

LookupContainerPortAndName returns numerical containerPort and portName for specific port and protocol

func LookupListenPortFromPodSpec added in v0.5.1

func LookupListenPortFromPodSpec(svc *corev1.Service, pod *corev1.Pod, port intstr.IntOrString, protocol corev1.Protocol) (int32, error)

LookupListenPortFromPodSpec returns the numerical listener port from the service spec if the input port matches the target port in the pod spec

func LookupServiceListenPort added in v0.5.1

func LookupServiceListenPort(svc *corev1.Service, port intstr.IntOrString, protocol corev1.Protocol) (int32, error)

LookupServiceListenPort returns the numerical port for the service listen port if the target port name matches or the port number and the protocol matches the target port. If no matching port is found, it returns a 0 and an error.

func NamespacedName

func NamespacedName(obj client.Object) client.ObjectKey

NamespacedName returns the namespaced name for k8s objects

Types

type ConfigMapStore added in v0.5.1

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

func NewConfigMapStore added in v0.5.1

func NewConfigMapStore(notifyChan chan<- struct{}) *ConfigMapStore

NewConfigMapStore constructs new conversionStore

func (*ConfigMapStore) Add added in v0.5.1

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

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

func (*ConfigMapStore) Delete added in v0.5.1

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

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

func (*ConfigMapStore) Get added in v0.5.1

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

Get returns the object with the given key

func (*ConfigMapStore) GetByKey added in v0.5.1

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

GetByKey returns the object with the given key

func (*ConfigMapStore) List added in v0.5.1

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

List returns a list of all the objects

func (*ConfigMapStore) ListKeys added in v0.5.1

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

ListKeys returns a list of all the keys

func (*ConfigMapStore) Replace added in v0.5.1

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

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

func (*ConfigMapStore) Resync added in v0.5.1

func (s *ConfigMapStore) Resync() error

Resync invokes the cache.store Resync method

func (*ConfigMapStore) Update added in v0.5.1

func (s *ConfigMapStore) 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

Jump to

Keyboard shortcuts

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