Discover applications on the cluster and the host for backups
Kubernetes workloads are grouped by their Helm instance label into applications, each offering what is worth backing up: data volumes, a PostgreSQL dump instead of the database's own volume, and optionally the namespace manifests. Caches are listed but not preselected. Host applications come from running systemd services that declare a state or working directory. Selecting components creates one strategy each. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@ -338,6 +338,22 @@ impl HostInspector for FakeInspector {
|
||||
reboot_required: true,
|
||||
})
|
||||
}
|
||||
async fn services(&self) -> Result<Vec<domain::host::HostService>, DomainError> {
|
||||
Ok(vec![
|
||||
domain::host::HostService {
|
||||
unit: "monitoring.service".into(),
|
||||
description: "SoftVisor Infrastructure Monitoring".into(),
|
||||
working_dir: Some("/opt/monitoring".into()),
|
||||
state_dir: None,
|
||||
},
|
||||
domain::host::HostService {
|
||||
unit: "ssh.service".into(),
|
||||
description: "OpenBSD Secure Shell server".into(),
|
||||
working_dir: None,
|
||||
state_dir: None,
|
||||
},
|
||||
])
|
||||
}
|
||||
async fn packages(&self) -> Result<Vec<Package>, DomainError> {
|
||||
Ok(vec![
|
||||
Package {
|
||||
@ -421,6 +437,16 @@ pub struct MemCluster {
|
||||
pub fail: std::sync::atomic::AtomicBool,
|
||||
}
|
||||
|
||||
fn helm_labels(instance: &str, role: &str) -> std::collections::BTreeMap<String, String> {
|
||||
[
|
||||
("app.kubernetes.io/instance", instance),
|
||||
("app.kubernetes.io/name", role),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn sample_overview() -> ClusterOverview {
|
||||
ClusterOverview {
|
||||
nodes: vec![NodeInfo {
|
||||
@ -443,6 +469,8 @@ pub fn sample_overview() -> ClusterOverview {
|
||||
name: "gitea".into(),
|
||||
image: "gitea/gitea:1.22.3".into(),
|
||||
}],
|
||||
labels: helm_labels("gitea", "gitea"),
|
||||
claims: vec!["gitea-shared-storage".into()],
|
||||
},
|
||||
Workload {
|
||||
namespace: "gitea".into(),
|
||||
@ -454,6 +482,8 @@ pub fn sample_overview() -> ClusterOverview {
|
||||
name: "postgresql".into(),
|
||||
image: "bitnami/postgresql:16.4.0".into(),
|
||||
}],
|
||||
labels: helm_labels("gitea", "postgresql"),
|
||||
claims: vec!["data-gitea-postgresql-0".into()],
|
||||
},
|
||||
],
|
||||
volume_claims: vec![VolumeClaim {
|
||||
|
||||
Reference in New Issue
Block a user