Compare commits

..

1 Commits

Author SHA1 Message Date
7cb5237fdd fix(secret): openbao implementation wrong fs write call on windows
All checks were successful
Run Check Script / check (push) Successful in 1m48s
Compile and package harmony_composer / package_harmony_composer (push) Successful in 7m40s
2026-03-23 09:20:43 -04:00
2 changed files with 9 additions and 6 deletions

View File

@@ -52,7 +52,7 @@
//! }
//! ```
use kube::{Error, Resource, ResourceExt, api::DynamicObject, core::ErrorResponse};
use kube::{Error, Resource, ResourceExt, api::DynamicObject};
use serde::Serialize;
use serde_json;
@@ -117,13 +117,16 @@ impl ResourceBundle {
/// Delete all resources in this bundle from the cluster.
/// Resources are deleted in reverse order to respect dependencies.
pub async fn delete(&self, client: &K8sClient) -> Result<(), Error> {
// FIXME delete all in parallel and retry using kube::client::retry::RetryPolicy
for res in self.resources.iter().rev() {
let api = client.get_api_for_dynamic_object(res, res.namespace().as_deref())?;
let name = res.name_any();
match api.delete(&name, &kube::api::DeleteParams::default()).await {
Ok(_) | Err(Error::Api(ErrorResponse { code: 404, .. })) => {}
Err(e) => return Err(e),
}
// FIXME this swallows all errors. Swallowing a 404 is ok but other errors must be
// handled properly (such as retrying). A normal error case is when we delete a
// resource bundle with dependencies between various resources. Such as a pod with a
// dependency on a ClusterRoleBinding. Trying to delete the ClusterRoleBinding first
// is expected to fail
let _ = api.delete(&name, &kube::api::DeleteParams::default()).await;
}
Ok(())
}

View File

@@ -183,7 +183,7 @@ impl OpenbaoSecretStore {
}
#[cfg(not(unix))]
{
fs::write(path, token)?;
fs::write(path, serde_json::to_string(token)?.as_bytes())?;
}
Ok(())
}