namespace EntKube.Web.Data; /// /// A snapshot of a CNPG cluster's live state including pod information, /// overall health, and timeline details queried from Kubernetes. /// Used by the UI to show real-time status beyond what's stored in the database. /// public class CnpgClusterDetail { /// /// The managed cluster record from the database. /// public required CnpgCluster Cluster { get; set; } /// /// Live pod information from Kubernetes. /// public List Pods { get; set; } = []; /// /// The CNPG cluster phase as reported by the Cluster status (e.g. "Cluster in healthy state"). /// public string Phase { get; set; } = "Unknown"; /// /// Number of instances that are currently ready. /// public int ReadyInstances { get; set; } /// /// Current primary pod name. /// public string? CurrentPrimary { get; set; } /// /// Current WAL timeline (indicates how many failovers/restores have occurred). /// public int? CurrentTimeline { get; set; } /// /// The current write LAG in bytes across replicas (0 = fully caught up). /// public long ReplicationLagBytes { get; set; } /// /// Live-synced backup list reconciled from K8s Backup CRs plus the DB records. /// Populated by GetClusterDetailAsync; falls back to Cluster.Backups if sync is skipped. /// public List Backups { get; set; } = []; } /// /// Information about a single pod in a CNPG cluster, including its role /// (primary or replica), status, and resource usage. /// public class CnpgPodInfo { /// /// The pod name (e.g. "my-cluster-1", "my-cluster-2"). /// public required string Name { get; set; } /// /// The role of this pod: "primary" or "replica". /// public required string Role { get; set; } /// /// The Kubernetes pod phase (Running, Pending, Succeeded, Failed, Unknown). /// public required string Status { get; set; } /// /// Whether all containers in the pod are ready. /// public bool Ready { get; set; } /// /// The node this pod is scheduled on. /// public string? Node { get; set; } /// /// When the pod started. /// public DateTime? StartTime { get; set; } /// /// For replicas: replication lag in bytes behind the primary. /// public long? ReplicationLagBytes { get; set; } /// /// Pod restart count (sum of all container restarts). /// public int Restarts { get; set; } }