Skip to content

kata-install: skip osbuilder on peer-pods clusters - #2598

Open
gcoon151 wants to merge 1 commit into
openshift:develfrom
gcoon151:kata-install-skip-osbuilder-on-peer-pods
Open

gcoon151 wants to merge 1 commit into
openshift:develfrom
gcoon151:kata-install-skip-osbuilder-on-peer-pods

Conversation

@gcoon151

Copy link
Copy Markdown
Contributor

Problem

When KataConfig.spec.enablePeerPods: true, the install_kata() repair block in osc-kata-install.sh unconditionally calls kata-osbuilder.sh on every pod restart. On peer-pods clusters /var/cache/kata-containers/osbuilder-images/kata.kernel is intentionally never populated — kata-remote uses a remote VM image managed by cloud-api-adaptor, not a local kata initrd. So the missing-file check always fires, kata-osbuilder.sh is called on every restart of every node, and the pods crash-loop permanently.

Downstream, the crash is triggered by strip(1) in rootfs.sh corrupting the kata-agent binary (dynamically linked PIE, not pre-stripped in kata-containers-3.25.0-7.rhaos4.21.el9). But the root cause is that osbuilder should never run on peer-pods workers at all.

Introduced in: fa5d05e (daemonset: use rpm-ostree --apply-live to avoid node reboots)

Confirmed broken: OCP 4.21.18, IBM Cloud VPC HyperShift, OSC 1.13.1, enablePeerPods: true
Impact: Every peer-pods OSC deployment on 1.13.x — IBM Cloud, AWS, Azure — KataConfig never reaches installed state.

Fix

Two minimal changes:

  1. controllers/daemonset_reconcile.go — inject PEER_PODS=true into the kata-install DaemonSet env when EnablePeerPods is set (the controller already branches on this field)

  2. scripts/kata-install/osc-kata-install.sh — guard the osbuilder repair block with ${PEER_PODS:-} so the local initrd build is skipped entirely on peer-pods nodes

Testing

Workaround equivalent to this fix (sentinel kata.kernel file on each node) was validated on the live broken cluster:

  • 3/3 osc-rpm-install pods reached Running, 0 restarts
  • KataConfig.status.readyNodeCount: 3, InProgress: False within 90 seconds
  • openshift-sandboxed-containers-monitor pods (previously CreateContainerError) reached Running

Test matrix:

Scenario Expected
enablePeerPods: false, local kata osbuilder runs normally (no regression)
enablePeerPods: true, peer-pods osbuilder skipped; install completes
enablePeerPods: true, node reboot pod starts cleanly without building initrd

Signed-off-by: Gerald Coon grcoon@us.ibm.com

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@gcoon151, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 51585630-ca79-4f15-8265-735fbcb0c2ce

📥 Commits

Reviewing files that changed from the base of the PR and between bc31eb9 and b9f37f2.

📒 Files selected for processing (1)
  • scripts/kata-install/osc-kata-install.sh
📝 Walkthrough

Walkthrough

The DaemonSet install container now sets PEER_PODS=true when peer pods are enabled. The installation script skips kernel/initrd artifact rebuilding on IBM Cloud workers while preserving the existing rebuild behavior for other cloud providers.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: pmores, vvoronko

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: skipping osbuilder on peer-pods clusters.
Description check ✅ Passed The description directly explains the peer-pods osbuilder fix and matches the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No test files or Ginkgo titles were changed; the patch only edits a controller and a shell script.
Test Structure And Quality ✅ Passed No Ginkgo tests were added or modified; the PR only changes a controller and a shell script, so this test-structure check is not applicable.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the diff only touches a controller and a shell script, so MicroShift test compatibility is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests were added or modified; the PR only changes a controller and a shell script.
Topology-Aware Scheduling Compatibility ✅ Passed PASS: The PR only adds a PEER_PODS env var and a shell guard; it doesn't introduce new anti-affinity, topology spread, nodeSelectors, replica logic, or CP/worker assumptions.
Ote Binary Stdout Contract ✅ Passed PR only changes controller env wiring and an install shell script; no OTE binary process-level stdout writes were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the diff only touches a controller and install script, with no IPv4 assumptions or external connectivity changes.
No-Weak-Crypto ✅ Passed The changes only add PEER_PODS wiring and an IBM Cloud osbuilder guard; no weak crypto, custom crypto, or secret comparisons are present.
Container-Privileges ✅ Passed The PR only adds PEER_PODS env handling and an IBM Cloud guard; no privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation changes were introduced.
No-Sensitive-Data-In-Logs ✅ Passed The PR adds only generic status logs/comments; it does not log secrets, tokens, PII, hostnames, or customer data.
✨ 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.

@openshift-ci
openshift-ci Bot requested review from pmores and vvoronko July 28, 2026 16:48
@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 28, 2026
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown

Hi @gcoon151. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@c3d c3d left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks @gcoon151 and sorry for the breakage.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
controllers/daemonset_reconcile.go (1)

463-471: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the peer-pods environment contract.

Test that EnablePeerPods=true produces exactly PEER_PODS=true, while disabled mode omits it; also cover the shell guard with unset, false, and true values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controllers/daemonset_reconcile.go` around lines 463 - 471, Add regression
tests around the DaemonSet reconciliation logic that builds kataInstallEnv,
verifying EnablePeerPods=true adds exactly PEER_PODS=true and disabled mode
omits the variable. Also test the kata-osbuilder.sh guard behavior for PEER_PODS
unset, false, and true, preserving the expected skip behavior only for the true
value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/kata-install/osc-kata-install.sh`:
- Around line 283-293: Guard the fresh-install postinstall scriptlet flow near
the existing postinstall/posttrans handling so peer-pods do not invoke
kata-osbuilder.sh before reaching the later guard. Preserve execution of
required SELinux and other non-image-building scriptlets, and gate only the
scriptlet or operation that builds the host-kernel-derived VM image; use the
existing PEER_PODS check consistently with the guarded block.

---

Nitpick comments:
In `@controllers/daemonset_reconcile.go`:
- Around line 463-471: Add regression tests around the DaemonSet reconciliation
logic that builds kataInstallEnv, verifying EnablePeerPods=true adds exactly
PEER_PODS=true and disabled mode omits the variable. Also test the
kata-osbuilder.sh guard behavior for PEER_PODS unset, false, and true,
preserving the expected skip behavior only for the true value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: bf3a9ccf-78bd-4cad-8d89-6fa1d1b29a4b

📥 Commits

Reviewing files that changed from the base of the PR and between 8d6c0d3 and 187d1b8.

📒 Files selected for processing (2)
  • controllers/daemonset_reconcile.go
  • scripts/kata-install/osc-kata-install.sh

Comment thread scripts/kata-install/osc-kata-install.sh Outdated
@littlejawa

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 29, 2026
Comment thread controllers/daemonset_reconcile.go Outdated
// Inform the install script whether this is a peer-pods cluster.
// kata-osbuilder.sh (local kata initrd build) must be skipped on peer-pods
// nodes — the initrd is not used there and the build fails on RHCOS workers.
if r.kataConfig.Spec.EnablePeerPods {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@gcoon151 Discussing this with @snir911 he points out that in public cloud installations we want both kata and kata-remote to work together. So you should not key off the kata config enabling peer pods, but on the fact that the current runtime class is remote.

Rescinding my earlier approval based on this.

@c3d c3d added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. and removed ok-to-test Indicates a non-member PR verified by an org member that is safe to test. labels Jul 29, 2026
@littlejawa

littlejawa commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Question : I am not 100% familiar with how this is working.
Does this change affect the operator's code, or only the daemonset image?

I.e: if we merge this, do we need to release the whole operator again, or can we "just" rebuild and push the daemonset image?
We reference the daemonset image by tag in the operator, which means that if it's a daemonset-only change, we may not need to build/release our operator...

@gcoon151
gcoon151 force-pushed the kata-install-skip-osbuilder-on-peer-pods branch from 187d1b8 to bc31eb9 Compare July 29, 2026 15:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/kata-install/osc-kata-install.sh`:
- Around line 312-317: Update the outer condition around the kata-osbuilder
generation block to guard on the PEER_PODS setting rather than CLOUD_PROVIDER.
Ensure non-peer-pods deployments, including IBM Cloud, run the existing
kernel/initrd existence check and kata-osbuilder.sh flow, while peer-pods
deployments skip it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: def837fc-7da2-4b44-b8e7-a98d71800b21

📥 Commits

Reviewing files that changed from the base of the PR and between 187d1b8 and bc31eb9.

📒 Files selected for processing (2)
  • controllers/daemonset_reconcile.go
  • scripts/kata-install/osc-kata-install.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • controllers/daemonset_reconcile.go

Comment on lines +312 to +317
if [[ "${CLOUD_PROVIDER:-}" != "ibmcloud" ]]; then
if ! chroot /host test -e /var/cache/kata-containers/osbuilder-images/kata.kernel; then
echo "kata VM kernel/initrd missing, running kata-osbuilder.sh"
chroot /host mkdir -p /var/cache/kata-containers/osbuilder-images
chroot /host /usr/libexec/kata-containers/osbuilder/kata-osbuilder.sh
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard on PEER_PODS, not CLOUD_PROVIDER.

controllers/daemonset_reconcile.go sets PEER_PODS=true when peer pods are enabled, but this block ignores it. As written, IBM Cloud non-peer-pods skip required local initrd generation, while peer-pods deployments on other providers still run kata-osbuilder.sh.

Proposed fix
-if [[ "${CLOUD_PROVIDER:-}" != "ibmcloud" ]]; then
+if [[ "${PEER_PODS:-}" != "true" ]]; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ "${CLOUD_PROVIDER:-}" != "ibmcloud" ]]; then
if ! chroot /host test -e /var/cache/kata-containers/osbuilder-images/kata.kernel; then
echo "kata VM kernel/initrd missing, running kata-osbuilder.sh"
chroot /host mkdir -p /var/cache/kata-containers/osbuilder-images
chroot /host /usr/libexec/kata-containers/osbuilder/kata-osbuilder.sh
fi
if [[ "${PEER_PODS:-}" != "true" ]]; then
if ! chroot /host test -e /var/cache/kata-containers/osbuilder-images/kata.kernel; then
echo "kata VM kernel/initrd missing, running kata-osbuilder.sh"
chroot /host mkdir -p /var/cache/kata-containers/osbuilder-images
chroot /host /usr/libexec/kata-containers/osbuilder/kata-osbuilder.sh
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/kata-install/osc-kata-install.sh` around lines 312 - 317, Update the
outer condition around the kata-osbuilder generation block to guard on the
PEER_PODS setting rather than CLOUD_PROVIDER. Ensure non-peer-pods deployments,
including IBM Cloud, run the existing kernel/initrd existence check and
kata-osbuilder.sh flow, while peer-pods deployments skip it.

@gcoon151

Copy link
Copy Markdown
Contributor Author

Since only the osc-rpm-install pod was crashing I think you could update just that code inside there and fix this and release that container. I updated the PR to only change behavior on ibmcloud. It's a short term fix. I'll try to PR up the additional longer term ideal fixes (like addressing the strip issue).

Comment thread scripts/kata-install/osc-kata-install.sh
On IBM Cloud, kata-remote (peer-pods) is the only runtime in use.
The local kata VM initrd built by kata-osbuilder.sh is not needed —
kata-agent runs inside a remote peer pod VSI managed by
cloud-api-adaptor, not on the worker node.

The repair block in install_kata() calls kata-osbuilder.sh when
/var/cache/kata-containers/osbuilder-images/kata.kernel is absent.
On IBM Cloud peer-pods workers this path is never populated, so the
check fires on every pod restart, calls kata-osbuilder.sh, and crashes
because strip(1) corrupts the dynamically linked kata-agent binary
shipped in kata-containers-3.25.0-7.rhaos4.20/21.el9. The result is
permanent CrashLoopBackOff and KataConfig stuck InProgress with
readyNodeCount 0.

Guard the repair block with CLOUD_PROVIDER != ibmcloud. This variable
is already injected into the DaemonSet env by the controller; no
controller change is needed. Mixed kata+kata-remote clusters on other
providers are unaffected.

Confirmed broken: OCP 4.20 and 4.21, IBM Cloud VPC HyperShift,
OSC 1.13.1, enablePeerPods: true. Workaround (sentinel kata.kernel
file on each node) unblocked all nodes; readyNodeCount reached 3
within 90 seconds. This fix makes the workaround unnecessary.

Introduced in: fa5d05e daemonset: use rpm-ostree --apply-live to
avoid node reboots

Known limitations and follow-on work:
- This guard is IBM Cloud-specific. AWS and Azure peer-pods deployments
  will hit the same crash if they adopt the DaemonSet install path.
  A provider-agnostic fix requires resolving the two issues below.
- kata-osbuilder-generate.service at boot also calls kata-osbuilder.sh
  and hits the same strip crash on IBM Cloud nodes. The kata RuntimeClass
  exists but its initrd is never built. Fix: ship kata-agent pre-stripped
  in the RPM, or make strip failure non-fatal in rootfs.sh
  (kata-containers/kata-containers).
- The kata and kata-nvidia-gpu RuntimeClasses are created unconditionally
  even on pure peer-pods clusters where they are never used. Long term,
  the controller should not create local kata infrastructure when
  enablePeerPods is true and no local kata runtime is needed.

Signed-off-by: Gerald Coon <grcoon@us.ibm.com>
@gcoon151
gcoon151 force-pushed the kata-install-skip-osbuilder-on-peer-pods branch from bc31eb9 to b9f37f2 Compare July 29, 2026 15:45

@snir911 snir911 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks, I'll create the DS image and test

@c3d
c3d self-requested a review July 30, 2026 07:08
@c3d

c3d commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Looks good to me.

@c3d

c3d commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 30, 2026
@esposem

esposem commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

LGTM but I think at this point long term we should then support two flags in kataconfig, one for kata and one for peer-pods. So far we always supported both in all environments except IBM cloud. We cannot have one disabling the other, they should be two separate switches

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown

@gcoon151: all tests passed!

Full PR test history. Your PR dashboard.

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.

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

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants