Skip to content

Conversation

@camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Oct 29, 2025

Remove overly restrictive directory validation that was blocking legitimate
files like mise.toml and other configuration files. The previous logic
attempted to allow only specific file types but had inverted logic that
blocked most files unnecessarily.

At this stage, we don't have a maintainable way to accurately predict all
possible file conflicts. The only file that definitively conflicts with
scaffolding is the PROJECT file, which kubebuilder generates.

This allows users to run kubebuilder init in directories with legitimate
configuration files (mise.toml, .envrc, .tool-versions, etc.) without
encountering false validation errors.

Closes: #5143

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 29, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86

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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 29, 2025
@camilamacedo86 camilamacedo86 force-pushed the fix-init branch 2 times, most recently from 982e9d3 to 6dcd44b Compare November 2, 2025 11:37
@camilamacedo86 camilamacedo86 changed the title WIP fix: allow any file less those that should be not (fix): (go/v4): Fixed: Init command incorrectly rejects directories with non-conflicting configuration files Nov 2, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 2, 2025
@camilamacedo86 camilamacedo86 changed the title (fix): (go/v4): Fixed: Init command incorrectly rejects directories with non-conflicting configuration files 🐛 (go/v4): Fixed: Init command incorrectly rejects directories with non-conflicting configuration files Nov 2, 2025
@camilamacedo86 camilamacedo86 changed the title 🐛 (go/v4): Fixed: Init command incorrectly rejects directories with non-conflicting configuration files WIP: 🐛 (go/v4): Fixed: Init command incorrectly rejects directories with non-conflicting configuration files Nov 2, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 2, 2025
@camilamacedo86 camilamacedo86 force-pushed the fix-init branch 3 times, most recently from 3449c98 to f7fede3 Compare November 2, 2025 11:55
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 2, 2025
@camilamacedo86 camilamacedo86 changed the title WIP: 🐛 (go/v4): Fixed: Init command incorrectly rejects directories with non-conflicting configuration files WIP: 🐛 (go/v4): (go/v4): Simplify init directory validation to only block PROJECT file Nov 2, 2025
@camilamacedo86 camilamacedo86 changed the title WIP: 🐛 (go/v4): (go/v4): Simplify init directory validation to only block PROJECT file 🐛 (go/v4): Simplify init directory validation to only block PROJECT file Nov 2, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 2, 2025
Remove overly restrictive directory validation that was blocking legitimate
files like mise.toml and other configuration files. The previous logic
attempted to allow only specific file types but had inverted logic that
blocked most files unnecessarily.

At this stage, we don't have a maintainable way to accurately predict all
possible file conflicts. The only file that definitively conflicts with
scaffolding is the PROJECT file, which kubebuilder generates.

This allows users to run kubebuilder init in directories with legitimate
configuration files (mise.toml, .envrc, .tool-versions, etc.) without
encountering false validation errors.
@robinlioret
Copy link

It looks a lot more permissive that what is in place at the moment. Will kubebuilder override existing files ?
I'm thinking about custom GitHub workflow files or git ignore or any common files.

I don't thinks it'll an issue for experienced people since we just have to look a the git diff and reset the files we want to keep as is. But it may be a good idea to add this hack to the documentation, what do you think ?

@camilamacedo86
Copy link
Member Author

/hold

We need think more about.
Maybe warning and make clear that the project has not a empty dir and files can be overwrite OR conflicts be faced

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 2, 2025
@robinlioret
Copy link

I have no idea what amount of work it could represent hut why not adding a step before generating the files ?

Something like:

  1. Queue files to generate in a list
  2. Check if one of them is going to be overwritten
  3. Display a warning with a interactive choice for the user

This way, we get rid of the need for hack documentation while keeping flexibility and automated maintenance of the kubebuilder "reserved" files.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants