Documentation ¶
Overview ¶
Package object holds functions that convert the objects from the k8s API in to a more memory efficient structures.
Adding new fields to any of the structures defined in pod.go, endpoint.go and service.go should not be done lightly as this increases the memory use and will leads to OOMs in the k8s scale test.
Index ¶
- Constants
- func EndpointSliceToEndpoints(obj meta.Object) (meta.Object, error)
- func EndpointsKey(name, namespace string) string
- func EndpointsModified(a, b *Endpoints) bool
- func KeyFunc(obj interface{}) (string, error)
- func NewIndexerInformer(lw cache.ListerWatcher, objType runtime.Object, h cache.ResourceEventHandler, ...) (cache.Indexer, cache.Controller)
- func ServiceModified(oldSvc, newSvc *Service) bool
- func ToNamespace(obj meta.Object) (meta.Object, error)
- func ToService(obj meta.Object) (meta.Object, error)
- type Empty
- func (e *Empty) GetAnnotations() map[string]string
- func (e *Empty) GetCreationTimestamp() v1.Time
- func (e *Empty) GetDeletionGracePeriodSeconds() *int64
- func (e *Empty) GetDeletionTimestamp() *v1.Time
- func (e *Empty) GetFinalizers() []string
- func (e *Empty) GetGenerateName() string
- func (e *Empty) GetGeneration() int64
- func (e *Empty) GetLabels() map[string]string
- func (e *Empty) GetManagedFields() []v1.ManagedFieldsEntry
- func (e *Empty) GetObjectKind() schema.ObjectKind
- func (e *Empty) GetOwnerReferences() []v1.OwnerReference
- func (e *Empty) GetSelfLink() string
- func (e *Empty) GetUID() types.UID
- func (e *Empty) GetZZZ_DeprecatedClusterName() string
- func (e *Empty) SetAnnotations(annotations map[string]string)
- func (e *Empty) SetCreationTimestamp(timestamp v1.Time)
- func (e *Empty) SetDeletionGracePeriodSeconds(*int64)
- func (e *Empty) SetDeletionTimestamp(timestamp *v1.Time)
- func (e *Empty) SetFinalizers(finalizers []string)
- func (e *Empty) SetGenerateName(name string)
- func (e *Empty) SetGeneration(generation int64)
- func (e *Empty) SetLabels(labels map[string]string)
- func (e *Empty) SetManagedFields(managedFields []v1.ManagedFieldsEntry)
- func (e *Empty) SetOwnerReferences([]v1.OwnerReference)
- func (e *Empty) SetSelfLink(selfLink string)
- func (e *Empty) SetUID(uid types.UID)
- func (e *Empty) SetZZZ_DeprecatedClusterName(clusterName string)
- type EndpointAddress
- type Endpoints
- func (e *Endpoints) DeepCopyObject() runtime.Object
- func (e *Endpoints) GetName() string
- func (e *Endpoints) GetNamespace() string
- func (e *Endpoints) GetResourceVersion() string
- func (e *Endpoints) SetName(name string)
- func (e *Endpoints) SetNamespace(namespace string)
- func (e *Endpoints) SetResourceVersion(version string)
- type Namespace
- func (n *Namespace) DeepCopyObject() runtime.Object
- func (n *Namespace) GetName() string
- func (n *Namespace) GetNamespace() string
- func (n *Namespace) GetResourceVersion() string
- func (n *Namespace) SetName(name string)
- func (n *Namespace) SetNamespace(namespace string)
- func (n *Namespace) SetResourceVersion(version string)
- type Port
- type ProcessorBuilder
- type Service
- func (s *Service) DeepCopyObject() runtime.Object
- func (s *Service) GetName() string
- func (s *Service) GetNamespace() string
- func (s *Service) GetResourceVersion() string
- func (s *Service) SetName(name string)
- func (s *Service) SetNamespace(namespace string)
- func (s *Service) SetResourceVersion(version string)
- type ToFunc
Constants ¶
const ExternalNameInvalid = "."
Variables ¶
This section is empty.
Functions ¶
func EndpointSliceToEndpoints ¶
EndpointSliceToEndpoints converts a *discovery.EndpointSlice to a *Endpoints.
func EndpointsKey ¶
EndpointsKey returns a string using for the index.
func EndpointsModified ¶
EndpointsModified checks if the update to an endpoint is something that matters to us or if they are effectively equivalent.
func KeyFunc ¶
KeyFunc works like cache.DeletionHandlingMetaNamespaceKeyFunc but uses format "<name>.<namespace>" instead of "<namespace>/<name>". This makes lookup for a service slightly more efficient, because we can just use a slice of the query name instead of constructing a new string.
func NewIndexerInformer ¶
func NewIndexerInformer(lw cache.ListerWatcher, objType runtime.Object, h cache.ResourceEventHandler, indexers cache.Indexers, builder ProcessorBuilder) (cache.Indexer, cache.Controller)
NewIndexerInformer is a copy of the cache.NewIndexerInformer function, but allows custom process function.
func ServiceModified ¶
ServiceModified checks if the update to a service is something that matters to us or if they are effectively equivalent.
func ToNamespace ¶
ToNamespace returns a function that converts an api.Namespace to a *Namespace.
Types ¶
type Empty ¶
type Empty struct{}
Empty is an empty struct.
func (*Empty) GetAnnotations ¶
GetAnnotations implements the metav1.Object interface.
func (*Empty) GetCreationTimestamp ¶
GetCreationTimestamp implements the metav1.Object interface.
func (*Empty) GetDeletionGracePeriodSeconds ¶
GetDeletionGracePeriodSeconds implements the metav1.Object interface.
func (*Empty) GetDeletionTimestamp ¶
GetDeletionTimestamp implements the metav1.Object interface.
func (*Empty) GetFinalizers ¶
GetFinalizers implements the metav1.Object interface.
func (*Empty) GetGenerateName ¶
GetGenerateName implements the metav1.Object interface.
func (*Empty) GetGeneration ¶
GetGeneration implements the metav1.Object interface.
func (*Empty) GetManagedFields ¶
func (e *Empty) GetManagedFields() []v1.ManagedFieldsEntry
GetManagedFields implements the metav1.Object interface.
func (*Empty) GetObjectKind ¶
func (e *Empty) GetObjectKind() schema.ObjectKind
GetObjectKind implements the ObjectKind interface as a noop.
func (*Empty) GetOwnerReferences ¶
func (e *Empty) GetOwnerReferences() []v1.OwnerReference
GetOwnerReferences implements the metav1.Object interface.
func (*Empty) GetSelfLink ¶
GetSelfLink implements the metav1.Object interface.
func (*Empty) GetZZZ_DeprecatedClusterName ¶
GetZZZ_DeprecatedClusterName implements the metav1.Object interface.
func (*Empty) SetAnnotations ¶
SetAnnotations implements the metav1.Object interface.
func (*Empty) SetCreationTimestamp ¶
SetCreationTimestamp implements the metav1.Object interface.
func (*Empty) SetDeletionGracePeriodSeconds ¶
SetDeletionGracePeriodSeconds implements the metav1.Object interface.
func (*Empty) SetDeletionTimestamp ¶
SetDeletionTimestamp implements the metav1.Object interface.
func (*Empty) SetFinalizers ¶
SetFinalizers implements the metav1.Object interface.
func (*Empty) SetGenerateName ¶
SetGenerateName implements the metav1.Object interface.
func (*Empty) SetGeneration ¶
SetGeneration implements the metav1.Object interface.
func (*Empty) SetManagedFields ¶
func (e *Empty) SetManagedFields(managedFields []v1.ManagedFieldsEntry)
SetManagedFields implements the metav1.Object interface.
func (*Empty) SetOwnerReferences ¶
func (e *Empty) SetOwnerReferences([]v1.OwnerReference)
SetOwnerReferences implements the metav1.Object interface.
func (*Empty) SetSelfLink ¶
SetSelfLink implements the metav1.Object interface.
func (*Empty) SetZZZ_DeprecatedClusterName ¶
SetZZZ_DeprecatedClusterName implements the metav1.Object interface.
type EndpointAddress ¶
type EndpointAddress struct { // IP contains the IP address in binary format. IP string Hostname string }
EndpointAddress is a tuple that describes single IP address.
type Endpoints ¶
type Endpoints struct { Version string Name string Namespace string LastChangeTriggerTime time.Time Index string Addresses []EndpointAddress Ports []Port *Empty }
Endpoints is a stripped down discovery.EndpointSlice with only the items we need.
func (*Endpoints) DeepCopyObject ¶
DeepCopyObject implements the ObjectKind interface.
func (*Endpoints) GetNamespace ¶
GetNamespace implements the metav1.Object interface.
func (*Endpoints) GetResourceVersion ¶
GetResourceVersion implements the metav1.Object interface.
func (*Endpoints) SetNamespace ¶
SetNamespace implements the metav1.Object interface.
func (*Endpoints) SetResourceVersion ¶
SetResourceVersion implements the metav1.Object interface.
type Namespace ¶
Namespace is a stripped down api.Namespace with only the items we need.
func (*Namespace) DeepCopyObject ¶
DeepCopyObject implements the ObjectKind interface.
func (*Namespace) GetNamespace ¶
GetNamespace implements the metav1.Object interface.
func (*Namespace) GetResourceVersion ¶
GetResourceVersion implements the metav1.Object interface.
func (*Namespace) SetNamespace ¶
SetNamespace implements the metav1.Object interface.
func (*Namespace) SetResourceVersion ¶
SetResourceVersion implements the metav1.Object interface.
type ProcessorBuilder ¶
type ProcessorBuilder func(cache.Indexer, cache.ResourceEventHandler) cache.ProcessFunc
ProcessorBuilder returns function to process cache events.
func DefaultProcessor ¶
func DefaultProcessor(convert ToFunc) ProcessorBuilder
DefaultProcessor is based on the Process function from cache.NewIndexerInformer except it does a conversion.
type Service ¶
type Service struct { Version string Name string Namespace string // ClusterIPs contains IP addresses in binary format. ClusterIPs []string ExternalName string Ports []Port Headless bool *Empty }
Service is a stripped down api.Service with only the items we need.
func (*Service) DeepCopyObject ¶
DeepCopyObject implements the ObjectKind interface.
func (*Service) GetNamespace ¶
GetNamespace implements the metav1.Object interface.
func (*Service) GetResourceVersion ¶
GetResourceVersion implements the metav1.Object interface.
func (*Service) SetNamespace ¶
SetNamespace implements the metav1.Object interface.
func (*Service) SetResourceVersion ¶
SetResourceVersion implements the metav1.Object interface.