Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug echo properties #288

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 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 agent/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "agent"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>", "<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion controller/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "controller"
version = "0.4.2"
version = "0.4.3"
authors = ["<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions deployment/helm/Chart.yaml
Expand Up @@ -15,9 +15,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.4.2
version: 0.4.3

# 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.4.2
appVersion: 0.4.3
@@ -1,6 +1,6 @@
[package]
name = "debug-echo-discovery-handler"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
@@ -1,6 +1,6 @@
[package]
name = "onvif-discovery-handler"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
@@ -1,6 +1,6 @@
[package]
name = "opcua-discovery-handler"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
@@ -1,6 +1,6 @@
[package]
name = "udev-discovery-handler"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/debug-echo/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-debug-echo"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
26 changes: 20 additions & 6 deletions discovery-handlers/debug-echo/src/discovery_handler.rs
Expand Up @@ -98,11 +98,18 @@ impl DiscoveryHandler for DiscoveryHandlerImpl {
offline = false;
let devices = descriptions
.iter()
.map(|description| Device {
id: description.clone(),
properties: HashMap::new(),
mounts: Vec::default(),
device_specs: Vec::default(),
.map(|description| {
let mut properties = HashMap::new();
properties.insert(
super::DEBUG_ECHO_DESCRIPTION_LABEL.to_string(),
description.clone(),
);
Device {
id: description.clone(),
properties,
mounts: Vec::default(),
device_specs: Vec::default(),
}
})
.collect::<Vec<Device>>();
if let Err(e) = discovered_devices_sender
Expand Down Expand Up @@ -168,9 +175,16 @@ mod tests {
"#;
let deserialized: DiscoveryHandlerInfo = serde_yaml::from_str(&debug_echo_yaml).unwrap();
let discovery_handler = DiscoveryHandlerImpl::new(None);
let properties: HashMap<String, String> = [(
super::super::DEBUG_ECHO_DESCRIPTION_LABEL.to_string(),
"foo1".to_string(),
)]
.iter()
.cloned()
.collect();
let device = akri_discovery_utils::discovery::v0::Device {
id: "foo1".to_string(),
properties: HashMap::new(),
properties,
mounts: Vec::default(),
device_specs: Vec::default(),
};
Expand Down
3 changes: 3 additions & 0 deletions discovery-handlers/debug-echo/src/lib.rs
Expand Up @@ -8,3 +8,6 @@ pub const DISCOVERY_HANDLER_NAME: &str = "debugEcho";
/// Label of the environment variable in debugEcho discovery handlers that sets whether debug echo registers
/// as discovering local instances on nodes rather than ones visible to multiple nodes
pub const DEBUG_ECHO_INSTANCES_SHARED_LABEL: &str = "DEBUG_ECHO_INSTANCES_SHARED";
/// Name of environment variable that is set in debug echo brokers. Contains the description of
/// the device.
pub const DEBUG_ECHO_DESCRIPTION_LABEL: &str = "DEBUG_ECHO_DESCRIPTION";
2 changes: 1 addition & 1 deletion discovery-handlers/onvif/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-onvif"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/opcua/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-opcua"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/udev/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-udev"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-utils/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-discovery-utils"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion samples/brokers/udev-video-broker/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "udev-video-broker"
version = "0.4.2"
version = "0.4.3"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>", "<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion shared/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "akri-shared"
version = "0.4.2"
version = "0.4.3"
authors = ["<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion test/run-end-to-end.py
Expand Up @@ -31,7 +31,7 @@ def main():
print("Providing Akri Helm chart with CRI args: {}".format(cri_args))
extra_helm_args = shared_test_code.get_extra_helm_args()
print("Providing Akri Helm chart with extra helm args: {}".format(extra_helm_args))
helm_install_command = "helm install akri {} --set agent.full=true --set debugEcho.configuration.enabled=true --set debugEcho.configuration.name={} --set agent.allowDebugEcho=true {} {} --debug ".format(helm_chart_location, shared_test_code.DEBUG_ECHO_NAME, cri_args, extra_helm_args)
helm_install_command = "helm install akri {} --set agent.full=true --set debugEcho.configuration.enabled=true --set debugEcho.configuration.name={} --set debugEcho.configuration.discoveryDetails.descriptions[0]='{}0' --set debugEcho.configuration.discoveryDetails.descriptions[1]='{}1' --set agent.allowDebugEcho=true {} {} --debug ".format(helm_chart_location, shared_test_code.DEBUG_ECHO_NAME, shared_test_code.DEBUG_ECHO_DESCRIPTIONS_PREFIX, shared_test_code.DEBUG_ECHO_DESCRIPTIONS_PREFIX, cri_args, extra_helm_args)
print("Helm command: {}".format(helm_install_command))
os.system(helm_install_command)

Expand Down
16 changes: 14 additions & 2 deletions test/shared_test_code.py
Expand Up @@ -12,6 +12,7 @@
AGENT_LOG_PATH = "/tmp/agent_log.txt"
CONTROLLER_LOG_PATH = "/tmp/controller_log.txt"
DEBUG_ECHO_NAME = "akri-debug-echo-foo"
DEBUG_ECHO_DESCRIPTIONS_PREFIX = "bar"
KUBE_CONFIG_PATH_FILE = "/tmp/kubeconfig_path_to_test.txt"
RUNTIME_COMMAND_FILE = "/tmp/runtime_cmd_to_test.txt"
HELM_CRI_ARGS_FILE = "/tmp/cri_args_to_test.txt"
Expand Down Expand Up @@ -140,12 +141,23 @@ def check_pods_running(v1, pod_label_selector, count):
for pod in pods:
if pod.status.phase != "Running":
all_running = False
break
if all_running: return True
break
if all_running:
if pod_label_selector == BROKER_POD_LABEL_SELECTOR:
return check_broker_pods_env_var(pods)
else:
return True
print("Wrong number of pods [{}] found ... expected {}".format(
pod_label_selector, count))
return False

def check_broker_pods_env_var(pods):
kubectl_cmd = get_kubectl_command()
for pod in pods:
if os.system('sudo {} exec -i {} -- /bin/bash -c "printenv | grep DEBUG_ECHO_DESCRIPTION={} | wc -l | grep -v 0"'.format(kubectl_cmd, pod.metadata.name, DEBUG_ECHO_DESCRIPTIONS_PREFIX)):
print("Could not find a DEBUG_ECHO_DESCRIPTION environment variable in broker Pod {}".format(pod.metadata.name))
return False
return True

def check_svcs_running(v1, svc_label_selector, count):
print("Checking number of svcs [{}] ... expected {}".format(
Expand Down
2 changes: 1 addition & 1 deletion version.txt
@@ -1 +1 @@
0.4.2
0.4.3
2 changes: 1 addition & 1 deletion webhooks/validating/configuration/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "webhook-configuration"
version = "0.4.2"
version = "0.4.3"
authors = ["DazWilkin <daz.wilkin@gmail.com>"]
edition = "2018"

Expand Down