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

Topic/docs completions config updates for runtime pull image #8110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fidencio
Copy link
Contributor

@fidencio fidencio commented May 2, 2024

What type of PR is this?

What this PR does / why we need it:

The runtime_pull_image configuration option was introduced as part of fff6493, but missed documentation, completion, and adding it as part of the configuration template.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

Add missing information about the `runtime_pull_image` to the documentation, completion, and default crio configuration.

@fidencio fidencio requested a review from mrunalp as a code owner May 2, 2024 11:00
@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels May 2, 2024
Copy link
Contributor

openshift-ci bot commented May 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fidencio

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2024
@fidencio
Copy link
Contributor Author

fidencio commented May 2, 2024

/cc @littlejawa

@openshift-ci openshift-ci bot requested a review from littlejawa May 2, 2024 11:02
Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 49.67%. Comparing base (de1e328) to head (e25ee07).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8110   +/-   ##
=======================================
  Coverage   49.67%   49.67%           
=======================================
  Files         153      153           
  Lines       16826    16829    +3     
=======================================
+ Hits         8358     8360    +2     
- Misses       7424     7426    +2     
+ Partials     1044     1043    -1     

@littlejawa
Copy link
Contributor

Hey @fidencio,
Thanks for filling a hole here :-)

Now I have a concern: this is not just documenting "runtime_pull_image" and adding it to the template config, it also adds it to the "--runtimes" parameter, which I didn't do in the original PR.

The parsing for it is not done, so if you do it, you need to change the following to actually parse the new parameter within the string :

if ctx.IsSet("runtimes") {
runtimes := StringSliceTrySplit(ctx, "runtimes")
for _, r := range runtimes {
fields := strings.Split(r, ":")
runtimeType := libconfig.DefaultRuntimeType
privilegedWithoutHostDevices := false
runtimeConfigPath := ""
var (
containerMinMemory string
err error
)
switch len(fields) {
case 7:
containerMinMemory = fields[6]
_, err = units.RAMInBytes(containerMinMemory)
if err != nil {
return fmt.Errorf("invalid value %q for --runtimes:container_min_memory: %w", containerMinMemory, err)
}
fallthrough
case 6:
runtimeConfigPath = fields[5]
fallthrough
case 5:
if fields[4] == "true" {
privilegedWithoutHostDevices = true
}
fallthrough
case 4:
runtimeType = fields[3]
fallthrough
case 3:
config.Runtimes[fields[0]] = &libconfig.RuntimeHandler{
RuntimePath: fields[1],
RuntimeRoot: fields[2],
RuntimeType: runtimeType,
PrivilegedWithoutHostDevices: privilegedWithoutHostDevices,
RuntimeConfigPath: runtimeConfigPath,
ContainerMinMemory: containerMinMemory,
}
default:
return fmt.Errorf("invalid format for --runtimes: %q", r)
}
}
}

And then also

Usage: "OCI runtimes, format is 'runtime_name:runtime_path:runtime_root:runtime_type:privileged_without_host_devices:runtime_config_path:container_min_memory'.",
to keep things consistant.

And then the crio CI scripts using it should be adapted in the same PR, otherwise some of them might (silently) fail.
See:

  • CONTAINER_RUNTIMES: "containerd-shim-kata-v2:/opt/kata/bin/containerd-shim-kata-v2:/run/vc:vm:true:/opt/kata/share/defaults/kata-containers/configuration.toml"
  • export CONTAINER_RUNTIMES=${CONTAINER_RUNTIMES:-$CONTAINER_DEFAULT_RUNTIME:$RUNTIME_BINARY_PATH:$RUNTIME_ROOT:$RUNTIME_TYPE:$PRIVILEGED_WITHOUT_HOST_DEVICES:$RUNTIME_CONFIG_PATH}

Now I have another concern: changing the "--runtimes" string the way you do, the order of parameters is modified. It means that all users of this parameter will see their configuration broken next time they update crio.
Or worse: it will silently work with wrong parameters.
If we add something in this string, I'm afraid it needs to be at the end of it, for backward compatibility...

@@ -143,7 +143,7 @@ complete -c crio -n '__fish_crio_no_subcommand' -f -l read-only -d 'Setup all un
complete -c crio -n '__fish_crio_no_subcommand' -f -l registry -r -d 'Registry to be prepended when pulling unqualified images. Can be specified multiple times.'
complete -c crio -n '__fish_crio_no_subcommand' -l root -s r -r -d 'The CRI-O root directory.'
complete -c crio -n '__fish_crio_no_subcommand' -l runroot -r -d 'The CRI-O state directory.'
complete -c crio -n '__fish_crio_no_subcommand' -f -l runtimes -r -d 'OCI runtimes, format is \'runtime_name:runtime_path:runtime_root:runtime_type:privileged_without_host_devices:runtime_config_path:container_min_memory\'.'
complete -c crio -n '__fish_crio_no_subcommand' -f -l runtimes -r -d 'OCI runtimes, format is \'runtime_name:runtime_path:runtime_root:runtime_type:runtime_pull_image:privileged_without_host_devices:runtime_config_path:container_min_memory\'.'
Copy link
Member

Choose a reason for hiding this comment

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

it doesn't look like this was wired into the cli flag so I don't think this is accurate

This option has been added as part of fff6493, but completions and
docs were not updated at that time.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
The option was added as part of fff6493, but never added to the
template, leading to `crio config default` missing this option when
merging config files that do have it set.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
@fidencio fidencio force-pushed the topic/docs-completions-config-updates-for-runtime_pull_image branch from d8ae774 to e25ee07 Compare May 2, 2024 18:01
Copy link
Contributor

openshift-ci bot commented May 2, 2024

@fidencio: 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/prow/ci-fedora-integration e25ee07 link true /test ci-fedora-integration
ci/prow/ci-cgroupv2-integration e25ee07 link true /test ci-cgroupv2-integration
ci/prow/ci-fedora-kata e25ee07 link true /test ci-fedora-kata
ci/prow/e2e-gcp-ovn e25ee07 link true /test e2e-gcp-ovn

Full PR test history. Your PR dashboard.

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.

@@ -88,6 +88,7 @@ kata_int_test_env:
PRIVILEGED_WITHOUT_HOST_DEVICES: true
RUNTIME_CONFIG_PATH: "/opt/kata/share/defaults/kata-containers/configuration.toml"
PATH: "/opt/kata/bin:{{ ansible_env.PATH }}"
RUNTIME_PULL_IMAGE: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I think we should keep it "false" here (or not set it at all as it is the default)
Our testing is done on kata alone - not peer-pods nor CoCo. We don't want to enable that feature systematically.

@littlejawa
Copy link
Contributor

There is still one occurrence of "usage" string not updated :

Usage: "OCI runtimes, format is 'runtime_name:runtime_path:runtime_root:runtime_type:privileged_without_host_devices:runtime_config_path:container_min_memory'.",

Otherwise lgtm

Thanks!

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. 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.

None yet

3 participants