Documentation ¶
Index ¶
- Constants
- func MarshalFirstNonNilStructFieldToJSON(i any) (string, string, error)
- func SyncContainers(ctx context.Context, db *database.Database, g *errgroup.Group, ...)
- type ConfigMap
- type ConfigMapData
- type ConfigMapLabel
- type Container
- type ContainerDevice
- type ContainerLog
- type ContainerLogMeta
- type ContainerMeta
- type ContainerMount
- type CronJob
- type CronJobLabel
- type DaemonSet
- type DaemonSetCondition
- type DaemonSetLabel
- type Data
- type Deployment
- type DeploymentCondition
- type DeploymentLabel
- type Endpoint
- type EndpointSlice
- type EndpointSliceLabel
- type EndpointTargetRef
- type Event
- type Ingress
- type IngressBackendResource
- type IngressBackendService
- type IngressRule
- type IngressTls
- type Job
- type JobCondition
- type JobLabel
- type Label
- type Meta
- func (m *Meta) GetAnnotations() map[string]string
- func (m *Meta) GetCreationTimestamp() kmetav1.Time
- func (m *Meta) GetDeletionGracePeriodSeconds() *int64
- func (m *Meta) GetDeletionTimestamp() *kmetav1.Time
- func (m *Meta) GetFinalizers() []string
- func (m *Meta) GetGenerateName() string
- func (m *Meta) GetGeneration() int64
- func (m *Meta) GetLabels() map[string]string
- func (m *Meta) GetManagedFields() []kmetav1.ManagedFieldsEntry
- func (m *Meta) GetName() string
- func (m *Meta) GetNamespace() string
- func (m *Meta) GetOwnerReferences() []kmetav1.OwnerReference
- func (m *Meta) GetResourceVersion() string
- func (m *Meta) GetSelfLink() string
- func (m *Meta) GetUID() ktypes.UID
- func (m *Meta) ObtainMeta(k8s kmetav1.Object)
- func (m *Meta) SetAnnotations(_ map[string]string)
- func (m *Meta) SetCreationTimestamp(kmetav1.Time)
- func (m *Meta) SetDeletionGracePeriodSeconds(*int64)
- func (m *Meta) SetDeletionTimestamp(*kmetav1.Time)
- func (m *Meta) SetFinalizers([]string)
- func (m *Meta) SetGenerateName(string)
- func (m *Meta) SetGeneration(int64)
- func (m *Meta) SetLabels(map[string]string)
- func (m *Meta) SetManagedFields([]kmetav1.ManagedFieldsEntry)
- func (m *Meta) SetName(string)
- func (m *Meta) SetNamespace(string)
- func (m *Meta) SetOwnerReferences([]kmetav1.OwnerReference)
- func (m *Meta) SetResourceVersion(string)
- func (m *Meta) SetSelfLink(string)
- func (m *Meta) SetUID(ktypes.UID)
- type Namespace
- type NamespaceCondition
- type NamespaceLabel
- type Node
- type NodeCondition
- type NodeLabel
- type NodeVolume
- type PersistentVolume
- type PersistentVolumeClaimRef
- type Pod
- type PodCondition
- type PodFactory
- type PodLabel
- type PodMetrics
- type PodOwner
- type PodPvc
- type PodVolume
- type Pvc
- type PvcCondition
- type PvcLabel
- type ReplicaSet
- type ReplicaSetCondition
- type ReplicaSetLabel
- type ReplicaSetOwner
- type Resource
- func NewConfigMap() Resource
- func NewCronJob() Resource
- func NewDaemonSet() Resource
- func NewDeployment() Resource
- func NewEndpointSlice() Resource
- func NewEvent() Resource
- func NewIngress() Resource
- func NewJob() Resource
- func NewNamespace() Resource
- func NewNode() Resource
- func NewPersistentVolume() Resource
- func NewPvc() Resource
- func NewReplicaSet() Resource
- func NewSecret() Resource
- func NewService() Resource
- func NewStatefulSet() Resource
- type Secret
- type SecretData
- type SecretLabel
- type Selector
- type Service
- type ServiceCondition
- type ServiceLabel
- type ServicePort
- type ServiceSelector
- type StatefulSet
- type StatefulSetCondition
- type StatefulSetLabel
Constants ¶
View Source
const ( MaxConcurrentJobs int = 60 ScheduleInterval = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func SyncContainers ¶
func SyncContainers(ctx context.Context, db *database.Database, g *errgroup.Group, upsertPods <-chan interface{}, deletePods <-chan interface{})
SyncContainers consumes from the `upsertPods` and `deletePods` chans concurrently and schedules a job for each of the containers (drawn from `upsertPods`) that periodically syncs the container logs with the database. When pods are deleted, their IDs are streamed through the `deletePods` chan, and this fetches all the container IDs matching the respective pod ID from the database and initiates a container deletion stream that cleans up all container-related resources.
Types ¶
type ConfigMap ¶
type ConfigMap struct { Meta Id types.Binary Immutable types.Bool Data []Data `db:"-"` ConfigMapsData []ConfigMapData `db:"-"` Labels []Label `db:"-"` ConfigMapLabels []ConfigMapLabel `db:"-"` }
type Container ¶
type Container struct { ContainerMeta Name string Image string CpuLimits int64 CpuRequests int64 MemoryLimits int64 MemoryRequests int64 State sql.NullString StateDetails string Ready types.Bool Started types.Bool RestartCount int32 Devices []ContainerDevice `db:"-"` Mounts []ContainerMount `db:"-"` }
type ContainerDevice ¶
type ContainerLog ¶
type ContainerLog struct { PodId types.Binary `db:"pod_id"` ContainerId types.Binary `db:"container_id"` ContainerLogMeta Namespace string `db:"-"` PodName string `db:"-"` ContainerName string `db:"-"` }
func (*ContainerLog) Upsert ¶
func (cl *ContainerLog) Upsert() interface{}
Upsert implements the database.Upserter interface.
type ContainerLogMeta ¶
type ContainerMeta ¶
type ContainerMount ¶
type CronJob ¶
type CronJob struct { Meta Id types.Binary Schedule string Timezone string StartingDeadlineSeconds int64 ConcurrencyPolicy string Suspend types.Bool SuccessfulJobsHistoryLimit int32 FailedJobsHistoryLimit int32 Active int32 LastScheduleTime types.UnixMilli LastSuccessfulTime types.UnixMilli Labels []Label `db:"-"` CronJobLabels []CronJobLabel `db:"-"` }
type DaemonSet ¶
type DaemonSet struct { Meta Id types.Binary UpdateStrategy string MinReadySeconds int32 DesiredNumberScheduled int32 CurrentNumberScheduled int32 NumberMisscheduled int32 NumberReady int32 UpdateNumberScheduled int32 NumberAvailable int32 Conditions []DaemonSetCondition `db:"-"` Labels []Label `db:"-"` DaemonSetLabels []DaemonSetLabel `db:"-"` }
type DaemonSetCondition ¶
type Deployment ¶
type Deployment struct { Meta Id types.Binary DesiredReplicas int32 Strategy string MinReadySeconds int32 ProgressDeadlineSeconds int32 Paused types.Bool ActualReplicas int32 UpdatedReplicas int32 ReadyReplicas int32 AvailableReplicas int32 Conditions []DeploymentCondition `db:"-"` Labels []Label `db:"-"` DeploymentLabels []DeploymentLabel `db:"-"` }
func (*Deployment) Obtain ¶
func (d *Deployment) Obtain(k8s kmetav1.Object)
func (*Deployment) Relations ¶
func (d *Deployment) Relations() []database.Relation
type DeploymentCondition ¶
type DeploymentLabel ¶
type EndpointSlice ¶
type EndpointSlice struct { Meta Id types.Binary AddressType string Endpoints []Endpoint `db:"-"` Labels []Label `db:"-"` EndpointLabels []EndpointSliceLabel `db:"-"` EndpointTargetRefs []EndpointTargetRef `db:"-"` }
func (*EndpointSlice) Obtain ¶
func (e *EndpointSlice) Obtain(k8s kmetav1.Object)
func (*EndpointSlice) Relations ¶
func (e *EndpointSlice) Relations() []database.Relation
type EndpointSliceLabel ¶
type EndpointTargetRef ¶
type Event ¶
type Ingress ¶
type Ingress struct { Meta Id types.Binary IngressTls []IngressTls `db:"-"` IngressBackendService []IngressBackendService `db:"-"` IngressBackendResource []IngressBackendResource `db:"-"` IngressRule []IngressRule `db:"-"` }
type IngressBackendResource ¶
type IngressBackendService ¶
type IngressRule ¶
type Job ¶
type Job struct { Meta Id types.Binary Parallelism sql.NullInt32 Completions sql.NullInt32 ActiveDeadlineSeconds sql.NullInt64 BackoffLimit sql.NullInt32 TtlSecondsAfterFinished sql.NullInt32 CompletionMode sql.NullString Suspend types.Bool StartTime types.UnixMilli CompletionTime types.UnixMilli Active int32 Succeeded int32 Failed int32 Conditions []JobCondition `db:"-"` Labels []Label `db:"-"` JobLabels []JobLabel `db:"-"` }
type JobCondition ¶
type Meta ¶
type Meta struct { Uid ktypes.UID Namespace string Name string ResourceVersion string Created types.UnixMilli }
func (*Meta) GetAnnotations ¶
func (*Meta) GetCreationTimestamp ¶
func (*Meta) GetDeletionGracePeriodSeconds ¶
func (*Meta) GetDeletionTimestamp ¶
func (*Meta) GetFinalizers ¶
func (*Meta) GetGenerateName ¶
func (*Meta) GetGeneration ¶
func (*Meta) GetManagedFields ¶
func (m *Meta) GetManagedFields() []kmetav1.ManagedFieldsEntry
func (*Meta) GetNamespace ¶
func (*Meta) GetOwnerReferences ¶
func (m *Meta) GetOwnerReferences() []kmetav1.OwnerReference
func (*Meta) GetResourceVersion ¶
func (*Meta) GetSelfLink ¶
func (*Meta) ObtainMeta ¶
func (*Meta) SetAnnotations ¶
func (*Meta) SetCreationTimestamp ¶
func (*Meta) SetDeletionGracePeriodSeconds ¶
func (*Meta) SetDeletionTimestamp ¶
func (*Meta) SetFinalizers ¶
func (*Meta) SetGenerateName ¶
func (*Meta) SetGeneration ¶
func (*Meta) SetManagedFields ¶
func (m *Meta) SetManagedFields([]kmetav1.ManagedFieldsEntry)
func (*Meta) SetNamespace ¶
func (*Meta) SetOwnerReferences ¶
func (m *Meta) SetOwnerReferences([]kmetav1.OwnerReference)
func (*Meta) SetResourceVersion ¶
func (*Meta) SetSelfLink ¶
type Namespace ¶
type Namespace struct { Meta Id types.Binary Phase string Conditions []NamespaceCondition `db:"-"` Labels []Label `db:"-"` NamespaceLabels []NamespaceLabel `db:"-"` }
type NamespaceCondition ¶
type Node ¶
type Node struct { Meta Id types.Binary PodCIDR string NumIps int64 Unschedulable types.Bool Ready types.Bool CpuCapacity int64 CpuAllocatable int64 MemoryCapacity int64 MemoryAllocatable int64 PodCapacity int64 Conditions []NodeCondition `db:"-"` Volumes []NodeVolume `db:"-"` Labels []Label `db:"-"` NodeLabels []NodeLabel `db:"-"` }
type NodeCondition ¶
type NodeVolume ¶
type PersistentVolume ¶
type PersistentVolume struct { Meta Id types.Binary AccessModes types.Bitmask[kpersistentVolumeAccessModesSize] Capacity int64 ReclaimPolicy string StorageClass string VolumeMode sql.NullString VolumeSourceType string VolumeSource string Phase string Reason string Message string Claim PersistentVolumeClaimRef `db:"-"` }
func (*PersistentVolume) Obtain ¶
func (p *PersistentVolume) Obtain(k8s kmetav1.Object)
func (*PersistentVolume) Relations ¶
func (p *PersistentVolume) Relations() []database.Relation
type Pod ¶
type Pod struct { Meta Id types.Binary NodeName string NominatedNodeName string Ip string Phase string CpuLimits int64 CpuRequests int64 MemoryLimits int64 MemoryRequests int64 Reason string Message string Qos string RestartPolicy string Conditions []PodCondition `db:"-"` Containers []Container `db:"-"` Owners []PodOwner `db:"-"` Labels []Label `db:"-"` PodLabels []PodLabel `db:"-"` Pvcs []PodPvc `db:"-"` Volumes []PodVolume `db:"-"` // contains filtered or unexported fields }
type PodCondition ¶
type PodFactory ¶
type PodFactory struct {
// contains filtered or unexported fields
}
func NewPodFactory ¶
func NewPodFactory(clientset *kubernetes.Clientset) *PodFactory
func (*PodFactory) New ¶
func (f *PodFactory) New() Resource
type PodMetrics ¶
type PodMetrics struct { Namespace string `db:"namespace"` PodName string `db:"pod_name"` ContainerName string `db:"container_name"` Timestamp types.UnixMilli `db:"timestamp"` Duration time.Duration `db:"duration"` CPUUsage float64 `db:"cpu_usage"` MemoryUsage float64 `db:"memory_usage"` StorageUsage float64 `db:"storage_usage"` EphemeralStorageUsage float64 `db:"ephemeral_storage_usage"` }
type Pvc ¶
type Pvc struct { Meta Id types.Binary DesiredAccessModes types.Bitmask[kpersistentVolumeAccessModesSize] ActualAccessModes types.Bitmask[kpersistentVolumeAccessModesSize] MinimumCapacity sql.NullInt64 ActualCapacity int64 Phase string VolumeName string VolumeMode sql.NullString StorageClass sql.NullString Conditions []PvcCondition `db:"-"` Labels []Label `db:"-"` PvcLabels []PvcLabel `db:"-"` }
type PvcCondition ¶
type ReplicaSet ¶
type ReplicaSet struct { Meta Id types.Binary DesiredReplicas int32 MinReadySeconds int32 ActualReplicas int32 FullyLabeledReplicas int32 ReadyReplicas int32 AvailableReplicas int32 Conditions []ReplicaSetCondition `db:"-"` Owners []ReplicaSetOwner `db:"-"` Labels []Label `db:"-"` ReplicaSetLabels []ReplicaSetLabel `db:"-"` }
func (*ReplicaSet) Obtain ¶
func (r *ReplicaSet) Obtain(k8s kmetav1.Object)
func (*ReplicaSet) Relations ¶
func (r *ReplicaSet) Relations() []database.Relation
type ReplicaSetCondition ¶
type ReplicaSetLabel ¶
type ReplicaSetOwner ¶
type Resource ¶
func NewConfigMap ¶
func NewConfigMap() Resource
func NewCronJob ¶
func NewCronJob() Resource
func NewDaemonSet ¶
func NewDaemonSet() Resource
func NewDeployment ¶
func NewDeployment() Resource
func NewEndpointSlice ¶
func NewEndpointSlice() Resource
func NewIngress ¶
func NewIngress() Resource
func NewNamespace ¶
func NewNamespace() Resource
func NewPersistentVolume ¶
func NewPersistentVolume() Resource
func NewReplicaSet ¶
func NewReplicaSet() Resource
func NewService ¶
func NewService() Resource
func NewStatefulSet ¶
func NewStatefulSet() Resource
type Secret ¶
type Secret struct { Meta Id types.Binary Type string Immutable types.Bool Data []Data `db:"-"` SecretData []SecretData `db:"-"` Labels []Label `db:"-"` SecretLabels []SecretLabel `db:"-"` }
type Service ¶
type Service struct { Meta Id types.Binary Type string ClusterIP string ClusterIPs string ExternalIPs string SessionAffinity string ExternalName string ExternalTrafficPolicy sql.NullString HealthCheckNodePort int32 PublishNotReadyAddresses types.Bool IpFamilies string IpFamilyPolicy string AllocateLoadBalancerNodePorts types.Bool LoadBalancerClass string InternalTrafficPolicy string Selectors []Selector `db:"-"` ServiceSelectors []ServiceSelector `db:"-"` Ports []ServicePort `db:"-"` Conditions []ServiceCondition `db:"-"` Labels []Label `db:"-"` ServiceLabels []ServiceLabel `db:"-"` }
type ServiceCondition ¶
type ServicePort ¶
type ServiceSelector ¶
type StatefulSet ¶
type StatefulSet struct { Meta Id types.Binary DesiredReplicas int32 ServiceName string PodManagementPolicy string UpdateStrategy string MinReadySeconds int32 PersistentVolumeClaimRetentionPolicyWhenDeleted string PersistentVolumeClaimRetentionPolicyWhenScaled string Ordinals int32 ActualReplicas int32 ReadyReplicas int32 CurrentReplicas int32 UpdatedReplicas int32 AvailableReplicas int32 Conditions []StatefulSetCondition `db:"-"` Labels []Label `db:"-"` StatefulSetLabels []StatefulSetLabel `db:"-"` }
func (*StatefulSet) Obtain ¶
func (s *StatefulSet) Obtain(k8s kmetav1.Object)
func (*StatefulSet) Relations ¶
func (s *StatefulSet) Relations() []database.Relation
type StatefulSetCondition ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.