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

runtime-rs: Support event mechanism #7881

Closed
justxuewei opened this issue Sep 11, 2023 · 0 comments · Fixed by #8780
Closed

runtime-rs: Support event mechanism #7881

justxuewei opened this issue Sep 11, 2023 · 0 comments · Fixed by #8780

Comments

@justxuewei
Copy link
Member

justxuewei commented Sep 11, 2023

The Runtime-rs doesn't support event machanism so far. The events include OOM event, task exit event, etc. See:

func getTopic(e interface{}) string {
switch e.(type) {
case *eventstypes.TaskCreate:
return cdruntime.TaskCreateEventTopic
case *eventstypes.TaskStart:
return cdruntime.TaskStartEventTopic
case *eventstypes.TaskOOM:
return cdruntime.TaskOOMEventTopic
case *eventstypes.TaskExit:
return cdruntime.TaskExitEventTopic
case *eventstypes.TaskDelete:
return cdruntime.TaskDeleteEventTopic
case *eventstypes.TaskExecAdded:
return cdruntime.TaskExecAddedEventTopic
case *eventstypes.TaskExecStarted:
return cdruntime.TaskExecStartedEventTopic
case *eventstypes.TaskPaused:
return cdruntime.TaskPausedEventTopic
case *eventstypes.TaskResumed:
return cdruntime.TaskResumedEventTopic
case *eventstypes.TaskCheckpointed:
return cdruntime.TaskCheckpointedEventTopic
default:
shimLog.WithField("event-type", e).Warn("no topic for event type")
}
return cdruntime.TaskUnknownTopic
}

@justxuewei justxuewei changed the title runtime-rs: Support event machanism runtime-rs: Support event mechanism Jan 6, 2024
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 6, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
@katacontainersbot katacontainersbot moved this from To do to In progress in Issue backlog Jan 6, 2024
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 6, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 6, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 6, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 6, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 10, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 11, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 11, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
justxuewei added a commit to justxuewei/kata-containers that referenced this issue Jan 11, 2024
It is a little bit heavy for the runtime-rs to forwards events via
containerd CLI, contrast to the ttrpc way. Plus, for runtimes that haven't
this mechanism, e.g. CRI-O, we can't get those events anywhere.

This patch introduces two types of forwarders:

- `ContainerdForwarder`: Acquire ttrpc address from environment variables
  and forward events via ttrpc connection.
- `LogForwarder`: Write event info into logs.

Fixes: kata-containers#7881

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Issue backlog
  
In progress
Development

Successfully merging a pull request may close this issue.

1 participant