Documentation ¶
Index ¶
- Constants
- func LoadConfig(kubeConfigPath string) (*rest.Config, error)
- type ContainerEventHandler
- type IPInfo
- type Metadata
- func (k *Metadata) AddContainerEventHandler(eh ContainerEventHandler)
- func (k *Metadata) AddNodeEventHandler(h cache.ResourceEventHandler) error
- func (k *Metadata) AddPodEventHandler(h cache.ResourceEventHandler) error
- func (k *Metadata) AddReplicaSetEventHandler(h cache.ResourceEventHandler) error
- func (k *Metadata) AddServiceIPEventHandler(s cache.ResourceEventHandler) error
- func (k *Metadata) FetchPodOwnerInfo(pod *PodInfo)
- func (k *Metadata) GetContainerPod(containerID string) (*PodInfo, bool)
- func (k *Metadata) GetInfo(ip string) (*IPInfo, *metav1.ObjectMeta, bool)
- func (k *Metadata) GetReplicaSetInfo(namespace, name string) (*ReplicaSetInfo, bool)
- func (k *Metadata) InitFromClient(ctx context.Context, client kubernetes.Interface, timeout time.Duration) error
- type MetadataProvider
- type NodeInfo
- type Owner
- type OwnerLabel
- type PodInfo
- type ReplicaSetInfo
- type ServiceInfo
Constants ¶
const ( IndexPodByContainerIDs = "idx_pod_by_container" IndexReplicaSetNames = "idx_rs" IndexIP = "idx_ip" )
const ( InformerService = maps.Bits(1 << iota) InformerReplicaSet InformerNode )
const ( OwnerReplicaSet = OwnerLabel(attr.K8sReplicaSetName) OwnerDeployment = OwnerLabel(attr.K8sDeploymentName) OwnerStatefulSet = OwnerLabel(attr.K8sStatefulSetName) OwnerDaemonSet = OwnerLabel(attr.K8sDaemonSetName) OwnerUnknown = OwnerLabel(attr.K8sUnknownOwnerName) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContainerEventHandler ¶
type ContainerEventHandler interface {
OnDeletion(containerID []string)
}
ContainerEventHandler listens for the deletion of containers, as triggered by a Pod deletion.
type IPInfo ¶ added in v1.7.0
IPInfo contains precollected metadata for Pods, Nodes and Services. Not all the fields are populated for all the above types. To save memory, we just keep in memory the necessary data for each Type. For more information about which fields are set for each type, please refer to the instantiation function of the respective informers.
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
Metadata stores an in-memory copy of the different Kubernetes objects whose metadata is relevant to us.
func (*Metadata) AddContainerEventHandler ¶
func (k *Metadata) AddContainerEventHandler(eh ContainerEventHandler)
func (*Metadata) AddNodeEventHandler ¶ added in v1.8.0
func (k *Metadata) AddNodeEventHandler(h cache.ResourceEventHandler) error
func (*Metadata) AddPodEventHandler ¶
func (k *Metadata) AddPodEventHandler(h cache.ResourceEventHandler) error
func (*Metadata) AddReplicaSetEventHandler ¶
func (k *Metadata) AddReplicaSetEventHandler(h cache.ResourceEventHandler) error
func (*Metadata) AddServiceIPEventHandler ¶ added in v1.7.0
func (k *Metadata) AddServiceIPEventHandler(s cache.ResourceEventHandler) error
func (*Metadata) FetchPodOwnerInfo ¶
FetchPodOwnerInfo updates the pod owner with the Deployment information, if it exists. Pod Info might include a ReplicaSet as owner, and ReplicaSet info usually has a Deployment as owner reference, which is the one that we'd really like to report as owner.
func (*Metadata) GetContainerPod ¶
GetContainerPod fetches metadata from a Pod given the name of one of its containers
func (*Metadata) GetReplicaSetInfo ¶
func (k *Metadata) GetReplicaSetInfo(namespace, name string) (*ReplicaSetInfo, bool)
GetReplicaSetInfo fetches metadata from a ReplicaSet given its name
func (*Metadata) InitFromClient ¶
type MetadataProvider ¶ added in v1.7.0
type MetadataProvider struct {
// contains filtered or unexported fields
}
func NewMetadataProvider ¶ added in v1.7.0
func NewMetadataProvider( enable kubeflags.EnableFlag, disabledInformers []string, kubeConfigPath string, syncTimeout time.Duration, ) *MetadataProvider
func (*MetadataProvider) ForceDisable ¶ added in v1.7.0
func (mp *MetadataProvider) ForceDisable()
func (*MetadataProvider) Get ¶ added in v1.7.0
func (mp *MetadataProvider) Get(ctx context.Context) (*Metadata, error)
func (*MetadataProvider) IsKubeEnabled ¶ added in v1.7.0
func (mp *MetadataProvider) IsKubeEnabled() bool
func (*MetadataProvider) KubeClient ¶ added in v1.7.0
func (mp *MetadataProvider) KubeClient() (kubernetes.Interface, error)
type NodeInfo ¶ added in v1.7.0
type NodeInfo struct { metav1.ObjectMeta IPInfo IPInfo }
NodeInfo contains precollected metadata for nodes
type Owner ¶ added in v1.2.1
type Owner struct { Kind string LabelName OwnerLabel Name string // Owner of the owner. For example, a ReplicaSet might be owned by a Deployment Owner *Owner }
func OwnerFrom ¶ added in v1.6.0
func OwnerFrom(orefs []metav1.OwnerReference) *Owner
OwnerFrom returns the most plausible Owner reference. It might be null if the entity does not have any owner
type OwnerLabel ¶ added in v1.6.0
type PodInfo ¶
type PodInfo struct { // Informers need that internal object is an ObjectMeta instance metav1.ObjectMeta NodeName string Owner *Owner // StartTimeStr caches value of ObjectMeta.StartTimestamp.String() StartTimeStr string ContainerIDs []string IPInfo IPInfo }
PodInfo contains precollected metadata for Pods.
func (*PodInfo) ServiceName ¶ added in v1.5.0
type ReplicaSetInfo ¶
type ReplicaSetInfo struct { metav1.ObjectMeta Owner *Owner }
ReplicaSetInfo contains precollected metadata for ReplicaSets
type ServiceInfo ¶ added in v1.7.0
type ServiceInfo struct { metav1.ObjectMeta IPInfo IPInfo }
ServiceInfo contains precollected metadata for services.