Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Implemented the Main SyncLoop and Static Pod Support #70

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

Merged
merged 15 commits into from
Jun 29, 2025

Conversation

Acfboy
Copy link
Contributor

@Acfboy Acfboy commented May 1, 2025

实现了 #71 中的功能。顺便修复了原先创建网络失败时没有正确错误处理(删除创建的容器)的 bug。

实现了:

  • 在命令行选项中新加了一个 daemon 模式,进入 daemon 模式后会每隔 五秒检测 /etc/rk8s/manifests 目录下的 pod 配置文件和当前运行的 pod 情况是否一致,并使运行的 pod 和目录下的配置保持一致。
  • 实现了个事件循环,可以方便地注册事件和处理程序,方便以后加入其他事件。
  • 以 daemon 的方式运行
  • 开放可以查询现在 pod 运行状态的端口
  • 集成测试

Acfboy added 5 commits May 1, 2025 15:41
Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
@genedna genedna requested a review from Copilot May 1, 2025 09:27
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a new daemon mode that continuously monitors a static pod configuration directory and synchronizes pod states using a main sync loop. Key changes include:

  • Adding Clone derivations and refactoring file-based task initialization in task.rs.
  • Introducing a daemon command in main.rs to run the sync loop.
  • Creating new daemon modules (sync_loop and static_pods) to support periodic static pod checking.
  • Updating cli_commands to integrate the new task runner functionality.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
project/rkl/src/task.rs Adds Clone to key structs and refactors task initialization methods.
project/rkl/src/main.rs Introduces the Daemon command and initializes tracing for logging.
project/rkl/src/lib.rs Exposes the new daemon module.
project/rkl/src/daemon/sync_loop.rs Implements the main sync loop and event registration.
project/rkl/src/daemon/static_pods.rs Implements static pod checking and synchronization logic.
project/rkl/src/cli_commands.rs Adjusts pod startup functions to use the new task runner setup.

project/rkl/src/daemon/static_pods.rs Outdated Show resolved Hide resolved
@@ -38,9 +38,13 @@ enum Commands {
pod_name: String,
},
Exec(Box<rkl::commands::exec_cli::Exec>),
// Run as a daemon process.
// For convenient, I won't remove cli part now.
Copy link
Preview

Copilot AI May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Review the inline comment regarding retaining the CLI code for daemon execution; consider clarifying its intent or removing it for production clarity.

Suggested change
// For convenient, I won't remove cli part now.
// The Daemon command is retained in the CLI for development and testing purposes.

Copilot uses AI. Check for mistakes.

Positive FeedbackNegative Feedback
project/rkl/src/daemon/static_pods.rs Outdated Show resolved Hide resolved
Acfboy added 5 commits May 1, 2025 19:05
…undle path

Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
…ove tracing

Signed-off-by: acfboy <acfboyu@outlook.com>
…countering a network creation error during pod creation.

Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
@genedna genedna linked an issue May 7, 2025 that may be closed by this pull request
Acfboy added 3 commits May 7, 2025 22:44
Signed-off-by: acfboy <acfboyu@outlook.com>
Add a new endpoint at /container/{container_id}/json to query the status
of a container. This endpoint is available on port 10250 and returns
a JSON response with the container status information.

Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
Signed-off-by: acfboy <acfboyu@outlook.com>
@genedna genedna enabled auto-merge June 29, 2025 02:12
@genedna genedna added this pull request to the merge queue Jun 29, 2025
Merged via the queue into r2cn-dev:main with commit 29a9879 Jun 29, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[r2cn] rkl 提升为守护进程模式和 Pod 状态检查
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.