Skip to content

Commit

Permalink
Merge pull request #710 from kate-goldenring/fix-broker-properties
Browse files Browse the repository at this point in the history
fix/feat: add duplicate envs without instance suffix
  • Loading branch information
kate-goldenring authored Oct 28, 2024
2 parents 49eb225 + a77c94f commit ea21796
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 29 deletions.
32 changes: 16 additions & 16 deletions 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
Expand Up @@ -23,7 +23,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.13.5"
version = "0.13.6"
edition = "2021"
license = "Apache-2.0"
homepage = "https://docs.akri.sh/"
Expand Down
30 changes: 21 additions & 9 deletions agent/src/plugin_manager/device_plugin_instance_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,28 @@ fn cdi_device_to_car(device: &cdi::Device) -> ContainerAllocateResponse {
.last()
.unwrap_or_default()
.to_uppercase();

// Mount all device environment variables with and without a suffix of the
// instance hash. Envs without a suffix could be undeterministically
// overridden by other allocated instances discovered by the same Discovery
// Handler. Unsuffixed envs should only be referrenced if they are
// additional Configuration.broker_properties or if only one instance of a
// DH is allocated to the broker.
let envs = device
.container_edits
.env
.iter()
.map(|e| match e.split_once('=') {
Some((k, v)) => (k.to_string(), v.to_string()),
None => (e.to_string(), "".to_string()),
});

let suffixed_envs = envs
.clone()
.map(|(k, v)| (format!("{}_{}", k, instance_hash), v));

ContainerAllocateResponse {
envs: device
.container_edits
.env
.iter()
.map(|e| match e.split_once('=') {
Some((k, v)) => (format!("{}_{}", k, instance_hash), v.to_string()),
None => (format!("{}_{}", e, instance_hash), "".to_string()),
})
.collect(),
envs: envs.chain(suffixed_envs).collect(),
mounts: device
.container_edits
.mounts
Expand Down
4 changes: 2 additions & 2 deletions deployment/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.13.5
version: 0.13.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 0.13.5
appVersion: 0.13.6
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.5
0.13.6

0 comments on commit ea21796

Please sign in to comment.