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

Add rust implementation of container Python script #38

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

saiarcot895
Copy link

Add a rust implementation of the container script in the SONiC image. This script is primarily responsible for starting, waiting on, and stopping containers.

In the case of local containers, this script is basically a wrapper around docker start, docker wait, and docker stop. In the case of Kubernetes containers, there's some additional logic/checks on whether the container should be started or not; this is not fully implemented.

Basic testing has been done with local containers (the most common use case).

This handles most use cases for local containers. For Kubernetes
containers, there's very limited handling in the start function, and
pretty much nothing else.

Signed-off-by: Saikrishna Arcot <[email protected]>
Signed-off-by: Saikrishna Arcot <[email protected]>
Signed-off-by: Saikrishna Arcot <[email protected]>
Signed-off-by: Saikrishna Arcot <[email protected]>
@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Saikrishna Arcot <[email protected]>
@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@r12f
Copy link
Collaborator

r12f commented Jan 20, 2025

Hi Sai, looks like it is hitting CI errors. Do you mind to help take a look?

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Saikrishna Arcot <[email protected]>
Signed-off-by: Saikrishna Arcot <[email protected]>
Signed-off-by: Saikrishna Arcot <[email protected]>
@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Saikrishna Arcot <[email protected]>
@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

[dependencies]
bollard = { version = "0.17.1", features = ["chrono"] }
chrono = "0.4.38"
enumset = "1.1.5"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will be better to move these dependencies to workspace root.

bollard = { version = "0.17.1", features = ["chrono"] }
chrono = "0.4.38"
enumset = "1.1.5"
futures-util = "0.3.30"
Copy link
Collaborator

Choose a reason for hiding this comment

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

0.3 will be good enough. The last minor version can be ignored, since we have the lock file and will help with upgrade.


// DB field names
//const FEATURE_TABLE: &str = "FEATURE";
const SET_OWNER: &str = "set_owner";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe better to add a prefix to specify these are db fields.


fn set_label(db_connections: &DbConnections, _feature: &str, _create: bool) {
if db_connections.remote_ctr_enabled {
todo!();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this part missing?

}

let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like we can use async_main to simplify the code. Is this delayed block_on intentional?

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

3 participants