-
Notifications
You must be signed in to change notification settings - Fork 150
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
Refactor agent followup #700
Changes from all commits
4864b89
979ccc3
ba93e5d
d8e50ad
8c43131
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "agent" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["Kate Goldenring <[email protected]>", "<[email protected]>"] | ||
edition = "2021" | ||
|
@@ -35,6 +35,7 @@ serde = "1.0.104" | |
serde_derive = "1.0.104" | ||
serde_json = "1.0.45" | ||
serde_yaml = { version = "0.8.11", optional = true } | ||
simple-mermaid = "0.1" # used for docs | ||
thiserror = "1.0.50" | ||
tokio = { version = "1.0", features = ["rt-multi-thread", "time", "fs", "macros", "net"] } | ||
tokio-stream = { version = "0.1", features = ["net", "sync"] } | ||
|
@@ -65,4 +66,4 @@ default = [] | |
onvif-feat = [ "akri-onvif"] | ||
opcua-feat = ["akri-opcua"] | ||
udev-feat = ["akri-udev"] | ||
agent-full = ["serde_yaml", "akri-debug-echo"] | ||
agent-full = ["serde_yaml", "akri-debug-echo"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
sequenceDiagram | ||
Discovery Handler ->> DiscoveryHandlerRequest: send discovered devices | ||
DiscoveryHandlerRequest ->> DiscoveryHandlerRequest: Updates aggregated list of discovered devices | ||
DiscoveryHandlerRequest -) Device Manager: Notifies and updates list of discovered devices | ||
DiscoveryHandlerRequest -) Configuration Controller: Requests reconciliation of Configuration linked to Request | ||
note over Configuration Controller: The following is Configuration Controller behavior | ||
activate Configuration Controller | ||
Configuration Controller ->> Configuration Controller: Reconcile Configuration | ||
Configuration Controller ->> DiscoveryHandlerRegistry: get_request() | ||
DiscoveryHandlerRegistry ->> Configuration Controller: | ||
Configuration Controller ->> DiscoveryHandlerRequest: get_instances() | ||
DiscoveryHandlerRequest ->> Configuration Controller: Returns list of discovered devices as bare Instances | ||
Configuration Controller ->> Kubernetes API: Apply Instances | ||
deactivate Configuration Controller |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
sequenceDiagram | ||
Configuration Controller -) DiscoveryHandlerRegistry: new_request() | ||
alt a Handler exists for the Request | ||
DiscoveryHandlerRegistry ->> DiscoveryHandlerRequest: Creates with filtered list of endpoints | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "endpoints" is a little overloaded here. Is this DH endpoints to device filtering that is passed to the DH as discovery properties? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked at the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, there is a bit of type passing here, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we reword this, then, to clarify what filtered means. For example "Creates a discover connection with each DH for a Configuration" |
||
DiscoveryHandlerRegistry ->> DiscoveryHandlerRegistry: Add request to tracked request list | ||
loop over DiscoveryHandlerEndpoints with this name | ||
DiscoveryHandlerRequest ->>+ Kubernetes API: Solve discovery properties | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same point as my previous comment about reqording this step |
||
Kubernetes API ->>- DiscoveryHandlerRequest: | ||
DiscoveryHandlerRequest ->>+ Discovery Handler: query discovery handler | ||
loop | ||
Discovery Handler ->> DiscoveryHandlerRequest: send discovered devices | ||
note over DiscoveryHandlerRequest,DiscoveryHandlerRegistry: See other diagram for what happens here | ||
end | ||
deactivate Discovery Handler | ||
end | ||
else | ||
DiscoveryHandlerRegistry -x Configuration Controller: DiscoveryError::NoHandler | ||
end |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be good to clarify that this the the flow for a single Akri Config / DiscoveryHandlerRequest |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,20 @@ | ||||||
sequenceDiagram | ||||||
Discovery Handler ->> Registration endpoint: Registers | ||||||
Registration endpoint->> DiscoveryHandlerRegistry: register_endpoint() | ||||||
DiscoveryHandlerRegistry ->> DiscoveryHandlerRegistry: Add endpoint to registered handlers list | ||||||
DiscoveryHandlerRegistry ->> DiscoveryHandlerRequest: notify all DiscoveryHandlerRequest | ||||||
alt Discovery Handler name is the same as in Request | ||||||
DiscoveryHandlerRequest ->>+ Kubernetes API: Solve discovery properties | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could use some elaboration. Is this the equivalent of "[For each Akri Config for the DH] Get discovery handler properties (filters) from Akri Configuration"?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here solving discovery properties is looking up for config maps and secrets that are in the |
||||||
Kubernetes API ->>- DiscoveryHandlerRequest: | ||||||
DiscoveryHandlerRequest ->>+ Discovery Handler: query discovery handler | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
loop | ||||||
Discovery Handler ->> DiscoveryHandlerRequest: send discovered devices | ||||||
note over DiscoveryHandlerRequest,DiscoveryHandlerRegistry: See other diagram for what happens here | ||||||
end | ||||||
deactivate Discovery Handler | ||||||
end | ||||||
break on Discovery Handler connection error | ||||||
Registration endpoint -x DiscoveryHandlerRegistry: close endpoint | ||||||
DiscoveryHandlerRegistry ->> DiscoveryHandlerRegistry: Remove endpoint from registered handlers list | ||||||
note over DiscoveryHandlerRequest,Discovery Handler: The DiscoveryHandlerRequest request will handle termination by itself | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it means that we do not propagate the fact the discovery handler is not reachable as every active request will notice that by themselves and handle this. |
||||||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "controller" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["<[email protected]>", "<[email protected]>"] | ||
edition = "2021" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,12 +67,6 @@ spec: | |
- name: DEBUG_ECHO_INSTANCES_SHARED | ||
value: {{ .Values.debugEcho.configuration.shared | quote }} | ||
{{- end }} | ||
- name: HOST_CRICTL_PATH | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woohooo 🎉 |
||
value: /usr/local/bin/crictl | ||
- name: HOST_RUNTIME_ENDPOINT | ||
value: unix:///host/run/containerd/containerd.sock | ||
- name: HOST_IMAGE_ENDPOINT | ||
value: unix:///host/run/containerd/containerd.sock | ||
- name: AGENT_NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
|
@@ -86,8 +80,6 @@ spec: | |
mountPath: /var/lib/kubelet/device-plugins | ||
- name: pod-resources | ||
mountPath: /var/lib/kubelet/pod-resources | ||
- name: var-run-dockershim | ||
mountPath: /host/run/containerd/containerd.sock | ||
{{- if .Values.agent.host.udev }} | ||
- name: devices | ||
mountPath: /run/udev | ||
|
@@ -111,23 +103,6 @@ spec: | |
- name: pod-resources | ||
hostPath: | ||
path: "{{ .Values.agent.host.kubeletPodResources }}" | ||
- name: var-run-dockershim | ||
hostPath: | ||
{{- if ne "" .Values.agent.host.containerRuntimeSocket }} | ||
path: {{.Values.agent.host.containerRuntimeSocket }} | ||
{{- else if eq .Values.kubernetesDistro "microk8s" }} | ||
path: "/var/snap/microk8s/common/run/containerd.sock" | ||
{{- else if eq .Values.kubernetesDistro "k3s" }} | ||
path: "/run/k3s/containerd/containerd.sock" | ||
{{- else if eq .Values.kubernetesDistro "k8s" }} | ||
path: "/run/containerd/containerd.sock" | ||
{{- else }} | ||
# Please set container runtime socket by either selecting the appropriate K8s distro `kubernetesDistro=<k8s|k3s|microk8s>` | ||
# or setting `agent.host.containerRuntimeSocket=/container/runtime.sock`. | ||
# See https://docs.akri.sh/user-guide/cluster-setup for more information. | ||
# Using K8s default "/run/containerd/containerd.sock" for now. | ||
path: "/run/containerd/containerd.sock" | ||
{{- end }} | ||
{{- if .Values.agent.host.udev }} | ||
- name: devices | ||
hostPath: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "debug-echo-discovery-handler" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["Kate Goldenring <[email protected]>"] | ||
edition = "2021" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "onvif-discovery-handler" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["Kate Goldenring <[email protected]>"] | ||
edition = "2021" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "opcua-discovery-handler" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["Kate Goldenring <[email protected]>"] | ||
edition = "2021" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "udev-discovery-handler" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["Kate Goldenring <[email protected]>"] | ||
edition = "2021" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "akri-debug-echo" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["Kate Goldenring <[email protected]>"] | ||
edition = "2021" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "akri-onvif" | ||
version = "0.13.1" | ||
version = "0.13.2" | ||
license = "Apache-2.0" | ||
authors = ["Kate Goldenring <[email protected]>"] | ||
edition = "2021" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does Reconcile Configuration mean? Is this where we are making sure that the appropriate set of Akri Instances exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just what the configuration controller do, so ensuring there is a request for the configuration and that the appropriate set of Instances exists.
At first I didn't want to put it in that diagram as it is outside of the discovery handler manager, but did it in the end to highlight the
get_request()
andget_instances()
use.