mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-09 16:00:59 +00:00
Expand Docker and Kubernetes platform projections
This commit is contained in:
parent
d3934e19e3
commit
6346929328
63 changed files with 5858 additions and 258 deletions
|
|
@ -12,12 +12,16 @@ type NetworkInterface = hostagent.NetworkInterface
|
|||
|
||||
// Report represents a single heartbeat from the Docker agent to Pulse.
|
||||
type Report struct {
|
||||
Agent AgentInfo `json:"agent"`
|
||||
Host HostInfo `json:"host"`
|
||||
Containers []Container `json:"containers"`
|
||||
Services []Service `json:"services,omitempty"`
|
||||
Tasks []Task `json:"tasks,omitempty"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Agent AgentInfo `json:"agent"`
|
||||
Host HostInfo `json:"host"`
|
||||
Containers []Container `json:"containers"`
|
||||
Images []Image `json:"images,omitempty"`
|
||||
Volumes []Volume `json:"volumes,omitempty"`
|
||||
Networks []Network `json:"networks,omitempty"`
|
||||
Services []Service `json:"services,omitempty"`
|
||||
Tasks []Task `json:"tasks,omitempty"`
|
||||
StorageUsage *StorageUsage `json:"storageUsage,omitempty"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
}
|
||||
|
||||
// AgentInfo describes the reporting agent instance.
|
||||
|
|
@ -145,6 +149,71 @@ type UpdateStatus struct {
|
|||
Error string `json:"error,omitempty"` // e.g., "rate limited", "auth required"
|
||||
}
|
||||
|
||||
// Image summarises a local image available through the Docker-compatible API.
|
||||
type Image struct {
|
||||
ID string `json:"id"`
|
||||
RepoTags []string `json:"repoTags,omitempty"`
|
||||
RepoDigests []string `json:"repoDigests,omitempty"`
|
||||
SizeBytes int64 `json:"sizeBytes,omitempty"`
|
||||
SharedSizeBytes int64 `json:"sharedSizeBytes,omitempty"`
|
||||
Containers int64 `json:"containers,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// Volume summarises a local volume available through the Docker-compatible API.
|
||||
type Volume struct {
|
||||
Name string `json:"name"`
|
||||
Driver string `json:"driver,omitempty"`
|
||||
Mountpoint string `json:"mountpoint,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
SizeBytes int64 `json:"sizeBytes,omitempty"`
|
||||
RefCount int64 `json:"refCount,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Options map[string]string `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
// Network summarises a local network available through the Docker-compatible API.
|
||||
type Network struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Driver string `json:"driver,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
EnableIPv4 bool `json:"enableIpv4,omitempty"`
|
||||
EnableIPv6 bool `json:"enableIpv6,omitempty"`
|
||||
Internal bool `json:"internal,omitempty"`
|
||||
Attachable bool `json:"attachable,omitempty"`
|
||||
Ingress bool `json:"ingress,omitempty"`
|
||||
ConfigOnly bool `json:"configOnly,omitempty"`
|
||||
Subnets []NetworkSubnet `json:"subnets,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Options map[string]string `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
// NetworkSubnet summarises a network IPAM subnet.
|
||||
type NetworkSubnet struct {
|
||||
Subnet string `json:"subnet,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"`
|
||||
}
|
||||
|
||||
// StorageUsage summarises the Docker-compatible /system/df API buckets.
|
||||
type StorageUsage struct {
|
||||
Images StorageUsageBucket `json:"images,omitempty"`
|
||||
Containers StorageUsageBucket `json:"containers,omitempty"`
|
||||
Volumes StorageUsageBucket `json:"volumes,omitempty"`
|
||||
BuildCache StorageUsageBucket `json:"buildCache,omitempty"`
|
||||
}
|
||||
|
||||
// StorageUsageBucket captures one /system/df resource family.
|
||||
type StorageUsageBucket struct {
|
||||
TotalCount int64 `json:"totalCount,omitempty"`
|
||||
ActiveCount int64 `json:"activeCount,omitempty"`
|
||||
TotalSizeBytes int64 `json:"totalSizeBytes,omitempty"`
|
||||
ReclaimableBytes int64 `json:"reclaimableBytes,omitempty"`
|
||||
}
|
||||
|
||||
// AgentKey returns the stable identifier for a reporting agent.
|
||||
func (r Report) AgentKey() string {
|
||||
if r.Agent.ID != "" {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,23 @@ import "time"
|
|||
// Report represents a single heartbeat from the Kubernetes agent to Pulse.
|
||||
// It is designed to be useful without requiring Metrics Server (metrics.k8s.io).
|
||||
type Report struct {
|
||||
Agent AgentInfo `json:"agent"`
|
||||
Cluster ClusterInfo `json:"cluster"`
|
||||
Nodes []Node `json:"nodes,omitempty"`
|
||||
Pods []Pod `json:"pods,omitempty"`
|
||||
Deployments []Deployment `json:"deployments,omitempty"`
|
||||
Recovery *RecoveryReport `json:"recovery,omitempty"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Agent AgentInfo `json:"agent"`
|
||||
Cluster ClusterInfo `json:"cluster"`
|
||||
Nodes []Node `json:"nodes,omitempty"`
|
||||
Namespaces []Namespace `json:"namespaces,omitempty"`
|
||||
Pods []Pod `json:"pods,omitempty"`
|
||||
Deployments []Deployment `json:"deployments,omitempty"`
|
||||
StatefulSets []StatefulSet `json:"statefulSets,omitempty"`
|
||||
DaemonSets []DaemonSet `json:"daemonSets,omitempty"`
|
||||
Services []Service `json:"services,omitempty"`
|
||||
Jobs []Job `json:"jobs,omitempty"`
|
||||
CronJobs []CronJob `json:"cronJobs,omitempty"`
|
||||
Ingresses []Ingress `json:"ingresses,omitempty"`
|
||||
PersistentVolumes []PersistentVolume `json:"persistentVolumes,omitempty"`
|
||||
PersistentVolumeClaims []PersistentVolumeClaim `json:"persistentVolumeClaims,omitempty"`
|
||||
Events []Event `json:"events,omitempty"`
|
||||
Recovery *RecoveryReport `json:"recovery,omitempty"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
}
|
||||
|
||||
// AgentInfo describes the reporting agent instance.
|
||||
|
|
@ -114,6 +124,152 @@ type Deployment struct {
|
|||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// Namespace represents a Kubernetes namespace at report time.
|
||||
type Namespace struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Phase string `json:"phase,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// StatefulSet represents a Kubernetes stateful set at report time.
|
||||
type StatefulSet struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
|
||||
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
|
||||
CurrentReplicas int32 `json:"currentReplicas,omitempty"`
|
||||
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
|
||||
AvailableReplicas int32 `json:"availableReplicas,omitempty"`
|
||||
ServiceName string `json:"serviceName,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// DaemonSet represents a Kubernetes daemon set at report time.
|
||||
type DaemonSet struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
DesiredNumberScheduled int32 `json:"desiredNumberScheduled,omitempty"`
|
||||
CurrentNumberScheduled int32 `json:"currentNumberScheduled,omitempty"`
|
||||
NumberReady int32 `json:"numberReady,omitempty"`
|
||||
UpdatedNumberScheduled int32 `json:"updatedNumberScheduled,omitempty"`
|
||||
NumberAvailable int32 `json:"numberAvailable,omitempty"`
|
||||
NumberUnavailable int32 `json:"numberUnavailable,omitempty"`
|
||||
NumberMisscheduled int32 `json:"numberMisscheduled,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// Service represents a Kubernetes service at report time.
|
||||
type Service struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Type string `json:"type,omitempty"`
|
||||
ClusterIP string `json:"clusterIp,omitempty"`
|
||||
ExternalIPs []string `json:"externalIps,omitempty"`
|
||||
Ports []ServicePort `json:"ports,omitempty"`
|
||||
Selector map[string]string `json:"selector,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// ServicePort describes one Kubernetes service port.
|
||||
type ServicePort struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Port int32 `json:"port,omitempty"`
|
||||
TargetPort string `json:"targetPort,omitempty"`
|
||||
NodePort int32 `json:"nodePort,omitempty"`
|
||||
}
|
||||
|
||||
// Job represents a Kubernetes job at report time.
|
||||
type Job struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
DesiredCompletions int32 `json:"desiredCompletions,omitempty"`
|
||||
Succeeded int32 `json:"succeeded,omitempty"`
|
||||
Failed int32 `json:"failed,omitempty"`
|
||||
Active int32 `json:"active,omitempty"`
|
||||
StartTime *time.Time `json:"startTime,omitempty"`
|
||||
CompletionTime *time.Time `json:"completionTime,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// CronJob represents a Kubernetes cron job at report time.
|
||||
type CronJob struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Schedule string `json:"schedule,omitempty"`
|
||||
Suspend bool `json:"suspend,omitempty"`
|
||||
Active int `json:"active,omitempty"`
|
||||
LastScheduleTime *time.Time `json:"lastScheduleTime,omitempty"`
|
||||
LastSuccessfulTime *time.Time `json:"lastSuccessfulTime,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// Ingress represents a Kubernetes ingress at report time.
|
||||
type Ingress struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
ClassName string `json:"className,omitempty"`
|
||||
Hosts []string `json:"hosts,omitempty"`
|
||||
Addresses []string `json:"addresses,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// PersistentVolume represents a Kubernetes persistent volume at report time.
|
||||
type PersistentVolume struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Phase string `json:"phase,omitempty"`
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
CapacityBytes int64 `json:"capacityBytes,omitempty"`
|
||||
AccessModes []string `json:"accessModes,omitempty"`
|
||||
ReclaimPolicy string `json:"reclaimPolicy,omitempty"`
|
||||
ClaimNamespace string `json:"claimNamespace,omitempty"`
|
||||
ClaimName string `json:"claimName,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// PersistentVolumeClaim represents a Kubernetes persistent volume claim at report time.
|
||||
type PersistentVolumeClaim struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Phase string `json:"phase,omitempty"`
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
RequestedBytes int64 `json:"requestedBytes,omitempty"`
|
||||
CapacityBytes int64 `json:"capacityBytes,omitempty"`
|
||||
AccessModes []string `json:"accessModes,omitempty"`
|
||||
VolumeName string `json:"volumeName,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// Event represents a Kubernetes event at report time.
|
||||
type Event struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
InvolvedKind string `json:"involvedKind,omitempty"`
|
||||
InvolvedName string `json:"involvedName,omitempty"`
|
||||
Count int32 `json:"count,omitempty"`
|
||||
FirstSeen *time.Time `json:"firstSeen,omitempty"`
|
||||
LastSeen *time.Time `json:"lastSeen,omitempty"`
|
||||
EventTime *time.Time `json:"eventTime,omitempty"`
|
||||
}
|
||||
|
||||
// RecoveryReport contains optional, best-effort "recovery point" artifacts discovered by the agent.
|
||||
// This is intentionally capped and time-bounded by the agent to keep payloads small.
|
||||
type RecoveryReport struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue