Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@elezar
Copy link
Contributor

@elezar elezar commented Jul 14, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds support for reloading runtime configs on SIGHUP. This allows for runtimes to be added dynamically and the default runtimes to be adjusted.

This is useful for cases where runtimes are added / configured after crio is started. One example of this is the NVIDIA Container Runtime which is managed by the NVIDIA GPU Operator. Without this change, adding a runtime to the config requires a node restart which is disruptive.

Which issue(s) this PR fixes:

Fixes #6036

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Allow for a reload to add additional runtimes and change the default runtime

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jul 14, 2022
@openshift-ci openshift-ci bot requested review from klihub and wgahnagl July 14, 2022 09:59
@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 14, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 14, 2022

Hi @elezar. Thanks for your PR.

I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@elezar elezar changed the title Reload runtimes Allow runtimes to be added and default runtime to be modified on config reload Jul 14, 2022
@TomSweeneyRedHat
Copy link
Contributor

The code LGTM for what you're intending to do. However, I'll have to lean on @giuseppe , @haircommander and @saschagrunert on the safeness of swapping out the runtime like this.

@haircommander
Copy link
Member

/ok-to-test

thanks @elezar ! I have a couple of notes, but this is definitely in the right direction

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 14, 2022
@elezar
Copy link
Contributor Author

elezar commented Jul 14, 2022

The code LGTM for what you're intending to do. However, I'll have to lean on @giuseppe , @haircommander and @saschagrunert on the safeness of swapping out the runtime like this.

Note that this only adds new runtimes and does not replace existing ones. The exception is that the name of the default runtime can be changed.

Any insights into caveats here would be appreciated.

@elezar elezar requested a review from haircommander July 15, 2022 12:56
@elezar elezar marked this pull request as ready for review July 15, 2022 12:56
@elezar elezar requested review from mrunalp and runcom as code owners July 15, 2022 12:56
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2022
@openshift-ci openshift-ci bot requested a review from QiWang19 July 15, 2022 12:56
// check we do have at least a runtime
if _, ok := c.Runtimes[c.DefaultRuntime]; !ok {
// Set the default runtime to "runc" if default_runtime is not set
if c.DefaultRuntime == "" {
Copy link
Member

Choose a reason for hiding this comment

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

nit, can we invert this condition and compress the else?

if c.DefaultRuntime != "" { return } ...

Copy link
Member

Choose a reason for hiding this comment

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

I suppose this was already there, but doesn't hurt to update now 🙂

Copy link
Contributor Author

@elezar elezar Jul 18, 2022

Choose a reason for hiding this comment

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

OK. I have updated this in 493eb02

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

The unit test failures may be legit. Can we also add a test to https://github.com/cri-o/cri-o/blob/main/test/reload_config.bats, maybe by injecting a fake runtime?

@elezar elezar marked this pull request as draft July 18, 2022 08:45
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 18, 2022
@elezar
Copy link
Contributor Author

elezar commented Jul 18, 2022

The unit test failures may be legit. Can we also add a test to https://github.com/cri-o/cri-o/blob/main/test/reload_config.bats, maybe by injecting a fake runtime?

OK. I will have a look.

@elezar elezar force-pushed the reload-runtimes branch from 2115034 to 1e3b0b2 Compare July 18, 2022 09:01
@haircommander
Copy link
Member

@mrunalp PTAL, if this gets merged, in which OCP version can we expect this to land?

main is currently feeding into 1.26, so 4.13 would be the target

@saschagrunert PTAL

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Just one tiny error wrapping nit, otherwise LGTM

}

if err := c.ValidateRuntimes(); err != nil {
return fmt.Errorf("unabled to reload runtimes: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("unabled to reload runtimes: %v", err)
return fmt.Errorf("unabled to reload runtimes: %w", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I will rebase and make this change tomorrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated and rebased.

@elezar
Copy link
Contributor Author

elezar commented Sep 15, 2022

/retest-required

@haircommander
Copy link
Member

thanks for your patience as we went through a CI migration and multiple outages

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 16, 2022
@haircommander
Copy link
Member

oh bother
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 16, 2022
@elezar
Copy link
Contributor Author

elezar commented Sep 19, 2022

/retest

@haircommander
Copy link
Member

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 19, 2022
Since we want to validate the default runtime separately when
reloading the runtime config we factor out default runtime
validation into a ValidateDefaultRuntime method.

Signed-off-by: Evan Lezar <[email protected]>
This change cleans up the conditional checks in ValidateDefaultRuntime
for readability.

Signed-off-by: Evan Lezar <[email protected]>
This change includes the update of runtime configs on a config
reload. This is currently limited to:
* Changing the default runtime
* Adding new runtimes

Signed-off-by: Evan Lezar <[email protected]>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2022
@elezar
Copy link
Contributor Author

elezar commented Sep 21, 2022

/retest

@elezar
Copy link
Contributor Author

elezar commented Sep 21, 2022

@haircommander thanks for giving me the heads-up regarding the CI issues. I have rebased the changes off main again. Are CI issues still expected?

@haircommander
Copy link
Member

yeah that one is expected

/override ci/prow/ci-e2e-conmonrs
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 21, 2022

@haircommander: Overrode contexts on behalf of haircommander: ci/prow/ci-e2e-conmonrs

Details

In response to this:

yeah that one is expected

/override ci/prow/ci-e2e-conmonrs
/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 21, 2022

@elezar: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/openshift-jenkins/integration_fedora ae54757 link true /test integration_fedora
ci/openshift-jenkins/integration_crun ae54757 link true /test integration_crun
ci/openshift-jenkins/integration_crun_cgroupv2 ae54757 link false /test integration_cgroupv2
ci/openshift-jenkins/integration_rhel ae54757 link true /test integration_rhel

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@haircommander
Copy link
Member

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support reload of cri-o config to add runtimes

7 participants