diff --git a/README.md b/README.md index 8355569..b8b7b33 100644 --- a/README.md +++ b/README.md @@ -159,8 +159,8 @@ sudo apt-get install -y gcc make libssl-dev pkg-config - Daemonsets - [x] Apply - [ ] Remove - - [ ] List - - [ ] Output matches kubectl + - [x] List + - [x] Output matches kubectl - Ingress - [x] Apply - [x] Remove @@ -176,7 +176,7 @@ sudo apt-get install -y gcc make libssl-dev pkg-config - [x] Apply - [x] Remove - [x] List - - [ ] Output matches kubectl + - [x] Output matches kubectl - Goal here is to support private image pull - ClusterIssuer - For letsencrypt diff --git a/src/get/daemonset.rs b/src/get/daemonset.rs index fbd6ff0..ee9752e 100644 --- a/src/get/daemonset.rs +++ b/src/get/daemonset.rs @@ -76,7 +76,7 @@ impl Lister<(usize, String, PodmanPodInfo)> for DaemonsetLister { return acc; }); let namespace = pods.first().unwrap().labels.get("skate.io/namespace").unwrap_or(&"default".to_string()).clone(); - let node_selector = pods.first().unwrap().labels.iter().filter(|(k, _)| k.starts_with("nodeselector/")).map(|(k, v)| format!("{}={}", k, v)).collect_vec().join(","); + let node_selector = pods.first().unwrap().labels.iter().filter(|(k, _)| k.starts_with("nodeselector/")).map(|(k, v)| k.clone()).collect_vec().join(","); // assuming that we want same number as nodes, that's wrong but anyway println!( diff --git a/src/skatelet/system.rs b/src/skatelet/system.rs index b38fc83..3a204ac 100644 --- a/src/skatelet/system.rs +++ b/src/skatelet/system.rs @@ -9,6 +9,7 @@ use anyhow::anyhow; use clap::{Args, Subcommand}; use k8s_openapi::api::core::v1::Secret; +use k8s_openapi::ByteString; use serde::{Deserialize, Serialize}; use serde_yaml::Value; use podman::PodmanPodInfo; @@ -166,14 +167,23 @@ async fn info() -> Result<(), Box> { let secret_info: Vec = serde_json::from_str(&secret_json).map_err(|e| anyhow!(e).context("failed to deserialize secret info"))?; let secret_info: Vec = secret_info.iter().filter_map(|s| { - - let yaml: Value = serde_yaml::from_str(&s.secret_data).unwrap(); - - let manifest_result: Result = serde_yaml::from_value(yaml.clone()); + let manifest_result: Result = serde_yaml::from_str(&s.secret_data); if manifest_result.is_err() { return None; } + let mut k8s_secret = manifest_result.unwrap(); + k8s_secret.data = k8s_secret.data.clone().and_then(|data| { + Some(data.into_iter().map(|(k, _)| (k, ByteString{ 0: vec![] })).collect()) + }); + + k8s_secret.string_data = k8s_secret.string_data.clone().and_then(|data| { + Some(data.into_iter().map(|(k, _)| (k, "".to_string())).collect()) + }); + + let yaml = serde_yaml::to_value(&k8s_secret).unwrap(); + + Some(ObjectListItem { name: NamespacedName::from(s.spec.name.as_str()), manifest_hash: "".to_string(), // TODO get from manifest