Skip to content

Conversation

@camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Jan 4, 2026

Add comprehensive delete functionality to remove APIs and webhooks from projects. Users can now clean up scaffolded resources with automatic code removal, proper validation, and complete state restoration.

What's New

Users can now delete scaffolded APIs and webhooks from their projects:

# Delete APIs
kubebuilder delete api --group crew --version v1 --kind Captain

# Delete webhooks (all types or specific types)
kubebuilder delete webhook --group crew --version v1 --kind Captain
kubebuilder delete webhook --group crew --version v1 --kind Captain --defaulting

# Delete optional plugin features
kubebuilder delete --plugins=helm/v2-alpha
kubebuilder delete --plugins=grafana/v1-alpha
kubebuilder delete --plugins=autoupdate/v1-alpha

Key Features

Automatic Code Removal

Delete commands automatically remove marker-inserted code from cmd/main.go and test files:

  • Removes API/webhook imports
  • Removes AddToScheme calls
  • Removes controller/webhook setup blocks
  • Updates PROJECT file

Graceful Error Handling

If automatic removal fails:

  • Shows clear warnings (doesn't fail the operation)
  • Provides manual cleanup instructions
  • References code fragment constants for easy lookup

Closes

#907

@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 Jan 4, 2026
@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

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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 4, 2026
@camilamacedo86 camilamacedo86 force-pushed the add-delete-api branch 20 times, most recently from f2fca86 to ef8842f Compare January 25, 2026 10:52
@camilamacedo86 camilamacedo86 changed the title WIP ✨ Add delete api and delete webhook commands ✨ Add delete api and delete webhook commands Jan 25, 2026
@camilamacedo86
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 3, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 51 out of 52 changed files in this pull request and generated 10 comments.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 5, 2026
@camilamacedo86 camilamacedo86 force-pushed the add-delete-api branch 2 times, most recently from fe43e33 to e69d8d6 Compare February 5, 2026 11:21
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 5, 2026
@camilamacedo86 camilamacedo86 force-pushed the add-delete-api branch 2 times, most recently from a703406 to 70004af Compare February 5, 2026 11:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 51 out of 52 changed files in this pull request and generated 5 comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 54 out of 55 changed files in this pull request and generated 4 comments.

@camilamacedo86 camilamacedo86 changed the title ✨ Added Delete API and implemented a unified interface across all commands and plugin options WIP ✨ Added Delete API and implemented a unified interface across all commands and plugin options Feb 5, 2026
@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 Feb 5, 2026
Add delete functionality to remove APIs and webhooks from projects.
Users can now clean up scaffolded resources.

Generated-by: Cursor/Claude
@k8s-ci-robot
Copy link
Contributor

@camilamacedo86: 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
pull-kubebuilder-test 65d1a67 link true /test pull-kubebuilder-test
pull-kubebuilder-e2e-k8s-1-33-0 65d1a67 link true /test pull-kubebuilder-e2e-k8s-1-33-0

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 9, 2026
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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-sigs/prow repository.

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/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants