Skip to content

fix: allow crictl config to create a missing explicit file#2144

Open
immanuwell wants to merge 1 commit into
kubernetes-sigs:masterfrom
immanuwell:fix/config-missing-explicit-file
Open

fix: allow crictl config to create a missing explicit file#2144
immanuwell wants to merge 1 commit into
kubernetes-sigs:masterfrom
immanuwell:fix/config-missing-explicit-file

Conversation

@immanuwell

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fixes a small but real crictl config paper cut.

If you pass a custom --config path and the file is missing, config --set dies in startup before the config command can create the file. That makes the bootstrap flow kinda busted.

This patch lets config --set and the positional config key value path create the missing file, and keeps config --get and config --list read-only.

Repro:

tmpdir=$(mktemp -d)
crictl --config "$tmpdir/crictl.yaml" config --set debug=true

Before this PR, that fails with a get server config error.

Which issue(s) this PR fixes:

Fixes #2143

Special notes for your reviewer:

Checked with the built crictl binary and the existing crictl: config e2e suite. This bug is easy to hit in normal local CLI use, no weird limits or edge conditions needed.

Does this PR introduce a user-facing change?

`crictl config --set` and `crictl config <key> <value>` now create a missing explicit `--config` file instead of failing during startup.

@kubernetes-prow kubernetes-prow Bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 8, 2026
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 8, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @immanuwell!

It looks like this is your first PR to kubernetes-sigs/cri-tools 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cri-tools has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: immanuwell
Once this PR has been reviewed and has the lgtm label, please assign derekwaynecarr for approval. For more information see the Code Review Process.

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

Details 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

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 8, 2026
Comment thread cmd/crictl/main.go
Comment thread cmd/crictl/main.go Outdated
@SergeyKanzhelev

Copy link
Copy Markdown
Member

Fixes a small but real crictl config paper cut.

So the scenario is downloading crictl, and use config set commands to set all properties? I wonder if we need a new command that creates an empty config file instead. I think the crictl config were supposed to do it. Is it a regression? I wonder if I induced it when introduced global span for tracing. Would you be willing to see if this is a regression?

@immanuwell
immanuwell force-pushed the fix/config-missing-explicit-file branch from dff3b53 to 9d13c99 Compare July 11, 2026 13:15
@immanuwell

Copy link
Copy Markdown
Author

@SergeyKanzhelev addressed your suggestions, please take a look

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crictl config fails to create a missing explicit config file

2 participants