← Back to Pull requests

MULTIARCH-6270: enoexec-event-daemon DaemonSet fails to start in kustomize deployments due to ServiceAccount pull secret race condition #521

Merged
AnnaZivkovic merged 2 files (208 lines) on Aug 11, 2026 17:24 UTC
View on GitHub
AnnaZivkovic AnnaZivkovic commented on Jul 30, 2026 23:18 UTC
Author

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

Bug Fixes
Improved ENoExecEvent plugin deployment reliability by waiting for required ServiceAccount image pull secrets before creating its DaemonSet.
* Automatically retries reconciliation after prerequisites become available, ensuring the DaemonSet is created successfully.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 208 lines (+205 / -3) across 2 files Reviewer: AnnaZivkovic Review duration: 16926m
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.79) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.79 · 208 lines diff across 2 files
0.79
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.96 · 5 substantive comment(s)
0.96
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
85%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.320
Self Review self_review
0.140
Sensitive Paths sensitive_paths
0.079
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
29 items
coderabbitai[bot] coderabbitai[bot] commented on Jul 30, 2026 23:19 UTC
Bot

<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: review paused by coderabbit.ai -->

[!NOTE]

## Reviews paused

> It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

> Use the following commands to manage reviews:

- @coderabbitai resume to resume automatic reviews.

- @coderabbitai review to trigger a single review.

> Use the checkboxes below for quick actions:

- [ ] <!-- {"checkboxId": "7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews

- [ ] <!-- {"checkboxId": "e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review

<!-- end of auto-generated comment: review paused by coderabbit.ai -->
<!-- walkthrough_start -->

Walkthrough

The controller delays ENoExecEvent DaemonSet creation until its ServiceAccount has image pull secrets. It applies other resources and requeues reconciliation while waiting. Integration coverage validates later DaemonSet creation.

Changes

ENoExecEvent deferred provisioning

|Layer / File(s)|Summary|
|---|---|
|Controller deferral and requeue <br> internal/controller/operator/clusterpodplacementconfig_controller.go|The builder checks the ServiceAccount and its image pull secrets. It omits the ENoExecEvent DaemonSet while prerequisites are unavailable, propagates unexpected lookup errors, applies other resources, updates status, and triggers requeue.|
|Deferred provisioning integration validation <br> internal/controller/operator/clusterpodplacementconfig_controller_test.go|The integration test verifies prerequisite creation, delayed DaemonSet creation, simulated image-pull-secret provisioning, and cleanup. validateReconcile invokes the provisioning helper for ENoExecEvent resources.|

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Reconciler
  participant KubernetesAPI
  participant ServiceAccount
  participant DaemonSet
  Reconciler->>KubernetesAPI: Apply ENoExecEvent prerequisite resources
  Reconciler->>ServiceAccount: Check image pull secrets
  ServiceAccount-->>Reconciler: Report missing image pull secrets
  Reconciler->>KubernetesAPI: Update status and trigger requeue
  ServiceAccount->>KubernetesAPI: Receive image pull secret
  Reconciler->>DaemonSet: Create ENoExecEvent DaemonSet

Suggested reviewers: prashanth684, aleskandro

<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->

<details>
<summary>🚥 Pre-merge checks | ✅ 15</summary>

<details>
<summary>✅ Passed checks (15 passed)</summary>

| Check name | Status | Explanation |
| :----------------------------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| 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 | The added Ginkgo Context and It titles are static descriptive strings; they contain no generated names, timestamps, namespaces, node names, IPs, UUIDs, or interpolation. |
| Test Structure And Quality | ✅ Passed | The added Ginkgo test uses BeforeEach/AfterEach cleanup, bounded waits (200ms Consistently and 5s suite default), and diagnostic assertion messages consistent with repository patterns. |
| Microshift Test Compatibility | ✅ Passed | The added Ginkgo test runs in the envtest integration suite and uses only Kubernetes core/apps/RBAC APIs plus the operator CRD; it has no unavailable OpenShift API or MicroShift-unsupported assumpt... |
| Single Node Openshift (Sno) Test Compatibility | ✅ Passed | The new Ginkgo integration test uses envtest and checks ServiceAccount, DaemonSet, and deployment resources only; it has no multi-node, topology, affinity, failover, or rescheduling assumptions. |
| Topology-Aware Scheduling Compatibility | ✅ Passed | The PR only defers ENoExec DaemonSet creation based on ServiceAccount imagePullSecrets; it adds no affinity, spread, node selectors, tolerations, replica, or PDB constraints. |
| Ote Binary Stdout Contract | ✅ Passed | The PR adds no process-level stdout writes; new logs run in reconciliation, and test output occurs in BeforeEach/It helpers, which the check excludes. |
| Ipv6 And Disconnected Network Test Compatibility | ✅ Passed | The added Ginkgo test uses the Kubernetes API and a fake ServiceAccount secret. It has no IPv4 literals, IP parsing, URL construction, or external connectivity requirement. |
| No-Weak-Crypto | ✅ Passed | The PR adds Kubernetes ServiceAccount deferral logic and tests only; changed files contain no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons. |
| Container-Privileges | ✅ Passed | The PR changes only reconciliation and tests; no privilege fields are added. Existing ENoExec settings are unchanged, and root use has an inline bpftrace justification. |
| No-Sensitive-Data-In-Logs | ✅ Passed | PR logs only a fixed ServiceAccount name and generic deferral text; no passwords, tokens, secret values, PII, hostnames, or customer data are logged. |
| Title check | ✅ Passed | The title clearly identifies the ENoExecEvent DaemonSet startup failure and its ServiceAccount pull secret race condition. |

</details>

</details>

<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

<details>
<summary>🧪 Generate unit tests (beta)</summary>

  • <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests
  • </details>

    </details>

    <!-- finishing_touch_checkbox_end -->
    <!-- tips_start -->

    ---

    <sub>Comment @coderabbitai help to get the list of available commands.</sub>

    <!-- tips_end -->
    <!-- internal state start -->

    <!-- N4IgzgxgFgpgtgQwGowE5gJYHsB2IBcAjADTgAuqArhGZajACYDKZCZMBoYF1t9K6bHiKkADqgDyAIwBWMGhgBuMMARABidQAIACgCUtYSnESoAngB0cVgCoYyAGxj4tAWQCqAGRsBJAIJ6AMIAEgC0AGwATADsAAwuMDhYMAAe8qEwyjhkoQwI8LhaACL5cLhMMGRaAGYIGA5gWmRYhqyoVRg4WgDWlNxYcBgAXjBaDDCiDlhmcIlkjQyUo81aFaiKGBAwfhAQWJTZWqKUDg6G8vRVqAhbWns4DPZCWlpWAHLGUmguAKyRhC8rO49J4XFAyGRRGB8AB6GEAc3sUEoUgAdHs4DCsKJEmAoBhqmQYXATmQMAhUNBQrQcJ14aFsWg2FhUDDjqcYX8Aa8cO4wN8tH4cDgEAAtJTdLAbCCAnBMfaU0ZSa44aAuAAG1QwKVCHm8/iCYSicXVspsFPhlS0yoQqqgGsQnVNPJYbD6LkZXR5ekyGBgAHc0NDdNc8bayFBwgAOAAsxC0CCcYG6toYqBaPM8CC+DQ1Mgw1xhikTGAYoXo1TQiS2zqsgXobEYLkisUi4VCsWioQAzLEtJFu0Qo/gfj8tO4bIFZbZYLoDAgGGmVPyFhMpjM5lp6A5yVJ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7F3FoW0D8pkbuXazibupx+58UIWaBAboUIesMwUqxfZdAjrlvz0WgL4ZxG87oVsLuSaGRoB77Vn5djw4MI9L2ximkpXd6WVx8uRLZiLUJMMFxNLxloVwIoQbVYYIPwEgYoB8JgeMIIOMLQLDf0LUPEeMB8QIVNWmQty8Zn5oBHrAxmvDCkOiS23HrrjFwp3r8G0pkn4byb0bin9XWD8G9zzxtAUIUUpQHlLqLzxRjn7t9abn073nkLlG0YOSRX0F6jw8HL8bXWGXrSHjyL/hDYJwGCT48Gax3RjVBbEaP9DKZY/kCEOkax828PCg9MbyThfkU4gyAVY2JUUQQka4W4GQUOfZPXBmH3lN7rgnvroPszsDhh0P8n0lmz3+mniocFtHmAUIEoVgUIHwHAUITwa9+Rg7lP3ztP3ttyrPsZuSKYDL9V5mR2tIZicXqocJnbD41saS92ApjVLi0G2jsQNuDAP+M0Guh7wPkdNV2ozl0A+AfA8YBaNwFiau8xuswRGNwicgqp3+NiRfgZ395Gd+uT6IbhZyp5Wcd+MaOSq1TID6BIa4NPUGFENCRQ4gCQJIKkHSD9lsguQB5CtjASk1naphPPL0FJbDB9SG7DcCJDGB+EWgf/GlG7yn7XImaTwdFlVUBjMD7WRVMavAyiTd0w66ULWpHQv5D5XQ7ATgDGjjQgA0GzQHQGg35DWD90oAJgc4LswMA/AZAH0GGlMq7kyAgkf8AQB+D2DQ03ZV2El1ORa4jcLiaoAwCyIQBQgamaINUFCBEUyKoQXImhVCBt4pA6JBcP9lbxsY7BMaIAA=== -->

    <!-- internal state end -->

    coderabbitai[bot] coderabbitai[bot] commented on code on Jul 30, 2026 23:24 UTC
    Code Review
    internal/controller/operator/clusterpodplacementconfig_controller_test.go:1
    @@ -736,6 +736,65 @@ var _ = Describe("internal/Controller/ClusterPodPlacementConfig/ClusterPodPlacem
     			}).Should(Succeed(), "finalizer should be removed after cleanup")
     		})
     	})
    +	Context("is handling the DaemonSet creation deferral when the ServiceAccount has no imagePullSecrets", func() {
    +		It("should defer DaemonSet creation until the ServiceAccount has imagePullSecrets", func() {
    +			By("Creating the ClusterPodPlacementConfig with ExecFormatErrorMonitor enabled")
    +			err := k8sClient.Create(ctx, builder.NewClusterPodPlacementConfig().WithName(common.SingletonResourceObjectName).
    +				WithExecFormatErrorMonitor(true).Build())
    +			Expect(err).NotTo(HaveOccurred(), "failed to create ClusterPodPlacementConfig", err)
    +
    +			By("Setting the pod placement deployments as ready")
    +			for _, name := range []string{utils.PodPlacementControllerName, utils.PodPlacementWebhookName} {
    +				Eventually(func(g Gomega) {
    +					setDeploymentReady(name, g)
    +				}).Should(Succeed(), "the deployment "+name+" should be ready")
    +			}
    +
    +			By("Verifying the enoexec objects WITHOUT the DaemonSet are created (SA, RBAC, Deployment)")
    +			Eventually(framework.ValidateCreation(k8sClient, ctx, framework.MainPlugin,
    +				framework.EnoExecPluginDeployment, framework.EnoExecPluginDeploymentObjects)).
    +				Should(Succeed(), "the enoexec deployment objects should be created")
    +
    +			By("Verifying the enoexec-event-daemon ServiceAccount exists but has no imagePullSecrets")
    +			Eventually(func(g Gomega) {
    +				sa := &corev1.ServiceAccount{}
    +				err := k8sClient.Get(ctx, crclient.ObjectKey{
    +					Name:      utils.EnoexecDaemonSet,
    +					Namespace: utils.Namespace(),
    +				}, sa)
    +				g.Expect(err).NotTo(HaveOccurred(), "the enoexec-event-daemon SA should be created")
    +				g.Expect(sa.ImagePullSecrets).To(BeEmpty(), "the SA should have no imagePullSecrets in envtest")
    +			}).Should(Succeed(), "the SA should exist without imagePullSecrets")
    +
    +			By("Verifying the DaemonSet is NOT created yet (SA has no imagePullSecrets in envtest)")
    +			Consistently(func(g Gomega) {
    +				ds := &appsv1.DaemonSet{}
    +				err := k8sClient.Get(ctx, crclient.ObjectKey{
    +					Name:      utils.EnoexecDaemonSet,
    +					Namespace: utils.Namespace(),
    +				}, ds)
    +				g.Expect(errors.IsNotFound(err)).To(BeTrue(), "the DaemonSet should not exist yet because the SA has no imagePullSecrets")
    +			}, "200ms", "50ms").Should(Succeed(), "the DaemonSet should remain absent while SA has no imagePullSecrets")
    +
    +			By("Simulating the OpenShift SA controller provisioning imagePullSecrets")
    +			simulateSAImagePullSecretProvisioning(utils.EnoexecDaemonSet)
    +
    +			By("Verifying the DaemonSet is created after the SA has imagePullSecrets")
    +			Eventually(func(g Gomega) {
    +				ds := &appsv1.DaemonSet{}
    +				err := k8sClient.Get(ctx, crclient.ObjectKey{
    +					Name:      utils.EnoexecDaemonSet,
    +					Namespace: utils.Namespace(),
    +				}, ds)
    +				g.Expect(err).NotTo(HaveOccurred(), "the DaemonSet should be created after SA has imagePullSecrets")
    +			}).Should(Succeed(), "the DaemonSet should be created")
    +
    +			By("Cleaning up")
    +			err = k8sClient.Delete(ctx, builder.NewClusterPodPlacementConfig().WithName(common.SingletonResourceObjectName).Build())
    +			Expect(err).NotTo(HaveOccurred(), "failed to delete ClusterPodPlacementConfig", err)
    +			Eventually(framework.ValidateDeletion(k8sClient, ctx, framework.MainPlugin, framework.ENoExecPlugin)).Should(Succeed(), "the ClusterPodPlacementConfig should be deleted")

    _🩺 Stability & Availability_ | _🟡 Minor_ | _⚡ Quick win_

    <details>
    <summary>🧩 Analysis chain</summary>

    🏁 Script executed:

    #!/bin/bash
    set -eu
    
    file="internal/controller/operator/clusterpodplacementconfig_controller_test.go"
    
    printf '%s\n' '--- test structure around the reported range ---'
    sed -n '680,825p' "$file"
    
    printf '%s\n' '--- cleanup registration and target resource usage ---'
    rg -n -C 3 'DeferCleanup|AfterEach|ClusterPodPlacementConfig|SingletonResourceObjectName|Ordered' "$file"
    
    printf '%s\n' '--- nearby suite/test setup patterns ---'
    rg -n -C 4 'func Test|Describe\\(|Context\\(|It\\(|BeforeEach\\(|AfterEach\\(' "$file" | head -n 300
    

    Repository: openshift/multiarch-tuning-operator

    Length of output: 39133

    ---

    🌐 Web query:

    Ginkgo v2 Ordered container spec failure remaining specs skipped AfterAll cleanup semantics

    💡 Result:

    In Ginkgo v2, Ordered containers are designed to run specs in the order they appear [1][2]. When a specification within an Ordered container fails, the default behavior is to skip all remaining specs within that container [3][1][2]. This occurs because Ginkgo treats the container as a correlated flow where subsequent steps depend on the success of prior ones [3]. If you wish to allow an Ordered container to continue running specs despite a failure, you can use the ContinueOnFailure decorator [4][5]. This decorator must be applied to the outermost Ordered container [4][5]. Note that if a BeforeAll or a once-per-ordered BeforeEach/JustBeforeEach setup node fails, the container's preconditions are considered failed, and no specs will run regardless of the ContinueOnFailure decorator [4]. Regarding cleanup semantics, AfterAll nodes run after all specifications in the Ordered container have completed [1][2]. It is important to note that Ginkgo executes cleanup nodes in a specific order: After* family nodes run before DeferCleanup family nodes [6][7]. Consequently, an AfterAll node will execute before any DeferCleanup closures registered within the individual It blocks [6]. If you require cleanup to occur after everything else, including after all specifications and their respective internal cleanups, using a DeferCleanup within a BeforeAll node is a recommended workaround, as it will be queued to run at the very end [6].

    Citations:

  • 1: https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md

  • 2: https://onsi.github.io/ginkgo/MIGRATING_TO_V2

  • 3: https://github.com/onsi/ginkgo/issues/966

  • 4: https://github.com/onsi/ginkgo/blob/master/decorator_dsl.go

  • 5: https://github.com/onsi/ginkgo/issues/1103

  • 6: https://github.com/onsi/ginkgo/issues/1284

  • 7: https://github.com/onsi/ginkgo/issues/1022
  • ---

    🏁 Script executed:

    #!/bin/bash
    set -eu
    
    printf '%s\n' '--- all test references to the singleton resource ---'
    rg -n -g '*_test.go' 'SingletonResourceObjectName|ClusterPodPlacementConfig' .
    
    printf '%s\n' '--- top-level Ginkgo containers in this package ---'
    rg -n 'var _ = (Describe|Context|When)|Describe\\(' internal/controller/operator -g '*_test.go' | head -n 200
    
    printf '%s\n' '--- module and Ginkgo version ---'
    rg -n 'onsi/ginkgo|ginkgo' go.mod go.sum 2>/dev/null | head -n 40
    

    Repository: openshift/multiarch-tuning-operator

    Length of output: 50391

    ---

    🏁 Script executed:

    #!/bin/bash
    set -eu
    
    printf '%s\n' '--- Ginkgo dependency ---'
    rg -n 'onsi/ginkgo' go.mod go.sum | head -n 20
    
    printf '%s\n' '--- Ginkgo containers in the operator package ---'
    rg -n 'var _ =|Describe\\(|Ordered|Serial|ContinueOnFailure|BeforeAll|AfterAll|BeforeEach|AfterEach' internal/controller/operator -g '*_test.go' | head -n 180
    
    printf '%s\n' '--- read-only structural check for the target test ---'
    python3 - <<'PY'
    from pathlib import Path
    p = Path("internal/controller/operator/clusterpodplacementconfig_controller_test.go")
    s = p.read_text()
    start = s.index('Context("is handling the DaemonSet creation deferral')
    end = s.index('Context("the webhook shoud deny PodPlacementConfig creation', start)
    block = s[start:end]
    print("target_context_has_before_each:", "BeforeEach(" in block)
    print("target_context_has_after_each:", "AfterEach(" in block)
    print("target_test_has_defer_cleanup:", "DeferCleanup(" in block)
    print("target_test_has_explicit_delete:", "k8sClient.Delete(" in block)
    print("parent_describe_is_ordered:", 'Describe("internal/Controller/ClusterPodPlacementConfig/ClusterPodPlacementConfigReconciler", Serial, Ordered' in s)
    print("specs_after_target_context:", s[end:].count("\n\t\tIt("))
    PY
    

    Repository: openshift/multiarch-tuning-operator

    Length of output: 907

    ---

    </details>

    Register cleanup before assertions.

    Only the final delete runs, so a failed assertion can leave the singleton resource behind. Register DeferCleanup immediately after creation or move cleanup into AfterEach.

    <details>
    <summary>🤖 Prompt for AI Agents</summary>

    Verify each finding against current code. Fix only still-valid issues, skip the
    rest with a brief reason, keep changes minimal, and validate.
    
    In `@internal/controller/operator/clusterpodplacementconfig_controller_test.go`
    around lines 742 - 795, Register DeferCleanup immediately after the
    ClusterPodPlacementConfig creation in the test, using the existing delete and
    validation flow currently under “Cleaning up.” Ensure cleanup runs even when any
    subsequent assertion fails, and remove the now-redundant final cleanup block.
    

    </details>

    <!-- fingerprinting:phantom:poseidon:terra -->

    <!-- cr-indicator-types:potential_issue -->

    <!-- cr-comment:v1:9347ab60cfd18f2756febed9 -->

    _Source: Coding guidelines_

    <!-- This is an auto-generated comment by CodeRabbit -->

    ✅ Addressed in commit 4adad46

    coderabbitai[bot] coderabbitai[bot] commented on code on Jul 30, 2026 23:24 UTC
    Code Review
    internal/controller/operator/clusterpodplacementconfig_controller.go:1
    @@ -901,8 +910,27 @@ func (r *ClusterPodPlacementConfigReconciler) buildENoExecEventObjects(ctx conte
     			},
     		),
     		buildDeploymentENoExecEventHandler(logVerbosityLevel),
    -		buildDaemonSetENoExecEvent(utils.EnoexecDaemonSet, utils.EnoexecDaemonSet, logVerbosityLevel),
     	}
    +
    +	// Defer DaemonSet creation until the ServiceAccount's imagePullSecrets are provisioned
    +	// by the OpenShift SA controller. This avoids a race condition where DaemonSet pods
    +	// start immediately on all nodes before the SA's dockercfg secret exists, causing
    +	// FailedToRetrieveImagePullSecret errors.
    +	daemonSetDeferred := false
    +	sa, err := r.ClientSet.CoreV1().ServiceAccounts(utils.Namespace()).Get(ctx, utils.EnoexecDaemonSet, metav1.GetOptions{})
    +	if err != nil {
    +		// SA doesn't exist yet (will be created by ApplyResources); defer the DaemonSet
    +		log.V(1).Info("ServiceAccount not found, deferring DaemonSet creation", "serviceAccount", utils.EnoexecDaemonSet)
    +		daemonSetDeferred = true
    +	} else if len(sa.ImagePullSecrets) == 0 {
    +		log.V(1).Info("ServiceAccount has no imagePullSecrets yet, deferring DaemonSet creation", "serviceAccount", utils.EnoexecDaemonSet)
    +		daemonSetDeferred = true
    +	}

    _🩺 Stability & Availability_ | _🟠 Major_ | _⚡ Quick win_

    <details>
    <summary>🧩 Analysis chain</summary>

    🏁 Script executed:

    # Inspect the controller logic and its surrounding error handling/callers without executing repository code.
    printf '%s\n' '--- target lines ---'
    sed -n '880,950p' internal/controller/operator/clusterpodplacementconfig_controller.go
    printf '%s\n' '--- ServiceAccount helper/error handling references ---'
    rg -n -C 4 'ServiceAccounts\(.*\)\.Get|daemonSetDeferred|buildENoExecEventObjects|ApplyResources' internal/controller/operator/clusterpodplacementconfig_controller.go
    

    Repository: openshift/multiarch-tuning-operator

    Length of output: 7090

    ---

    🏁 Script executed:

    # Trace the reconcile return path and test coverage to determine whether all Get errors are intentionally requeued
    # and whether an unexpected error is surfaced to the controller.
    printf '%s\n' '--- imports and reconcile return path ---'
    sed -n '1,120p' internal/controller/operator/clusterpodplacementconfig_controller.go
    sed -n '640,755p' internal/controller/operator/clusterpodplacementconfig_controller.go
    printf '%s\n' '--- related tests and API-error handling ---'
    rg -n -C 5 'buildENoExecEventObjects|daemonSetDeferred|ImagePullSecrets|IsNotFound|ServiceAccount.*Get|FailedToRetrieveImagePullSecret' --glob '*_test.go' --glob '*.go' .
    

    Repository: openshift/multiarch-tuning-operator

    Length of output: 50392

    ---

    🏁 Script executed:

    # Inspect the complete Reconcile error/result handling and the resource application behavior,
    # then use a small static behavioral probe to enumerate the branches in the reviewed block.
    printf '%s\n' '--- Reconcile entry and return handling ---'
    sed -n '105,220p' internal/controller/operator/clusterpodplacementconfig_controller.go
    printf '%s\n' '--- ApplyResources implementation ---'
    rg -n -C 8 'func ApplyResources|ApplyResources\(' pkg internal
    printf '%s\n' '--- controller watches/setup ---'
    rg -n -C 6 'For\(|Owns\(|ServiceAccount|ClusterPodPlacementConfigReconciler' internal/controller/operator
    printf '%s\n' '--- reviewed branch shape ---'
    python3 - <<'PY'
    from pathlib import Path
    p = Path("internal/controller/operator/clusterpodplacementconfig_controller.go")
    lines = p.read_text().splitlines()
    for n in range(919, 929):
        print(f"{n}: {lines[n-1]}")
    PY
    

    Repository: openshift/multiarch-tuning-operator

    Length of output: 50391

    ---

    </details>

    Propagate unexpected ServiceAccount read failures.

    Only apierrors.IsNotFound(err) should defer the DaemonSet; return other errors so Forbidden, timeout, and API-server failures are not treated as a missing ServiceAccount.

    <details>
    <summary>🤖 Prompt for AI Agents</summary>

    Verify each finding against current code. Fix only still-valid issues, skip the
    rest with a brief reason, keep changes minimal, and validate.
    
    In `@internal/controller/operator/clusterpodplacementconfig_controller.go` around
    lines 920 - 928, Update the ServiceAccount lookup handling in the controller’s
    DaemonSet creation flow so only apierrors.IsNotFound(err) marks
    daemonSetDeferred; propagate all other Get errors immediately. Preserve the
    existing imagePullSecrets deferral behavior when the ServiceAccount is
    successfully retrieved without secrets.
    

    </details>

    <!-- fingerprinting:phantom:poseidon:terra -->

    <!-- cr-indicator-types:potential_issue -->

    <!-- cr-comment:v1:98cc1ca67f20b196428b2f38 -->

    _Source: Path instructions_

    <!-- This is an auto-generated comment by CodeRabbit -->

    ✅ Addressed in commit bb5583c

    coderabbitai[bot] coderabbitai[bot] commented on Jul 30, 2026 23:24 UTC
    Reviewer

    Actionable comments posted: 2

    <details>
    <summary>🤖 Prompt for all review comments with AI agents</summary>

    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 `@internal/controller/operator/clusterpodplacementconfig_controller_test.go`:
    - Around line 742-795: Register DeferCleanup immediately after the
    ClusterPodPlacementConfig creation in the test, using the existing delete and
    validation flow currently under “Cleaning up.” Ensure cleanup runs even when any
    subsequent assertion fails, and remove the now-redundant final cleanup block.
    
    In `@internal/controller/operator/clusterpodplacementconfig_controller.go`:
    - Around line 920-928: Update the ServiceAccount lookup handling in the
    controller’s DaemonSet creation flow so only apierrors.IsNotFound(err) marks
    daemonSetDeferred; propagate all other Get errors immediately. Preserve the
    existing imagePullSecrets deferral behavior when the ServiceAccount is
    successfully retrieved without secrets.
    

    </details>

    <details>
    <summary>🪄 Autofix (Beta)</summary>

    Fix all unresolved CodeRabbit comments on this PR:

  • <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)

  • <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes
  • </details>

    ---

    <details>
    <summary>ℹ️ Review info</summary>

    <details>
    <summary>⚙️ Run configuration</summary>

    Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

    Review profile: CHILL

    Plan: Enterprise

    Run ID: 5137c788-baa2-4be5-9137-c60cb3545700

    </details>

    <details>
    <summary>📥 Commits</summary>

    Reviewing files that changed from the base of the PR and between 97e994c91bdb7c579811556034f17422c990dfc9 and f5e800a80b6b24e6493ed56457b7061562434ff6.

    </details>

    <details>
    <summary>📒 Files selected for processing (2)</summary>

    internal/controller/operator/clusterpodplacementconfig_controller.go
    internal/controller/operator/clusterpodplacementconfig_controller_test.go

    </details>

    </details>

    <!-- This is an auto-generated comment by CodeRabbit for review status -->

    rvanderp3 rvanderp3 commented on Jul 31, 2026 20:48 UTC
    Contributor

    /retest

    rvanderp3 rvanderp3 commented on Aug 03, 2026 12:45 UTC
    Contributor

    /retest

    rvanderp3 rvanderp3 commented on Aug 03, 2026 13:30 UTC
    Contributor

    /retitle MULTIARCH-6270: enoexec-event-daemon DaemonSet fails to start in kustomize deployments due to ServiceAccount pull secret race condition

    openshift-ci-robot openshift-ci-robot commented on Aug 03, 2026 13:30 UTC
    Contributor

    @AnnaZivkovic: This pull request references MULTIARCH-6270 which is a valid jira issue.

    Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

    <details>

    In response to this:

    >

    ><!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    >## Summary by CodeRabbit
    > Bug Fixes

    Improved deployment reliability for the ENoExecEvent plugin by waiting for required ServiceAccount image pull secrets before creating its DaemonSet.

    * Automatically retries reconciliation after prerequisites become available, ensuring the DaemonSet is created successfully.

    ><!-- end of auto-generated comment: release notes by coderabbit.ai -->

    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 openshift-eng/jira-lifecycle-plugin repository.
    </details>

    AnnaZivkovic AnnaZivkovic commented on Aug 03, 2026 16:41 UTC
    Author

    A suggestion on the implementation: this codebase already has an established pattern for conditional resource inclusion the MutatingWebhookConfiguration at lines 756-764 of reconcile(). The MWC is built outside buildPodPlacementConfigObjects() and conditionally appended in reconcile() based on a readiness check (CanDeployMutatingWebhook()).

    The current PR diverges from that pattern in a few ways:
    - It adds an API call (ServiceAccounts().Get()) inside buildENoExecEventObjects(), which is otherwise a pure build
    function
    - It threads a daemonSetDeferred boolean through the return value
    - It introduces a new early-return path from reconcile()

    Could we follow the MWC pattern instead? Concretely:
    1. Remove the DaemonSet from buildENoExecEventObjects()
    2. Add a small helper like isEnoexecDaemonSetSAReady(ctx) bool that checks len(sa.ImagePullSecrets) > 0
    3. Conditionally append the DaemonSet in reconcile(), right next to the MWC block:

      // Defer enoexec DaemonSet until SA imagePullSecrets are provisioned by the OpenShift SA controller
      if clusterPodPlacementConfig.PluginsEnabled(common.ExecFormatErrorMonitorPluginName) {
          if r.isEnoexecDaemonSetSAReady(ctx) {
              objects = append(objects, buildDaemonSetENoExecEvent(utils.EnoexecDaemonSet, utils.EnoexecDaemonSet,
      logVerbosityLevel))
          } else {
              log.V(1).Info("Deferring enoexec DaemonSet creation: SA imagePullSecrets not yet provisioned")
          }
      }
    

    This way the build function stays pure, there's no boolean threading, ApplyResources always runs for the other resources (no deadlock risk on first deploy), and the requeue happens naturally through updateStatus returning requeueAfterError when the operator is still progressing.

    coderabbitai[bot] coderabbitai[bot] commented on Aug 03, 2026 16:48 UTC
    Reviewer

    [!CAUTION]

    Some comments are outside the diff and can’t be posted inline due to platform limitations.

    >

    > <details>

    <summary>⚠️ Outside diff range comments (1)</summary><blockquote>

    > <details>

    <summary>internal/controller/operator/clusterpodplacementconfig_controller.go (1)</summary><blockquote>

    > 1044-1051: _🗄️ Data Integrity & Integration_ | _🟠 Major_ | _⚡ Quick win_

    > Propagate failed ENoExecEvent deletions.

    > If r.Delete fails, this function only logs the error. handleEnoexecDelete can then remove the finalizer and delete the controller while the errored ENoExecEvent remains in the cluster.

    > Return an aggregate of deletion errors and stop cleanup until a later reconciliation deletes all errored resources.

    > <details>

    <summary>Proposed fix</summary>

    >
    > -func (r *ClusterPodPlacementConfigReconciler) deleteErroredENoExecEvents(ctx context.Context, enoexecEventList *multiarchv1beta1.ENoExecEventList) (nonErroredCount, erroredCount int) {
    > +func (r *ClusterPodPlacementConfigReconciler) deleteErroredENoExecEvents(ctx context.Context, enoexecEventList *multiarchv1beta1.ENoExecEventList) (nonErroredCount, erroredCount int, err error) {
    > +  var errs []error
    >    // ...
    >    } else {
    >      log.Error(deleteErr, "Failed to delete errored ENoExecEvent", "name", enoexecEvent.Name)
    > +    errs = append(errs, deleteErr)
    >    }
    >    // ...
    > -  return nonErroredCount, erroredCount
    > +  return nonErroredCount, erroredCount, errorutils.NewAggregate(errs)
    >  }
    > 

    > Then return the error from handleEnoexecDelete before it removes finalizers or operand resources. As per path instructions, "Never ignore error returns."

    > <details>

    <summary>🤖 Prompt for AI Agents</summary>

    >
    > Verify each finding against current code. Fix only still-valid issues, skip the
    > rest with a brief reason, keep changes minimal, and validate.
    > 
    > In `@internal/controller/operator/clusterpodplacementconfig_controller.go` around
    > lines 1044 - 1051, Update the ENoExecEvent cleanup flow around
    > handleEnoexecDelete to propagate non-NotFound errors from r.Delete instead of
    > only logging them. Aggregate deletion errors when multiple errored resources are
    > processed, return the aggregate before removing finalizers or operand resources,
    > and preserve successful and already-deleted handling so cleanup retries on a
    > later reconciliation.
    > 

    > </details>

    > <!-- cr-comment:v1:972c9e2a29282d9f17a23878 -->

    > _Source: Path instructions_

    > </blockquote></details>

    > </blockquote></details>

    <details>
    <summary>🤖 Prompt for all review comments with AI agents</summary>

    Verify each finding against current code. Fix only still-valid issues, skip the
    rest with a brief reason, keep changes minimal, and validate.
    
    Outside diff comments:
    In `@internal/controller/operator/clusterpodplacementconfig_controller.go`:
    - Around line 1044-1051: Update the ENoExecEvent cleanup flow around
    handleEnoexecDelete to propagate non-NotFound errors from r.Delete instead of
    only logging them. Aggregate deletion errors when multiple errored resources are
    processed, return the aggregate before removing finalizers or operand resources,
    and preserve successful and already-deleted handling so cleanup retries on a
    later reconciliation.
    

    </details>

    ---

    <details>
    <summary>ℹ️ Review info</summary>

    <details>
    <summary>⚙️ Run configuration</summary>

    Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

    Review profile: CHILL

    Plan: Enterprise

    Run ID: 4041fcb0-6761-4528-9989-a57014b99d98

    </details>

    <details>
    <summary>📥 Commits</summary>

    Reviewing files that changed from the base of the PR and between bb5583cf00fca3ecd8adeb225640c568deb3202c and 4e0c3862dd54279abc4c0c7f6b545adabdc676c5.

    </details>

    <details>
    <summary>📒 Files selected for processing (2)</summary>

    internal/controller/operator/clusterpodplacementconfig_controller.go
    internal/controller/operator/clusterpodplacementconfig_controller_test.go

    </details>

    <details>
    <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

  • internal/controller/operator/clusterpodplacementconfig_controller_test.go
  • </details>

    </details>

    <!-- This is an auto-generated comment by CodeRabbit for review status -->

    AnnaZivkovic AnnaZivkovic commented on Aug 04, 2026 17:48 UTC
    Author

    /retest

    AnnaZivkovic AnnaZivkovic commented on Aug 04, 2026 18:23 UTC
    Author

    That is looking better. Is it intentional to bypasses the informer cache? If so can you add a comment explaining why. The controller already Owns(&corev1.ServiceAccount{}), so the SA is cached. Prefer:

    sa := &corev1.ServiceAccount{}
    err := r.Get(ctx, client.ObjectKey{
        Name: utils.EnoexecDaemonSet, Namespace: utils.Namespace(),
    }, sa)
    

    That turns the check into a cache read (0 API calls when the cache is warm).

    Also, later in the same reconcile ApplyServiceAccount Gets the same SA again. So with the plugin on you Get that SA twice per reconcile. Using the cached client for the readiness check removes the extra live call; the Apply Get remains (pre-existing).

    Optional further trim: once the DaemonSet already exists, skip the SA check and always include the DaemonSet. The readiness gate only matters for initial creation.

    AnnaZivkovic AnnaZivkovic commented on code on Aug 05, 2026 20:46 UTC
    Code Review
    internal/controller/operator/clusterpodplacementconfig_controller.go:1
    @@ -763,6 +764,36 @@ func (r *ClusterPodPlacementConfigReconciler) reconcile(ctx context.Context, clu
     		_ = r.ClientSet.AdmissionregistrationV1().MutatingWebhookConfigurations().Delete(ctx, utils.PodMutatingWebhookConfigurationName, metav1.DeleteOptions{})
     	}
     
    +	// Defer enoexec DaemonSet until SA imagePullSecrets are provisioned by the OpenShift SA controller.
    +	// This avoids a race condition where DaemonSet pods start immediately on all nodes before the SA's
    +	// dockercfg secret exists, causing FailedToRetrieveImagePullSecret errors.
    +	// Once the DaemonSet already exists, the SA check is skipped because the readiness gate only
    +	// matters for initial creation.
    +	if clusterPodPlacementConfig.PluginsEnabled(common.ExecFormatErrorMonitorPluginName) {
    +		logVerbosityLevel := clusterPodPlacementConfig.Spec.LogVerbosity.ToZapLevelInt()
    +		includeDaemonSet := false
    +		ds := &appsv1.DaemonSet{}
    +		if err := r.Get(ctx, client.ObjectKey{Name: utils.EnoexecDaemonSet, Namespace: utils.Namespace()}, ds); err == nil {
    +			// DaemonSet already exists; always include it so ApplyResources keeps it in sync.
    +			includeDaemonSet = true
    +		} else if !apierrors.IsNotFound(err) {
    +			return errorutils.NewAggregate([]error{err, r.updateStatus(ctx, clusterPodPlacementConfig)})
    +		} else {
    +			// DaemonSet does not exist yet; only create it once SA imagePullSecrets are provisioned.
    +			saReady, err := r.isEnoexecDaemonSetSAReady(ctx)
    +			if err != nil {
    +				return errorutils.NewAggregate([]error{err, r.updateStatus(ctx, clusterPodPlacementConfig)})
    +			}
    +			includeDaemonSet = saReady
    +			if !saReady {
    +				log.V(1).Info("Deferring enoexec DaemonSet creation: SA imagePullSecrets not yet provisioned")
    +			}
    +		}
    +		if includeDaemonSet {
    +			objects = append(objects, buildDaemonSetENoExecEvent(utils.EnoexecDaemonSet, utils.EnoexecDaemonSet, logVerbosityLevel))
    +		}
    +	}

    Must-fix: no requeue while DaemonSet is deferred

    When !saReady we only log and continue. Later return r.updateStatus(...) only requeues if Progressing is true, and Status.Build() only considers pod-placement Deployments + MWC — not the enoexec DaemonSet.

    So enabling ExecFormatErrorMonitor on an already-Ready CPPC can:
    1. create the SA / RBAC / Deployment
    2. defer the DaemonSet
    3. finish reconcile with nil (no requeue)
    4. depend entirely on Owns(ServiceAccount) to wake us when OpenShift fills imagePullSecrets

    That usually works (and the test covers the watch path), but it is fragile under informer lag / a slow SA controller, and the commit message claiming requeue “happens naturally through updateStatus” is not accurate for this wait.

    Suggested fix: track deferral and return an explicit requeue after a successful Apply, matching the existing DaemonSet deletion wait pattern:

    daemonSetDeferred := false
    if clusterPodPlacementConfig.PluginsEnabled(common.ExecFormatErrorMonitorPluginName) {
    	logVerbosityLevel := clusterPodPlacementConfig.Spec.LogVerbosity.ToZapLevelInt()
    	includeDaemonSet := false
    	ds := &appsv1.DaemonSet{}
    	if err := r.Get(ctx, client.ObjectKey{Name: utils.EnoexecDaemonSet, Namespace: utils.Namespace()}, ds); err == nil {
    		includeDaemonSet = true
    	} else if !apierrors.IsNotFound(err) {
    		return errorutils.NewAggregate([]error{err, r.updateStatus(ctx, clusterPodPlacementConfig)})
    	} else {
    		saReady, err := r.isEnoexecDaemonSetSAReady(ctx)
    		if err != nil {
    			return errorutils.NewAggregate([]error{err, r.updateStatus(ctx, clusterPodPlacementConfig)})
    		}
    		includeDaemonSet = saReady
    		if !saReady {
    			daemonSetDeferred = true
    			log.V(1).Info("Deferring enoexec DaemonSet creation: SA imagePullSecrets not yet provisioned")
    		}
    	}
    	if includeDaemonSet {
    		objects = append(objects, buildDaemonSetENoExecEvent(utils.EnoexecDaemonSet, utils.EnoexecDaemonSet, logVerbosityLevel))
    	}
    }
    

    Then after ApplyResources succeeds (bottom of reconcile):

    if err := utils.ApplyResources(ctx, r.ClientSet, r.DynamicClient, r.Recorder, objects); err != nil {
    	log.Error(err, "Unable to apply resources")
    	return errorutils.NewAggregate([]error{err, r.updateStatus(ctx, clusterPodPlacementConfig)})
    }
    if daemonSetDeferred {
    	// Status does not track enoexec DaemonSet readiness, so updateStatus alone
    	// will not requeue once pod-placement deps are Ready. Keep retrying until
    	// SA imagePullSecrets are provisioned (Owns(SA) may also wake us sooner).
    	if err := r.updateStatus(ctx, clusterPodPlacementConfig); err != nil {
    		return err
    	}
    	return newRequeueAfterError(5*time.Second, "waiting for enoexec SA imagePullSecrets before creating DaemonSet")
    }
    return r.updateStatus(ctx, clusterPodPlacementConfig)
    

    AnnaZivkovic AnnaZivkovic commented on code on Aug 05, 2026 20:46 UTC
    Code Review
    internal/controller/operator/clusterpodplacementconfig_controller.go:1
    @@ -953,8 +984,8 @@ func (r *ClusterPodPlacementConfigReconciler) buildENoExecEventObjects(ctx conte
     			},
     		),
     		buildDeploymentENoExecEventHandler(logVerbosityLevel),

    Residual race (non-blocking / follow-up)

    The handler Deployment is still applied in the same batch as its ServiceAccount with no imagePullSecrets wait. DaemonSets race harder (pods on every node immediately), so gating only the DaemonSet is reasonable for this bug — but the Deployment can still hit FailedToRetrieveImagePullSecret on a slow SA controller.

    Consider either:
    1. Documenting that residual risk in the PR description, or
    2. A follow-up that gates the Deployment the same way (shared SA-ready helper).

    Not a merge blocker for MULTIARCH-6270.

    AnnaZivkovic AnnaZivkovic commented on code on Aug 05, 2026 20:46 UTC
    Code Review
    internal/controller/operator/clusterpodplacementconfig_controller.go:1
    @@ -969,6 +1000,26 @@ func (r *ClusterPodPlacementConfigReconciler) buildENoExecEventObjects(ctx conte
     	return objects, nil
     }
     
    +// isEnoexecDaemonSetSAReady checks whether the enoexec-event-daemon ServiceAccount exists and
    +// has imagePullSecrets provisioned by the OpenShift SA controller. Returns false if the SA does
    +// not exist yet or has no imagePullSecrets.
    +// Uses the cached client (r.Get) instead of a live API call because the controller already
    +// Owns(&corev1.ServiceAccount{}), so the SA is in the informer cache.
    +func (r *ClusterPodPlacementConfigReconciler) isEnoexecDaemonSetSAReady(ctx context.Context) (bool, error) {
    +	sa := &corev1.ServiceAccount{}
    +	err := r.Get(ctx, client.ObjectKey{
    +		Name:      utils.EnoexecDaemonSet,
    +		Namespace: utils.Namespace(),
    +	}, sa)
    +	if apierrors.IsNotFound(err) {
    +		return false, nil
    +	}
    +	if err != nil {
    +		return false, err
    +	}
    +	return len(sa.ImagePullSecrets) > 0, nil

    Nit: document OpenShift-only assumption

    Cached r.Get here is the right call given Owns(&corev1.ServiceAccount{}) — thanks for addressing that.

    Worth a one-line comment that this readiness gate assumes the OpenShift SA controller will eventually populate imagePullSecrets. On plain Kubernetes / envtest without that controller, the DaemonSet is never created (which is why the test simulates it).

    Optional hardening (probably overkill unless you still see failures after this fix): also verify the referenced Secret object exists, not just len(ImagePullSecrets) > 0.

    AnnaZivkovic AnnaZivkovic commented on code on Aug 05, 2026 20:46 UTC
    Code Review
    internal/controller/operator/clusterpodplacementconfig_controller_test.go:1
    @@ -736,6 +736,67 @@ var _ = Describe("internal/Controller/ClusterPodPlacementConfig/ClusterPodPlacem
     			}).Should(Succeed(), "finalizer should be removed after cleanup")
     		})
     	})
    +	Context("is handling the DaemonSet creation deferral when the ServiceAccount has no imagePullSecrets", func() {
    +		BeforeEach(func() {
    +			By("Creating the ClusterPodPlacementConfig with ExecFormatErrorMonitor enabled")
    +			err := k8sClient.Create(ctx, builder.NewClusterPodPlacementConfig().WithName(common.SingletonResourceObjectName).
    +				WithExecFormatErrorMonitor(true).Build())
    +			Expect(err).NotTo(HaveOccurred(), "failed to create ClusterPodPlacementConfig", err)
    +
    +			By("Setting the pod placement deployments as ready")
    +			for _, name := range []string{utils.PodPlacementControllerName, utils.PodPlacementWebhookName} {
    +				Eventually(func(g Gomega) {
    +					setDeploymentReady(name, g)
    +				}).Should(Succeed(), "the deployment "+name+" should be ready")
    +			}
    +		})
    +		AfterEach(func() {
    +			By("Deleting the ClusterPodPlacementConfig")
    +			err := k8sClient.Delete(ctx, builder.NewClusterPodPlacementConfig().WithName(common.SingletonResourceObjectName).Build())
    +			Expect(crclient.IgnoreNotFound(err)).NotTo(HaveOccurred(), "failed to delete ClusterPodPlacementConfig", err)
    +			Eventually(framework.ValidateDeletion(k8sClient, ctx, framework.MainPlugin, framework.ENoExecPlugin)).Should(Succeed(), "the ClusterPodPlacementConfig should be deleted")
    +		})
    +		It("should defer DaemonSet creation until the ServiceAccount has imagePullSecrets", func() {
    +			By("Verifying the enoexec objects WITHOUT the DaemonSet are created (SA, RBAC, Deployment)")
    +			Eventually(framework.ValidateCreation(k8sClient, ctx, framework.MainPlugin,
    +				framework.EnoExecPluginDeployment, framework.EnoExecPluginDeploymentObjects)).
    +				Should(Succeed(), "the enoexec deployment objects should be created")
    +
    +			By("Verifying the enoexec-event-daemon ServiceAccount exists but has no imagePullSecrets")
    +			Eventually(func(g Gomega) {
    +				sa := &corev1.ServiceAccount{}
    +				err := k8sClient.Get(ctx, crclient.ObjectKey{
    +					Name:      utils.EnoexecDaemonSet,
    +					Namespace: utils.Namespace(),
    +				}, sa)
    +				g.Expect(err).NotTo(HaveOccurred(), "the enoexec-event-daemon SA should be created")
    +				g.Expect(sa.ImagePullSecrets).To(BeEmpty(), "the SA should have no imagePullSecrets in envtest")
    +			}).Should(Succeed(), "the SA should exist without imagePullSecrets")
    +
    +			By("Verifying the DaemonSet is NOT created yet (SA has no imagePullSecrets in envtest)")
    +			Consistently(func(g Gomega) {
    +				ds := &appsv1.DaemonSet{}
    +				err := k8sClient.Get(ctx, crclient.ObjectKey{
    +					Name:      utils.EnoexecDaemonSet,
    +					Namespace: utils.Namespace(),
    +				}, ds)
    +				g.Expect(errors.IsNotFound(err)).To(BeTrue(), "the DaemonSet should not exist yet because the SA has no imagePullSecrets")
    +			}, "200ms", "50ms").Should(Succeed(), "the DaemonSet should remain absent while SA has no imagePullSecrets")
    +

    Test nits

    Good coverage of the defer → provision → create path.

    Suggestions:
    1. Consider bumping Consistently beyond 200ms (e.g. 1s) so a slow reconcile under load is less likely to flake.
    2. If you add the explicit RequeueAfter suggested above, assert that the DaemonSet stays absent for longer and/or that reconcile keeps retrying while the SA has no pull secrets (documents that we do not rely only on the SA watch).
    3. Nice-to-have: a small unit-style case that when the DaemonSet already exists, creation proceeds without needing imagePullSecrets on the SA (covers the new skip path).

    AnnaZivkovic AnnaZivkovic commented on Aug 05, 2026 20:46 UTC
    Reviewer

    Review summary

    Nice cleanup since the last round — cached r.Get and skipping the SA check once the DaemonSet exists address the API-efficiency concerns.

    There is still one correctness issue that I think should be fixed before merge: when the DaemonSet is deferred, there is no guaranteed requeue. updateStatus() only requeues while Progressing, and Progressing does not track the enoexec DaemonSet. On an already-Ready CPPC (or once pod-placement deps become Ready), progress relies solely on Owns(ServiceAccount) firing when OpenShift populates imagePullSecrets.

    The integration test shows the watch path works in envtest, which is good, but an explicit RequeueAfter matches the existing DaemonSet deletion wait pattern and is much safer.

    Also worth noting


  • Residual pull-secret race still exists for the enoexec Deployment (same Apply batch as its SA)

  • CPPC can report Available while the enoexec DaemonSet is missing (status observability gap; pre-existing, widened by this change)

  • Branch appears a few commits behind main — rebase before merge
  • Inline comments have suggested fixes.

    rvanderp3 rvanderp3 commented on Aug 06, 2026 14:32 UTC
    Contributor

    /retest

    AnnaZivkovic AnnaZivkovic commented on Aug 06, 2026 16:48 UTC
    Author

    /lgtm
    /approve

    openshift-ci[bot] openshift-ci[bot] commented on Aug 06, 2026 16:48 UTC
    Bot

    @AnnaZivkovic: you cannot LGTM your own PR.

    <details>

    In response to this:

    >/lgtm
    >/approve

    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.
    </details>

    openshift-ci[bot] openshift-ci[bot] commented on Aug 06, 2026 16:49 UTC
    Bot

    [APPROVALNOTIFIER] This PR is APPROVED

    This pull-request has been approved by: <a href="https://github.com/openshift/multiarch-tuning-operator/pull/521#issuecomment-5207571430" title="Approved">AnnaZivkovic</a>

    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:

  • ~~OWNERS~~ [AnnaZivkovic]
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":[]} -->

    jcpowermac jcpowermac commented on Aug 10, 2026 18:41 UTC
    Contributor

    /lgtm

    openshift-merge-bot[bot] openshift-merge-bot[bot] commented on Aug 10, 2026 21:25 UTC
    Bot

    /retest-required

    Remaining retests: 0 against base HEAD 9b170fde33aafca49e0f0c19e02d71f3613c3576 and 2 for PR HEAD 32a1ad3449961c02cfcbe2535002a8743e68afc4 in total

    AnnaZivkovic AnnaZivkovic commented on Aug 11, 2026 17:20 UTC
    Author

    /override ci/prow/ocp421-e2e-aws

    openshift-ci[bot] openshift-ci[bot] commented on Aug 11, 2026 17:20 UTC
    Bot

    @AnnaZivkovic: Overrode contexts on behalf of AnnaZivkovic: ci/prow/ocp421-e2e-aws

    <details>

    In response to this:

    >/override ci/prow/ocp421-e2e-aws

    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.
    </details>

    openshift-ci[bot] openshift-ci[bot] commented on Aug 11, 2026 17:20 UTC
    Bot

    @AnnaZivkovic: 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.
    </details>
    <!-- test report -->

    AnnaZivkovic AnnaZivkovic commented on Aug 13, 2026 18:20 UTC
    Author

    /cherrypick v1.x

    openshift-cherrypick-robot openshift-cherrypick-robot commented on Aug 13, 2026 18:21 UTC
    Contributor

    @AnnaZivkovic: new pull request created: #531

    <details>

    In response to this:

    >/cherrypick v1.x

    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.
    </details>

    Reviewers
    Assignees
    AnnaZivkovic AnnaZivkovic
    Labels
    risk: low confidence: 85.8% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 78.6% (HIGH) · Higher = larger blast radius
    78.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 85.8% · Lower = rushed or shallow review
    85.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 11.2% · Safe to merge
    11.2%