Skip to content

[release-4.19] Avoid using lb-ext.kubeconfig for seedgen cleanup#6881

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift-kni:release-4.19from
omertuc:noext-4.19
May 26, 2026
Merged

[release-4.19] Avoid using lb-ext.kubeconfig for seedgen cleanup#6881
openshift-merge-bot[bot] merged 1 commit into
openshift-kni:release-4.19from
omertuc:noext-4.19

Conversation

@omertuc
Copy link
Copy Markdown
Collaborator

@omertuc omertuc commented May 26, 2026

This is a manual cherry-pick of #6008, with an additional RBAC fix: add pod delete permission to the seedgen controller's kubebuilder RBAC annotation.

On main, switching from oc delete pod (authenticated via lb-ext.kubeconfig) to r.Client.Delete() (authenticated via the controller's service account) worked because an unrelated commit d756889 ("MGMT-21789: Add new feature for deleting pods stuck in ImagePullBackOff error") had already added the pod delete verb to the ClusterRole. That commit is not in release-4.19, so on a clean cherry-pick the service account lacked the permission and pod cleanup during seed generation will fail with a forbidden error:

2026-05-15T15:06:58.207369896Z 2026-05-15T15:06:58Z	ERROR	controllers.SeedGenerator	Seed generation failed	{"error": "failed to cleanup Succeeded pods: failed to delete pod openshift-kube-scheduler/installer-5-retry-1-seed-sno-node: pods \"installer-5-retry-1-seed-sno-node\" is forbidden: User \"system:serviceaccount:openshift-lifecycle-agent:lifecycle-agent-controller-manager\" cannot delete resource \"pods\" in API group \"\" in the namespace \"openshift-kube-scheduler\""}

The original kubebuilder annotation was never updated to include delete when the code was changed to use the client — it was simply masked on main by the MGMT-21789 RBAC addition. This commit fixes the annotation at the source so the permission is explicitly tied to the code that needs it.

This is a *manual* cherry-pick of openshift-kni#6008, with an additional RBAC fix:
add pod delete permission to the seedgen controller's kubebuilder RBAC
annotation.

On main, switching from `oc delete pod` (authenticated via
lb-ext.kubeconfig) to `r.Client.Delete()` (authenticated via the
controller's service account) worked because an unrelated commit
d756889 ("MGMT-21789: Add new feature for deleting pods stuck in
ImagePullBackOff error") had already added the pod delete verb to the
ClusterRole. That commit is not in release-4.19, so on a clean
cherry-pick the service account lacked the permission and pod cleanup
during seed generation will fail with a forbidden error:

```
2026-05-15T15:06:58.207369896Z 2026-05-15T15:06:58Z	ERROR	controllers.SeedGenerator	Seed generation failed	{"error": "failed to cleanup Succeeded pods: failed to delete pod openshift-kube-scheduler/installer-5-retry-1-seed-sno-node: pods \"installer-5-retry-1-seed-sno-node\" is forbidden: User \"system:serviceaccount:openshift-lifecycle-agent:lifecycle-agent-controller-manager\" cannot delete resource \"pods\" in API group \"\" in the namespace \"openshift-kube-scheduler\""}
```

The original kubebuilder annotation was never updated to include delete
when the code was changed to use the client — it was simply masked on
main by the MGMT-21789 RBAC addition. This commit fixes the annotation
at the source so the permission is explicitly tied to the code that
needs it.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 0f0feff8-f055-4451-ba79-1016bc441736

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from browsell and fontivan May 26, 2026 14:54
@omertuc omertuc changed the title Avoid using lb-ext.kubeconfig for seedgen cleanup [release-4.19] Avoid using lb-ext.kubeconfig for seedgen cleanup May 26, 2026
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 26, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 26, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jc-rh

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit a7d726c into openshift-kni:release-4.19 May 26, 2026
12 of 14 checks passed
@jc-rh
Copy link
Copy Markdown
Member

jc-rh commented May 26, 2026

/cherrypick release-4.18 release-4.17 release-4.16

@openshift-cherrypick-robot
Copy link
Copy Markdown

@jc-rh: new pull request created: #6884

Details

In response to this:

/cherrypick release-4.18 release-4.17 release-4.16

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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants