Skip to content

Commit

Permalink
Dont save secret data
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnedo committed Aug 3, 2024
1 parent a1af7bd commit accc644
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/get/daemonset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
18 changes: 14 additions & 4 deletions src/skatelet/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -166,14 +167,23 @@ async fn info() -> Result<(), Box<dyn Error>> {

let secret_info: Vec<PodmanSecret> = serde_json::from_str(&secret_json).map_err(|e| anyhow!(e).context("failed to deserialize secret info"))?;
let secret_info: Vec<ObjectListItem> = secret_info.iter().filter_map(|s| {

let yaml: Value = serde_yaml::from_str(&s.secret_data).unwrap();

let manifest_result: Result<Secret, _> = serde_yaml::from_value(yaml.clone());
let manifest_result: Result<Secret, _> = 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
Expand Down

0 comments on commit accc644

Please sign in to comment.