v1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxConcurrentJobs int = 60
	ScheduleInterval      = 5 * time.Minute
	MaxLogLength          = 1<<16 - 1

	PodInitializing   = "PodInitializing" // https://github.com/kubernetes/kubernetes/blob/v1.30.1/pkg/kubelet/kubelet_pods.go#L80
	ContainerCreating = "ContainerCreating"

	ErrImagePull        = "ErrImagePull" // https://github.com/kubernetes/kubernetes/blob/v1.30.1/pkg/kubelet/images/types.go#L27
	ErrImagePullBackOff = "ImagePullBackOff"

	ErrCrashLoopBackOff = "CrashLoopBackOff" // https://github.com/kubernetes/kubernetes/blob/v1.31.0/pkg/kubelet/container/sync_result.go#L29
)

Variables

View Source
var NameSpaceKubernetes = uuid.MustParse("3f249403-2bb0-428f-8e91-504d1fd7ddb6")

Functions

func EnsureUUID added in v0.2.0

func EnsureUUID(uid ktypes.UID) types.UUID

func MarshalFirstNonNilStructFieldToJSON

func MarshalFirstNonNilStructFieldToJSON(i any) (string, string, error)

func MaxInt added in v0.2.0

func MaxInt[T constraints.Integer](x, y T) T

func NewContainers added in v0.2.0

func NewContainers[T any](
	p *Pod,
	containers []kcorev1.Container,
	statuses []kcorev1.ContainerStatus,
	factory func(types.UUID, kcorev1.Container, kcorev1.ContainerStatus) *T,
) []*T

func NewNullableString added in v0.2.0

func NewNullableString(s any) sql.NullString

func NewUUID added in v0.2.0

func NewUUID(space types.UUID, data string) types.UUID

func PodIsEvicted added in v0.2.0

func PodIsEvicted(pod *kcorev1.Pod) bool

PodIsEvicted returns true if the reported pod status is due to an eviction.

func PodIsShutDown added in v0.2.0

func PodIsShutDown(pod *kcorev1.Pod) bool

PodIsShutDown returns true if kubelet is done with the pod, or it was force-deleted.

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 Annotation added in v0.2.0

type Annotation struct {
	Uuid  types.UUID
	Name  string
	Value string
}

type Bitmask added in v0.2.0

type Bitmask[T constraints.Integer] struct {
	// contains filtered or unexported fields
}

func (Bitmask[T]) Bits added in v0.2.0

func (b Bitmask[T]) Bits() T

func (*Bitmask[T]) Clear added in v0.2.0

func (b *Bitmask[T]) Clear(flag T)

func (Bitmask[T]) Has added in v0.2.0

func (b Bitmask[T]) Has(flag T) bool

func (*Bitmask[T]) Scan added in v0.2.0

func (b *Bitmask[T]) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (*Bitmask[T]) Set added in v0.2.0

func (b *Bitmask[T]) Set(flag T)

func (*Bitmask[T]) Toggle added in v0.2.0

func (b *Bitmask[T]) Toggle(flag T)

func (Bitmask[T]) Value added in v0.2.0

func (b Bitmask[T]) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type ConfigMap

type ConfigMap struct {
	Meta
	Immutable            types.Bool
	Labels               []Label               `db:"-"`
	ConfigMapLabels      []ConfigMapLabel      `db:"-"`
	Annotations          []Annotation          `db:"-"`
	ConfigMapAnnotations []ConfigMapAnnotation `db:"-"`
}

func (*ConfigMap) Obtain

func (c *ConfigMap) Obtain(k8s kmetav1.Object)

func (*ConfigMap) Relations

func (c *ConfigMap) Relations() []database.Relation

type ConfigMapAnnotation added in v0.2.0

type ConfigMapAnnotation struct {
	ConfigMapUuid  types.UUID
	AnnotationUuid types.UUID
}

type ConfigMapLabel

type ConfigMapLabel struct {
	ConfigMapUuid types.UUID
	LabelUuid     types.UUID
}

type Container

func NewContainer added in v0.2.0

func NewContainer(podUuid types.UUID, container kcorev1.Container, status kcorev1.ContainerStatus) *Container

type ContainerCommon added in v0.2.0

type ContainerCommon struct {
	Uuid              types.UUID
	PodUuid           types.UUID
	Name              string
	Image             string
	ImagePullPolicy   string
	State             sql.NullString
	StateDetails      sql.NullString
	IcingaState       IcingaState
	IcingaStateReason string
	Devices           []ContainerDevice `db:"-"`
	Mounts            []ContainerMount  `db:"-"`
}

func (*ContainerCommon) Obtain added in v0.2.0

func (c *ContainerCommon) Obtain(podUuid types.UUID, container kcorev1.Container, status kcorev1.ContainerStatus)

func (*ContainerCommon) Relations added in v0.2.0

func (c *ContainerCommon) Relations() []database.Relation

type ContainerDevice

type ContainerDevice struct {
	ContainerUuid types.UUID
	PodUuid       types.UUID
	Name          string
	Path          string
}

type ContainerLog

type ContainerLog struct {
	PodUuid       types.UUID `db:"pod_uuid"`
	ContainerUuid types.UUID `db:"container_uuid"`
	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 ContainerLogMeta struct {
	Logs       string          `db:"logs"`
	LastUpdate types.UnixMilli `db:"last_update"`
}

type ContainerMount

type ContainerMount struct {
	ContainerUuid types.UUID
	PodUuid       types.UUID
	VolumeName    string
	Path          string
	SubPath       sql.NullString
	ReadOnly      types.Bool
}

type ContainerResources added in v0.2.0

type ContainerResources struct {
	CpuLimits      sql.NullInt64
	CpuRequests    sql.NullInt64
	MemoryLimits   sql.NullInt64
	MemoryRequests sql.NullInt64
}

func (*ContainerResources) Obtain added in v0.2.0

func (c *ContainerResources) Obtain(container kcorev1.Container)

type ContainerRestartable added in v0.2.0

type ContainerRestartable struct {
	Ready        types.Bool
	Started      types.Bool
	RestartCount int32
}

func (*ContainerRestartable) Obtain added in v0.2.0

func (c *ContainerRestartable) Obtain(status kcorev1.ContainerStatus)

type ContainerStateReasonAndMassage added in v0.2.0

type ContainerStateReasonAndMassage [2]string

func (ContainerStateReasonAndMassage) String added in v0.2.0

type CronJob

type CronJob struct {
	Meta
	Schedule                   string
	Timezone                   sql.NullString
	StartingDeadlineSeconds    sql.NullInt64
	ConcurrencyPolicy          string
	Suspend                    types.Bool
	SuccessfulJobsHistoryLimit int32
	FailedJobsHistoryLimit     int32
	Active                     int32
	LastScheduleTime           types.UnixMilli
	LastSuccessfulTime         types.UnixMilli
	Yaml                       string
	Labels                     []Label             `db:"-"`
	CronJobLabels              []CronJobLabel      `db:"-"`
	Annotations                []Annotation        `db:"-"`
	CronJobAnnotations         []CronJobAnnotation `db:"-"`
}

func (*CronJob) Obtain

func (c *CronJob) Obtain(k8s kmetav1.Object)

func (*CronJob) Relations

func (c *CronJob) Relations() []database.Relation

type CronJobAnnotation added in v0.2.0

type CronJobAnnotation struct {
	CronJobUuid    types.UUID
	AnnotationUuid types.UUID
}

type CronJobLabel

type CronJobLabel struct {
	CronJobUuid types.UUID
	LabelUuid   types.UUID
}

type DaemonSet

type DaemonSet struct {
	Meta
	UpdateStrategy         string
	MinReadySeconds        int32
	DesiredNumberScheduled int32
	CurrentNumberScheduled int32
	NumberMisscheduled     int32
	NumberReady            int32
	UpdateNumberScheduled  int32
	NumberAvailable        int32
	NumberUnavailable      int32
	Yaml                   string
	IcingaState            IcingaState
	IcingaStateReason      string
	Conditions             []DaemonSetCondition  `db:"-"`
	Owners                 []DaemonSetOwner      `db:"-"`
	Labels                 []Label               `db:"-"`
	DaemonSetLabels        []DaemonSetLabel      `db:"-"`
	Annotations            []Annotation          `db:"-"`
	DaemonSetAnnotations   []DaemonSetAnnotation `db:"-"`
}

func (*DaemonSet) Obtain

func (d *DaemonSet) Obtain(k8s kmetav1.Object)

func (*DaemonSet) Relations

func (d *DaemonSet) Relations() []database.Relation

type DaemonSetAnnotation added in v0.2.0

type DaemonSetAnnotation struct {
	DaemonSetUuid  types.UUID
	AnnotationUuid types.UUID
}

type DaemonSetCondition

type DaemonSetCondition struct {
	DaemonSetUuid  types.UUID
	Type           string
	Status         string
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

type DaemonSetLabel

type DaemonSetLabel struct {
	DaemonSetUuid types.UUID
	LabelUuid     types.UUID
}

type DaemonSetOwner added in v0.2.0

type DaemonSetOwner struct {
	DaemonSetUuid      types.UUID
	OwnerUuid          types.UUID
	Kind               string
	Name               string
	Uid                ktypes.UID
	Controller         types.Bool
	BlockOwnerDeletion types.Bool
}

type Deployment

type Deployment struct {
	Meta
	Strategy                string
	MinReadySeconds         int32
	ProgressDeadlineSeconds int32
	Paused                  types.Bool
	DesiredReplicas         int32
	ActualReplicas          int32
	UpdatedReplicas         int32
	ReadyReplicas           int32
	AvailableReplicas       int32
	UnavailableReplicas     int32
	Yaml                    string
	IcingaState             IcingaState
	IcingaStateReason       string
	Conditions              []DeploymentCondition  `db:"-"`
	Owners                  []DeploymentOwner      `db:"-"`
	Labels                  []Label                `db:"-"`
	DeploymentLabels        []DeploymentLabel      `db:"-"`
	Annotations             []Annotation           `db:"-"`
	DeploymentAnnotations   []DeploymentAnnotation `db:"-"`
}

func (*Deployment) Obtain

func (d *Deployment) Obtain(k8s kmetav1.Object)

func (*Deployment) Relations

func (d *Deployment) Relations() []database.Relation

type DeploymentAnnotation added in v0.2.0

type DeploymentAnnotation struct {
	DeploymentUuid types.UUID
	AnnotationUuid types.UUID
}

type DeploymentCondition

type DeploymentCondition struct {
	DeploymentUuid types.UUID
	Type           string
	Status         string
	LastUpdate     types.UnixMilli
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

type DeploymentLabel

type DeploymentLabel struct {
	DeploymentUuid types.UUID
	LabelUuid      types.UUID
}

type DeploymentOwner added in v0.2.0

type DeploymentOwner struct {
	DeploymentUuid     types.UUID
	OwnerUuid          types.UUID
	Kind               string
	Name               string
	Uid                ktypes.UID
	Controller         types.Bool
	BlockOwnerDeletion types.Bool
}

type Endpoint

type Endpoint struct {
	Uuid              types.UUID
	EndpointSliceUuid types.UUID
	HostName          string
	NodeName          string
	Ready             types.Bool
	Serving           types.Bool
	Terminating       types.Bool
	Address           string
	PortName          string
	Protocol          string
	Port              int32
	AppProtocol       string
}

type EndpointSlice

type EndpointSlice struct {
	Meta
	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 EndpointSliceLabel struct {
	EndpointSliceUuid types.UUID
	LabelUuid         types.UUID
}

type EndpointTargetRef

type EndpointTargetRef struct {
	EndpointSliceUuid types.UUID
	Kind              sql.NullString
	Namespace         string
	Name              string
	Uid               ktypes.UID
	ApiVersion        string
	ResourceVersion   string
}

type Event

type Event struct {
	Meta
	ReferentUuid        types.UUID
	ReportingController sql.NullString
	ReportingInstance   sql.NullString
	Action              sql.NullString
	Reason              string
	Note                string
	Type                string
	ReferenceKind       string
	ReferenceNamespace  sql.NullString
	ReferenceName       string
	FirstSeen           types.UnixMilli
	LastSeen            types.UnixMilli
	Count               int32
	Yaml                string
}

func (*Event) Obtain

func (e *Event) Obtain(k8s kmetav1.Object)

type IcingaState added in v0.2.0

type IcingaState uint8
const (
	Ok IcingaState = iota
	Pending
	Unknown
	Warning
	Critical
)

func GetContainerState added in v0.2.0

func GetContainerState(container kcorev1.Container, status kcorev1.ContainerStatus) (IcingaState, string)

func (IcingaState) String added in v0.2.0

func (s IcingaState) String() string

func (IcingaState) Value added in v0.2.0

func (s IcingaState) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Ingress

type Ingress struct {
	Meta
	Yaml                   string
	IngressTls             []IngressTls             `db:"-"`
	IngressBackendService  []IngressBackendService  `db:"-"`
	IngressBackendResource []IngressBackendResource `db:"-"`
	IngressRule            []IngressRule            `db:"-"`
}

func (*Ingress) Obtain

func (i *Ingress) Obtain(k8s kmetav1.Object)

func (*Ingress) Relations

func (i *Ingress) Relations() []database.Relation

type IngressBackendResource

type IngressBackendResource struct {
	ResourceUuid    types.UUID
	IngressUuid     types.UUID
	IngressRuleUuid types.UUID
	ApiGroup        sql.NullString
	Kind            string
	Name            string
}

type IngressBackendService

type IngressBackendService struct {
	ServiceUuid       types.UUID
	IngressUuid       types.UUID
	IngressRuleUuid   types.UUID
	ServiceName       string
	ServicePortName   string
	ServicePortNumber int32
}

type IngressRule

type IngressRule struct {
	Uuid        types.UUID
	BackendUuid types.UUID
	IngressUuid types.UUID
	Host        sql.NullString
	Path        sql.NullString
	PathType    string
}

type IngressTls

type IngressTls struct {
	IngressUuid types.UUID
	TlsHost     string
	TlsSecret   string
}

type InitContainer added in v0.2.0

type InitContainer struct {
	ContainerCommon
	ContainerResources
}

func NewInitContainer added in v0.2.0

func NewInitContainer(podUuid types.UUID, container kcorev1.Container, status kcorev1.ContainerStatus) *InitContainer

type Instance added in v0.2.0

type Instance struct {
	Uuid                   types.Binary
	Version                string
	KubernetesVersion      sql.NullString
	KubernetesHeartbeat    types.UnixMilli
	KubernetesApiReachable types.Bool
	Message                sql.NullString
	Heartbeat              types.UnixMilli
}

func (Instance) TableName added in v0.2.0

func (Instance) TableName() string

type Job

type Job struct {
	Meta
	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
	Yaml                    string
	IcingaState             IcingaState
	IcingaStateReason       string
	Conditions              []JobCondition  `db:"-"`
	Labels                  []Label         `db:"-"`
	JobLabels               []JobLabel      `db:"-"`
	Annotations             []Annotation    `db:"-"`
	JobAnnotations          []JobAnnotation `db:"-"`
	Owners                  []JobOwner      `db:"-"`
}

func (*Job) Obtain

func (j *Job) Obtain(k8s kmetav1.Object)

func (*Job) Relations

func (j *Job) Relations() []database.Relation

type JobAnnotation added in v0.2.0

type JobAnnotation struct {
	JobUuid        types.UUID
	AnnotationUuid types.UUID
}

type JobCondition

type JobCondition struct {
	JobUuid        types.UUID
	Type           string
	Status         string
	LastProbe      types.UnixMilli
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

type JobLabel

type JobLabel struct {
	JobUuid   types.UUID
	LabelUuid types.UUID
}

type JobOwner added in v0.2.0

type JobOwner struct {
	JobUuid            types.UUID
	OwnerUuid          types.UUID
	Kind               string
	Name               string
	Uid                ktypes.UID
	Controller         types.Bool
	BlockOwnerDeletion types.Bool
}

type Label

type Label struct {
	Uuid  types.UUID
	Name  string
	Value string
}

type Meta

type Meta struct {
	Uuid            types.UUID
	Uid             ktypes.UID
	Namespace       string
	Name            string
	ResourceVersion string
	Created         types.UnixMilli
}

func (*Meta) GetAnnotations

func (m *Meta) GetAnnotations() map[string]string

func (*Meta) GetCreationTimestamp

func (m *Meta) GetCreationTimestamp() kmetav1.Time

func (*Meta) GetDeletionGracePeriodSeconds

func (m *Meta) GetDeletionGracePeriodSeconds() *int64

func (*Meta) GetDeletionTimestamp

func (m *Meta) GetDeletionTimestamp() *kmetav1.Time

func (*Meta) GetFinalizers

func (m *Meta) GetFinalizers() []string

func (*Meta) GetGenerateName

func (m *Meta) GetGenerateName() string

func (*Meta) GetGeneration

func (m *Meta) GetGeneration() int64

func (*Meta) GetLabels

func (m *Meta) GetLabels() map[string]string

func (*Meta) GetManagedFields

func (m *Meta) GetManagedFields() []kmetav1.ManagedFieldsEntry

func (*Meta) GetName

func (m *Meta) GetName() string

func (*Meta) GetNamespace

func (m *Meta) GetNamespace() string

func (*Meta) GetOwnerReferences

func (m *Meta) GetOwnerReferences() []kmetav1.OwnerReference

func (*Meta) GetResourceVersion

func (m *Meta) GetResourceVersion() string
func (m *Meta) GetSelfLink() string

func (*Meta) GetUID

func (m *Meta) GetUID() ktypes.UID

func (*Meta) ObtainMeta

func (m *Meta) ObtainMeta(k8s kmetav1.Object)

func (*Meta) SetAnnotations

func (m *Meta) SetAnnotations(_ map[string]string)

func (*Meta) SetCreationTimestamp

func (m *Meta) SetCreationTimestamp(kmetav1.Time)

func (*Meta) SetDeletionGracePeriodSeconds

func (m *Meta) SetDeletionGracePeriodSeconds(*int64)

func (*Meta) SetDeletionTimestamp

func (m *Meta) SetDeletionTimestamp(*kmetav1.Time)

func (*Meta) SetFinalizers

func (m *Meta) SetFinalizers([]string)

func (*Meta) SetGenerateName

func (m *Meta) SetGenerateName(string)

func (*Meta) SetGeneration

func (m *Meta) SetGeneration(int64)

func (*Meta) SetLabels

func (m *Meta) SetLabels(map[string]string)

func (*Meta) SetManagedFields

func (m *Meta) SetManagedFields([]kmetav1.ManagedFieldsEntry)

func (*Meta) SetName

func (m *Meta) SetName(string)

func (*Meta) SetNamespace

func (m *Meta) SetNamespace(string)

func (*Meta) SetOwnerReferences

func (m *Meta) SetOwnerReferences([]kmetav1.OwnerReference)

func (*Meta) SetResourceVersion

func (m *Meta) SetResourceVersion(string)
func (m *Meta) SetSelfLink(string)

func (*Meta) SetUID

func (m *Meta) SetUID(ktypes.UID)

type Namespace

type Namespace struct {
	Meta
	Phase                string
	Yaml                 string
	Conditions           []NamespaceCondition  `db:"-"`
	Labels               []Label               `db:"-"`
	NamespaceLabels      []NamespaceLabel      `db:"-"`
	Annotations          []Annotation          `db:"-"`
	NamespaceAnnotations []NamespaceAnnotation `db:"-"`
}

func (*Namespace) Obtain

func (n *Namespace) Obtain(k8s kmetav1.Object)

func (*Namespace) Relations

func (n *Namespace) Relations() []database.Relation

type NamespaceAnnotation added in v0.2.0

type NamespaceAnnotation struct {
	NamespaceUuid  types.UUID
	AnnotationUuid types.UUID
}

type NamespaceCondition

type NamespaceCondition struct {
	NamespaceUuid  types.UUID
	Type           string
	Status         string
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

type NamespaceLabel

type NamespaceLabel struct {
	NamespaceUuid types.UUID
	LabelUuid     types.UUID
}

type Node

type Node struct {
	Meta
	PodCIDR                 string
	NumIps                  int64
	Unschedulable           types.Bool
	Ready                   types.Bool
	CpuCapacity             int64
	CpuAllocatable          int64
	MemoryCapacity          int64
	MemoryAllocatable       int64
	PodCapacity             int64
	Yaml                    string
	Roles                   string
	MachineId               string
	SystemUUID              string
	BootId                  string
	KernelVersion           string
	OsImage                 string
	OperatingSystem         string
	Architecture            string
	ContainerRuntimeVersion string
	KubeletVersion          string
	KubeProxyVersion        string
	IcingaState             IcingaState
	IcingaStateReason       string
	Conditions              []NodeCondition  `db:"-"`
	Volumes                 []NodeVolume     `db:"-"`
	Labels                  []Label          `db:"-"`
	NodeLabels              []NodeLabel      `db:"-"`
	Annotations             []Annotation     `db:"-"`
	NodeAnnotations         []NodeAnnotation `db:"-"`
}

func (*Node) Obtain

func (n *Node) Obtain(k8s kmetav1.Object)

func (*Node) Relations

func (n *Node) Relations() []database.Relation

type NodeAnnotation added in v0.2.0

type NodeAnnotation struct {
	NodeUuid       types.UUID
	AnnotationUuid types.UUID
}

type NodeCondition

type NodeCondition struct {
	NodeUuid       types.UUID
	Type           string
	Status         string
	LastHeartbeat  types.UnixMilli
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

type NodeLabel

type NodeLabel struct {
	NodeUuid  types.UUID
	LabelUuid types.UUID
}

type NodeVolume

type NodeVolume struct {
	NodeUuid   types.UUID
	Name       kcorev1.UniqueVolumeName
	DevicePath string
	Mounted    types.Bool
}

type PersistentVolume

type PersistentVolume struct {
	Meta
	AccessModes      Bitmask[kpersistentVolumeAccessModesSize]
	Capacity         int64
	ReclaimPolicy    string
	StorageClass     sql.NullString
	VolumeMode       string
	VolumeSourceType string
	VolumeSource     string
	Phase            string
	Reason           sql.NullString
	Message          sql.NullString
	Yaml             string
	Claim            *PersistentVolumeClaimRef `db:"-"`
}

func (*PersistentVolume) Obtain

func (p *PersistentVolume) Obtain(k8s kmetav1.Object)

func (*PersistentVolume) Relations

func (p *PersistentVolume) Relations() []database.Relation

type PersistentVolumeClaimRef

type PersistentVolumeClaimRef struct {
	PersistentVolumeUuid types.UUID
	Kind                 string
	Name                 string
	Uid                  ktypes.UID
}

type Pod

type Pod struct {
	Meta
	NodeName          sql.NullString
	NominatedNodeName sql.NullString
	Ip                sql.NullString
	Phase             string
	IcingaState       IcingaState
	IcingaStateReason string
	CpuLimits         sql.NullInt64
	CpuRequests       sql.NullInt64
	MemoryLimits      sql.NullInt64
	MemoryRequests    sql.NullInt64
	Reason            sql.NullString
	Message           sql.NullString
	Qos               sql.NullString
	RestartPolicy     string
	Yaml              string
	Conditions        []PodCondition      `db:"-"`
	Containers        []*Container        `db:"-"`
	InitContainers    []*InitContainer    `db:"-"`
	SidecarContainers []*SidecarContainer `db:"-"`
	Owners            []PodOwner          `db:"-"`
	Labels            []Label             `db:"-"`
	PodLabels         []PodLabel          `db:"-"`
	Annotations       []Annotation        `db:"-"`
	PodAnnotations    []PodAnnotation     `db:"-"`
	Pvcs              []PodPvc            `db:"-"`
	Volumes           []PodVolume         `db:"-"`
	// contains filtered or unexported fields
}

func (*Pod) Obtain

func (p *Pod) Obtain(k8s kmetav1.Object)

func (*Pod) Relations

func (p *Pod) Relations() []database.Relation

type PodAnnotation added in v0.2.0

type PodAnnotation struct {
	PodUuid        types.UUID
	AnnotationUuid types.UUID
}

type PodCondition

type PodCondition struct {
	PodUuid        types.UUID
	Type           string
	Status         string
	LastProbe      types.UnixMilli
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

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 PodLabel

type PodLabel struct {
	PodUuid   types.UUID
	LabelUuid types.UUID
}

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 PodOwner

type PodOwner struct {
	PodUuid            types.UUID
	OwnerUuid          types.UUID
	Kind               string
	Name               string
	Uid                ktypes.UID
	Controller         types.Bool
	BlockOwnerDeletion types.Bool
}

type PodPvc

type PodPvc struct {
	PodUuid    types.UUID
	VolumeName string
	ClaimName  string
	ReadOnly   types.Bool
}

type PodVolume

type PodVolume struct {
	PodUuid    types.UUID
	VolumeName string
	Type       string
	Source     string
}

type PodYaml added in v0.2.0

type PodYaml struct {
	PodId      types.Binary
	Kind       string
	ApiVersion string
	YamlData   string
}

type PrometheusClusterMetric added in v0.2.0

type PrometheusClusterMetric struct {
	ClusterUuid types.UUID
	Timestamp   int64
	Category    string
	Name        string
	Value       float64
}

func (*PrometheusClusterMetric) Fingerprint added in v0.2.0

func (*PrometheusClusterMetric) ID added in v0.2.0

func (*PrometheusClusterMetric) SetID added in v0.2.0

func (m *PrometheusClusterMetric) SetID(id database.ID)

type PrometheusContainerMetric added in v0.2.0

type PrometheusContainerMetric struct {
	ContainerUuid types.UUID
	Timestamp     int64
	Category      string
	Name          string
	Value         float64
}

func (*PrometheusContainerMetric) Fingerprint added in v0.2.0

func (*PrometheusContainerMetric) ID added in v0.2.0

func (*PrometheusContainerMetric) SetID added in v0.2.0

func (m *PrometheusContainerMetric) SetID(id database.ID)

type PrometheusNodeMetric added in v0.2.0

type PrometheusNodeMetric struct {
	NodeUuid  types.UUID
	Timestamp int64
	Category  string
	Name      string
	Value     float64
}

func (*PrometheusNodeMetric) Fingerprint added in v0.2.0

func (m *PrometheusNodeMetric) Fingerprint() database.Fingerprinter

func (*PrometheusNodeMetric) ID added in v0.2.0

func (*PrometheusNodeMetric) SetID added in v0.2.0

func (m *PrometheusNodeMetric) SetID(id database.ID)

type PrometheusPodMetric added in v0.2.0

type PrometheusPodMetric struct {
	PodUuid   types.UUID
	Timestamp int64
	Category  string
	Name      string
	Value     float64
}

func (*PrometheusPodMetric) Fingerprint added in v0.2.0

func (m *PrometheusPodMetric) Fingerprint() database.Fingerprinter

func (*PrometheusPodMetric) ID added in v0.2.0

func (*PrometheusPodMetric) SetID added in v0.2.0

func (m *PrometheusPodMetric) SetID(id database.ID)

type Pvc

type Pvc struct {
	Meta
	DesiredAccessModes Bitmask[kpersistentVolumeAccessModesSize]
	ActualAccessModes  Bitmask[kpersistentVolumeAccessModesSize]
	MinimumCapacity    sql.NullInt64
	ActualCapacity     sql.NullInt64
	Phase              string
	VolumeName         sql.NullString
	VolumeMode         string
	StorageClass       sql.NullString
	Yaml               string
	Conditions         []PvcCondition  `db:"-"`
	Labels             []Label         `db:"-"`
	PvcLabels          []PvcLabel      `db:"-"`
	Annotations        []Annotation    `db:"-"`
	PvcAnnotations     []PvcAnnotation `db:"-"`
}

func (*Pvc) Obtain

func (p *Pvc) Obtain(k8s kmetav1.Object)

func (*Pvc) Relations

func (p *Pvc) Relations() []database.Relation

type PvcAnnotation added in v0.2.0

type PvcAnnotation struct {
	PvcUuid        types.UUID
	AnnotationUuid types.UUID
}

type PvcCondition

type PvcCondition struct {
	PvcUuid        types.UUID
	Type           string
	Status         string
	LastProbe      types.UnixMilli
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

type PvcLabel

type PvcLabel struct {
	PvcUuid   types.UUID
	LabelUuid types.UUID
}

type ReplicaSet

type ReplicaSet struct {
	Meta
	DesiredReplicas       int32
	MinReadySeconds       int32
	ActualReplicas        int32
	FullyLabeledReplicas  int32
	ReadyReplicas         int32
	AvailableReplicas     int32
	Yaml                  string
	IcingaState           IcingaState
	IcingaStateReason     string
	Conditions            []ReplicaSetCondition  `db:"-"`
	Owners                []ReplicaSetOwner      `db:"-"`
	Labels                []Label                `db:"-"`
	ReplicaSetLabels      []ReplicaSetLabel      `db:"-"`
	Annotations           []Annotation           `db:"-"`
	ReplicaSetAnnotations []ReplicaSetAnnotation `db:"-"`
}

func (*ReplicaSet) Obtain

func (r *ReplicaSet) Obtain(k8s kmetav1.Object)

func (*ReplicaSet) Relations

func (r *ReplicaSet) Relations() []database.Relation

type ReplicaSetAnnotation added in v0.2.0

type ReplicaSetAnnotation struct {
	ReplicaSetUuid types.UUID
	AnnotationUuid types.UUID
}

type ReplicaSetCondition

type ReplicaSetCondition struct {
	ReplicaSetUuid types.UUID
	Type           string
	Status         string
	LastTransition types.UnixMilli
	Reason         string
	Message        string
}

type ReplicaSetLabel

type ReplicaSetLabel struct {
	ReplicaSetUuid types.UUID
	LabelUuid      types.UUID
}

type ReplicaSetOwner

type ReplicaSetOwner struct {
	ReplicaSetUuid     types.UUID
	OwnerUuid          types.UUID
	Kind               string
	Name               string
	Uid                ktypes.UID
	Controller         types.Bool
	BlockOwnerDeletion types.Bool
}

type Resource

type Resource interface {
	kmetav1.Object
	Obtain(k8s kmetav1.Object)
}

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 NewEvent

func NewEvent() Resource

func NewIngress

func NewIngress() Resource

func NewJob

func NewJob() Resource

func NewNamespace

func NewNamespace() Resource

func NewNode

func NewNode() Resource

func NewPersistentVolume

func NewPersistentVolume() Resource

func NewPvc

func NewPvc() Resource

func NewReplicaSet

func NewReplicaSet() Resource

func NewSecret

func NewSecret() Resource

func NewService

func NewService() Resource

func NewStatefulSet

func NewStatefulSet() Resource

type Secret

type Secret struct {
	Meta
	Type              string
	Immutable         types.Bool
	Labels            []Label            `db:"-"`
	SecretLabels      []SecretLabel      `db:"-"`
	Annotations       []Annotation       `db:"-"`
	SecretAnnotations []SecretAnnotation `db:"-"`
}

func (*Secret) Obtain

func (s *Secret) Obtain(k8s kmetav1.Object)

func (*Secret) Relations

func (s *Secret) Relations() []database.Relation

type SecretAnnotation added in v0.2.0

type SecretAnnotation struct {
	SecretUuid     types.UUID
	AnnotationUuid types.UUID
}

type SecretLabel

type SecretLabel struct {
	SecretUuid types.UUID
	LabelUuid  types.UUID
}

type Selector

type Selector struct {
	Uuid  types.UUID
	Name  string
	Value string
}

type Service

type Service struct {
	Meta
	ClusterIP                     string
	ClusterIPs                    string
	Type                          string
	ExternalIPs                   sql.NullString
	SessionAffinity               string
	ExternalName                  sql.NullString
	ExternalTrafficPolicy         sql.NullString
	HealthCheckNodePort           sql.NullInt32
	PublishNotReadyAddresses      types.Bool
	IpFamilies                    sql.NullString
	IpFamilyPolicy                sql.NullString
	AllocateLoadBalancerNodePorts types.Bool
	LoadBalancerClass             sql.NullString
	InternalTrafficPolicy         string
	Yaml                          string
	Selectors                     []Selector          `db:"-"`
	ServiceSelectors              []ServiceSelector   `db:"-"`
	Ports                         []ServicePort       `db:"-"`
	Conditions                    []ServiceCondition  `db:"-"`
	Labels                        []Label             `db:"-"`
	ServiceLabels                 []ServiceLabel      `db:"-"`
	Annotations                   []Annotation        `db:"-"`
	ServiceAnnotations            []ServiceAnnotation `db:"-"`
}

func (*Service) Obtain

func (s *Service) Obtain(k8s kmetav1.Object)

func (*Service) Relations

func (s *Service) Relations() []database.Relation

type ServiceAnnotation added in v0.2.0

type ServiceAnnotation struct {
	ServiceUuid    types.UUID
	AnnotationUuid types.UUID
}

type ServiceCondition

type ServiceCondition struct {
	ServiceUuid        types.UUID
	Type               string
	Status             string
	ObservedGeneration int64
	LastTransition     types.UnixMilli
	Reason             string
	Message            string
}

type ServiceLabel

type ServiceLabel struct {
	ServiceUuid types.UUID
	LabelUuid   types.UUID
}

type ServicePort

type ServicePort struct {
	ServiceUuid types.UUID
	Name        string
	Protocol    string
	AppProtocol string
	Port        int32
	TargetPort  string
	NodePort    int32
}

type ServiceSelector

type ServiceSelector struct {
	ServiceUuid  types.UUID
	SelectorUuid types.UUID
}

type SidecarContainer added in v0.2.0

type SidecarContainer struct {
	ContainerCommon
	ContainerResources
	ContainerRestartable
}

func NewSidecarContainer added in v0.2.0

func NewSidecarContainer(podUuid types.UUID, container kcorev1.Container, status kcorev1.ContainerStatus) *SidecarContainer

type StatefulSet

type StatefulSet struct {
	Meta
	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
	Yaml                                            string
	IcingaState                                     IcingaState
	IcingaStateReason                               string
	Conditions                                      []StatefulSetCondition  `db:"-"`
	Owners                                          []StatefulSetOwner      `db:"-"`
	Labels                                          []Label                 `db:"-"`
	StatefulSetLabels                               []StatefulSetLabel      `db:"-"`
	Annotations                                     []Annotation            `db:"-"`
	StatefulSetAnnotations                          []StatefulSetAnnotation `db:"-"`
}

func (*StatefulSet) Obtain

func (s *StatefulSet) Obtain(k8s kmetav1.Object)

func (*StatefulSet) Relations

func (s *StatefulSet) Relations() []database.Relation

type StatefulSetAnnotation added in v0.2.0

type StatefulSetAnnotation struct {
	StatefulSetUuid types.UUID
	AnnotationUuid  types.UUID
}

type StatefulSetCondition

type StatefulSetCondition struct {
	StatefulSetUuid types.UUID
	Type            string
	Status          string
	LastTransition  types.UnixMilli
	Reason          string
	Message         string
}

type StatefulSetLabel

type StatefulSetLabel struct {
	StatefulSetUuid types.UUID
	LabelUuid       types.UUID
}

type StatefulSetOwner added in v0.2.0

type StatefulSetOwner struct {
	StatefulSetUuid    types.UUID
	OwnerUuid          types.UUID
	Kind               string
	Name               string
	Uid                ktypes.UID
	Controller         types.Bool
	BlockOwnerDeletion types.Bool
}

Jump to

Keyboard shortcuts

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