Skip to content

Commit

Permalink
fix: patching
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshrayas committed Jan 9, 2025
1 parent 49135c9 commit 38dadfd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kube-saver"
version = "0.8.0"
version = "0.10.1"
edition = "2021"
authors = ["Mahesh Rayas<[email protected]>"]

Expand Down
16 changes: 8 additions & 8 deletions src/controller/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ impl UpscaleMachinery {
};
let mut patch = Map::new();
patch.insert("spec".to_string(), spec);
// If "flux" annotation is disabled, remove it
// If "flux" annotation is disabled, enable it
if is_flux_disabled {
let mut updated_annotations = annotations.clone();
updated_annotations.remove("kustomize.toolkit.fluxcd.io/reconcile");
patch.insert(
"metadata".to_string(),
json!({ "annotations": updated_annotations }),
);
let annotations: Value = json!({
"annotations": {
"kustomize.toolkit.fluxcd.io/reconcile": "enabled",
}
});

patch.insert("metadata".to_string(), annotations);
}

let patch_object = Value::Object(patch);

let rs = dynamic_resource_type(c, &self.namespace, self.resource_type);
match rs {
Some(rs) => rs.patch_resource(&self.name, &patch_object).await,
Expand Down

0 comments on commit 38dadfd

Please sign in to comment.