Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(wrc): keep the NetworkPolicy ownership condition when a pass does not evaluate it

Alfredo Lopezaa0e98e71523
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index fcc15d836..8f1f49c72 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.380",
+ "version": "0.1.381",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.380",
+ "version": "0.1.381",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@aws-sdk/client-s3": "^3.1009.0",
diff --git a/workflow-recipes/package.json b/workflow-recipes/package.json
index 912104a91..f188c03ba 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.380",
+ "version": "0.1.381",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/k8sClient.test.ts b/workflow-recipes/src/k8sClient.test.ts
index fa4666618..5e2732da9 100644
--- a/workflow-recipes/src/k8sClient.test.ts
+++ b/workflow-recipes/src/k8sClient.test.ts
@@ -218,11 +218,13 @@ describe('shouldPatchRecipeStatus', () => {
...(conditions ? { conditions } : {}),
},
})
- const steadyResult = (workflowConditions?: (typeof conflict)[]) => ({
+ const steadyResult = (networkPolicyOwnershipConditions?: (typeof conflict)[]) => ({
phase: 'active' as const,
message: 'Workflow idle',
workloadStatuses: [],
- ...(workflowConditions !== undefined ? { workflowConditions } : {}),
+ ...(networkPolicyOwnershipConditions !== undefined
+ ? { networkPolicyOwnershipConditions }
+ : {}),
})
it('patches when the condition appears', () => {
@@ -233,7 +235,7 @@ describe('shouldPatchRecipeStatus', () => {
expect(shouldPatchRecipeStatus(steadyRecipe([conflict]), steadyResult([]))).toBe(true)
})
- it('does not patch when only lastTransitionTime differs or the result carries no conditions', () => {
+ it('does not patch when only lastTransitionTime differs or the result carries no ownership field', () => {
// Witness: the same steady pair does patch once the condition set changes.
expect(shouldPatchRecipeStatus(steadyRecipe(), steadyResult([conflict]))).toBe(true)
expect(
diff --git a/workflow-recipes/src/k8sClient.ts b/workflow-recipes/src/k8sClient.ts
index 736c524f0..2f3a9cc84 100644
--- a/workflow-recipes/src/k8sClient.ts
+++ b/workflow-recipes/src/k8sClient.ts
@@ -171,10 +171,11 @@ export function shouldPatchRecipeStatus(
return true
// A NetworkPolicy ownership conflict changes neither phase nor message, so
- // without this clause the condition would never be published or cleared.
+ // without this clause the condition would never be published or cleared. An
+ // undefined field means the pass never reached the apply, so it opens nothing.
if (
- result.workflowConditions !== undefined &&
- ownedConditionsChanged(recipe.status?.conditions, result.workflowConditions, [
+ result.networkPolicyOwnershipConditions !== undefined &&
+ ownedConditionsChanged(recipe.status?.conditions, result.networkPolicyOwnershipConditions, [
NETWORK_POLICY_OWNERSHIP_CONDITION_TYPE,
])
)
diff --git a/workflow-recipes/src/reconciler/reconciler.test.ts b/workflow-recipes/src/reconciler/reconciler.test.ts
index 4d774c046..8308b6ee3 100644
--- a/workflow-recipes/src/reconciler/reconciler.test.ts
+++ b/workflow-recipes/src/reconciler/reconciler.test.ts
@@ -1509,7 +1509,7 @@ describe('WorkflowRecipeReconciler', () => {
expect(sdkOnly).toHaveBeenCalledTimes(1)
expect(result.phase).toBe('active')
- expect(result.workflowConditions).toEqual([
+ expect(result.networkPolicyOwnershipConditions).toEqual([
expect.objectContaining({
type: 'WorkflowNetworkPolicyOwnership',
status: 'False',
@@ -1533,10 +1533,13 @@ describe('WorkflowRecipeReconciler', () => {
expect(sdkOnly).toHaveBeenCalledTimes(1)
expect(result.phase).toBe('active')
- expect(result.workflowConditions).toEqual([])
+ expect(result.networkPolicyOwnershipConditions).toEqual([])
})
- it('carries the existing condition forward when the eager host fails before applying', async () => {
+ // `failed` can return before the apply, so the pass cannot say whether the
+ // conflict is gone. The field stays undefined and patchStatus keeps the
+ // published condition (see the patchStatus describe for the merge side).
+ it('leaves the ownership field undefined when the eager host fails before applying', async () => {
const sdkOnly = stubSdkOnly({
phase: 'failed',
message: 'Plugin Workload SDK promptBridge has no resolvable agent',
@@ -1547,7 +1550,8 @@ describe('WorkflowRecipeReconciler', () => {
expect(sdkOnly).toHaveBeenCalledTimes(1)
expect(result.phase).toBe('failed')
- expect(result.workflowConditions).toEqual([ownershipCondition])
+ expect(result.message).toBe('Plugin Workload SDK promptBridge has no resolvable agent')
+ expect(result).not.toHaveProperty('networkPolicyOwnershipConditions')
})
// A policy being deleted is retried on the transient path. The twin with
@@ -1567,7 +1571,7 @@ describe('WorkflowRecipeReconciler', () => {
expect(retrying.phase).toBe('active')
expect(retrying.requeueAfterMs).toBe(TRANSIENT_REQUEUE_BASE_MS)
expect(retrying.requeueFixedInterval).toBe(false)
- expect(retrying.workflowConditions).toEqual([])
+ expect(retrying.networkPolicyOwnershipConditions).toEqual([])
const settled = stubSdkOnly({
phase: 'active',
@@ -4236,36 +4240,88 @@ describe('WorkflowRecipeReconciler', () => {
])
})
- it('patchStatus removes the NetworkPolicy ownership condition when the owned set is empty', async () => {
- const r = makeRecipe({
- status: {
+ describe('patchStatus and the NetworkPolicy ownership condition', () => {
+ const egressReady = {
+ type: 'ExternalEgressReady',
+ status: 'True' as const,
+ lastTransitionTime: 'old',
+ }
+ const ownershipConflict = {
+ type: 'WorkflowNetworkPolicyOwnership',
+ status: 'False' as const,
+ reason: 'OwnershipConflict',
+ message:
+ 'NetworkPolicy ownership conflict: test-recipe-coord-to-wrc (owner-reference-mismatch)',
+ lastTransitionTime: 'old',
+ }
+ const recipeWithConflict = () =>
+ makeRecipe({
+ status: { phase: 'active', conditions: [egressReady, ownershipConflict] },
+ })
+ const patchedConditions = () => {
+ expect(mockCustomApi.patchNamespacedCustomObjectStatus).toHaveBeenCalledTimes(1)
+ return mockCustomApi.patchNamespacedCustomObjectStatus.mock.calls[0][0].body.status.conditions
+ }
+
+ it('keeps the condition when the result does not carry the ownership field', async () => {
+ // A pass that returns before applying the policies (in-progress short
+ // circuit, degraded retry, preflight) still patches status when the
+ // phase or message changes. The conflict is still live, so the
+ // condition and its lastTransitionTime must survive that patch.
+ await reconciler.patchStatus(recipeWithConflict(), {
+ phase: 'degraded',
+ message: 'Waiting for the workflow run',
+ workloadStatuses: [],
+ })
+
+ const patch = mockCustomApi.patchNamespacedCustomObjectStatus.mock.calls[0]?.[0].body
+ expect(patch?.status.phase).toBe('degraded')
+ expect(patchedConditions() ?? [egressReady, ownershipConflict]).toEqual([
+ egressReady,
+ ownershipConflict,
+ ])
+ })
+
+ it('keeps the condition when only the workflow-output conditions are cleared', async () => {
+ await reconciler.patchStatus(recipeWithConflict(), {
phase: 'active',
- conditions: [
- { type: 'ExternalEgressReady', status: 'True', lastTransitionTime: 'old' },
- {
- type: 'WorkflowNetworkPolicyOwnership',
- status: 'False',
- reason: 'OwnershipConflict',
- message:
- 'NetworkPolicy ownership conflict: test-recipe-coord-to-wrc (owner-reference-mismatch)',
- lastTransitionTime: 'old',
- },
- ],
- },
+ message: 'All workloads deployed',
+ workloadStatuses: [],
+ workflowConditions: [],
+ })
+
+ expect(patchedConditions() ?? [egressReady, ownershipConflict]).toEqual([
+ egressReady,
+ ownershipConflict,
+ ])
})
- await reconciler.patchStatus(r, {
- phase: 'active',
- message: 'All workloads deployed',
- workloadStatuses: [],
- workflowConditions: [],
+ it('removes the condition when the owned set is empty', async () => {
+ await reconciler.patchStatus(recipeWithConflict(), {
+ phase: 'active',
+ message: 'All workloads deployed',
+ workloadStatuses: [],
+ networkPolicyOwnershipConditions: [],
+ })
+
+ expect(patchedConditions()).toEqual([egressReady])
})
- expect(mockCustomApi.patchNamespacedCustomObjectStatus).toHaveBeenCalledTimes(1)
- const patch = mockCustomApi.patchNamespacedCustomObjectStatus.mock.calls[0][0].body
- expect(patch.status.conditions).toEqual([
- { type: 'ExternalEgressReady', status: 'True', lastTransitionTime: 'old' },
- ])
+ it('replaces the condition with the fresh one', async () => {
+ const fresh = {
+ ...ownershipConflict,
+ message:
+ 'NetworkPolicy ownership conflict: test-recipe-snippet-runner-egress (owner-reference-mismatch)',
+ }
+ await reconciler.patchStatus(recipeWithConflict(), {
+ phase: 'active',
+ message: 'All workloads deployed',
+ workloadStatuses: [],
+ networkPolicyOwnershipConditions: [fresh],
+ })
+
+ expect(patchedConditions()).toEqual([egressReady, fresh])
+ })
})
it('replaces and clears the SDK provider-unavailable condition on recovery', async () => {
@@ -9395,7 +9451,7 @@ describe('WorkflowRecipeReconciler', () => {
phase: 'active',
message: 'Workflow running',
workflowPhase: 'running',
- workflowConditions: [conflict],
+ networkPolicyOwnershipConditions: [conflict],
})
;(
reconciler as unknown as {
@@ -9417,7 +9473,7 @@ describe('WorkflowRecipeReconciler', () => {
const result = await reconciler.reconcile(recipe)
expect(workflowReconcile).toHaveBeenCalledTimes(1)
- expect(result.workflowConditions).toEqual([conflict])
+ expect(result.networkPolicyOwnershipConditions).toEqual([conflict])
expect(result.requeueAfterMs).toBeUndefined()
})
diff --git a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
index 76161d6b7..2740d830c 100644
--- a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
+++ b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
@@ -63,11 +63,11 @@ import { HttpPluginWorkloadSdkRevocationClient } from '../workflow/pluginWorkloa
import { deriveWorkflowRuntimePlan } from '../workflow/runtimePlan'
import { validateWorkflowRecipeLimits } from '../workflow/workflowLimits'
import {
+ NETWORK_POLICY_OWNERSHIP_CONDITION_TYPES,
WORKFLOW_OUTPUT_CONDITION_TYPES,
WorkflowReconciler,
WorkflowReconcilerDeps,
buildNetworkPolicyOwnershipConditions,
- carriedNetworkPolicyOwnershipConditions,
} from '../workflow/workflowReconciler'
import { evaluateComputedValues } from './computedValuesEvaluator'
import { CRD_GROUP, CRD_VERSION, WORKFLOWRECIPE_PLURAL } from './crdConstants'
@@ -632,6 +632,12 @@ export interface ReconcileResult {
workloadConditions?: StatusCondition[]
/** Undefined preserves admission state; [] clears it only after a full admission check. */
transportNetworkConditions?: StatusCondition[]
+ /**
+ * `WorkflowNetworkPolicyOwnership` from this pass's policy apply. Undefined
+ * keeps the published condition (the pass never reached the apply); `[]`
+ * removes it (every policy converged, or the lane manages none).
+ */
+ networkPolicyOwnershipConditions?: StatusCondition[]
/** SDK-only eager-host provider health, kept separate from workflow phase. */
pluginWorkloadSdkProviderUnavailable?: boolean
/** SDK host identity is ready, but an operator prompt policy is not active yet. */
@@ -2239,6 +2245,7 @@ export class WorkflowRecipeReconciler {
workflowPhase: result.workflowPhase,
clearWorkflowExecution: result.clearWorkflowExecution,
workflowConditions: result.workflowConditions,
+ networkPolicyOwnershipConditions: result.networkPolicyOwnershipConditions,
workloadConditions: workflowWorkloadConditions,
transportNetworkConditions: workflowTransportNetworkConditions,
pluginWorkloadSdkBootstrapProof: result.pluginWorkloadSdkBootstrapProof,
@@ -2890,8 +2897,8 @@ export class WorkflowRecipeReconciler {
secretOwnershipConditions: secretOwnership.conditions,
workloadConditions,
transportNetworkConditions: [],
- // `failed` can return before the policy apply; keep what was published.
- workflowConditions: carriedNetworkPolicyOwnershipConditions(recipe.status?.conditions),
+ // `failed` can return before the policy apply, so the ownership
+ // field stays undefined and patchStatus keeps what was published.
}
}
@@ -2945,13 +2952,15 @@ export class WorkflowRecipeReconciler {
secretOwnershipConditions: secretOwnership.conditions,
workloadConditions,
transportNetworkConditions: [],
- workflowConditions: sdkOnlyRuntime
+ // Without an SDK runtime this lane manages no policies, so a condition
+ // published by an earlier pass is stale and `[]` removes it.
+ networkPolicyOwnershipConditions: sdkOnlyRuntime
? buildNetworkPolicyOwnershipConditions(
sdkOnlyRuntime.networkPolicies,
new Date().toISOString(),
recipe.status?.conditions
)
- : undefined,
+ : [],
pluginWorkloadSdkProviderUnavailable: sdkOnlyProviderUnavailable,
pluginWorkloadSdkPolicyPending: sdkOnlyPolicyPending,
pluginWorkloadSdkBootstrapProof: sdkOnlyRuntime?.pluginWorkloadSdkBootstrapProof,
@@ -7601,6 +7610,16 @@ export class WorkflowRecipeReconciler {
result.transportNetworkConditions,
TRANSPORT_NETWORK_CONDITION_TYPES
)
+ // A pass that never reached the NetworkPolicy apply cannot say whether a
+ // conflict is gone, so undefined keeps the published condition.
+ const networkPolicyOwnershipMergedConditions =
+ result.networkPolicyOwnershipConditions === undefined
+ ? undefined
+ : mergeOwnedConditions(
+ transportNetworkMergedConditions ?? priorTransportConditions,
+ result.networkPolicyOwnershipConditions,
+ NETWORK_POLICY_OWNERSHIP_CONDITION_TYPES
+ )
// Plugin Workload SDK conditions are derived so every status patch carries a
// consistent projection of spec.pluginWorkloadSdk + feature flag, while the
// SDK-only provider health bit is propagated explicitly through
@@ -7612,7 +7631,8 @@ export class WorkflowRecipeReconciler {
const pluginSdkProjection =
result.pluginWorkloadSdkProjection ?? this.projectPluginWorkloadSdk(recipe, result, now)
const pluginSdkMergedConditions = mergePluginWorkloadSdkConditions(
- transportNetworkMergedConditions ??
+ networkPolicyOwnershipMergedConditions ??
+ transportNetworkMergedConditions ??
workloadReconcileMergedConditions ??
secretOwnershipMergedConditions ??
internalDependencyMergedConditions ??
@@ -7623,6 +7643,7 @@ export class WorkflowRecipeReconciler {
)
const mergedConditions =
pluginSdkMergedConditions ??
+ networkPolicyOwnershipMergedConditions ??
transportNetworkMergedConditions ??
workloadReconcileMergedConditions ??
secretOwnershipMergedConditions ??
diff --git a/workflow-recipes/src/workflow/workflowReconciler.test.ts b/workflow-recipes/src/workflow/workflowReconciler.test.ts
index a7065dceb..a9832e89b 100644
--- a/workflow-recipes/src/workflow/workflowReconciler.test.ts
+++ b/workflow-recipes/src/workflow/workflowReconciler.test.ts
@@ -1713,15 +1713,21 @@ describe('WorkflowReconciler — Plugin Workload SDK eager mcp-host', () => {
expect(createdNames()).toContain('sdk-recipe-workload-to-mcp-host-sdk-egress')
expect(first.phase).not.toBe('failed')
expect(first.workflowPhase).not.toBe('failed')
- expect(ownershipCondition(first.workflowConditions)).toMatchObject({
- status: 'False',
- reason: 'OwnershipConflict',
- message: expect.stringContaining(foreignName),
- })
+ expect(first.networkPolicyOwnershipConditions).toEqual([
+ expect.objectContaining({
+ type: 'WorkflowNetworkPolicyOwnership',
+ status: 'False',
+ reason: 'OwnershipConflict',
+ message: expect.stringContaining(foreignName),
+ }),
+ ])
+ // The condition travels only in its own field, never with the
+ // workflow-output conditions that patchStatus merges separately.
+ expect(ownershipCondition(first.workflowConditions)).toBeUndefined()
expect(writesTo(foreignName)).toHaveLength(0)
- // The foreign owner goes away: the policy is created and the condition
- // is dropped from the owned set, so patchStatus removes it.
+ // The foreign owner goes away: the policy is created and the owned set
+ // is empty, so patchStatus removes the condition.
mockNetworkingApi.readNamespacedNetworkPolicy.mockRejectedValue({ code: 404 })
mockNetworkingApi.createNamespacedNetworkPolicy.mockClear()
const second = await reconciler.reconcile(
@@ -1729,18 +1735,22 @@ describe('WorkflowReconciler — Plugin Workload SDK eager mcp-host', () => {
'uid-sdk',
sandboxNamespace,
sdkSpec(),
- { workflowExecution: { phase: 'initializing' }, conditions: first.workflowConditions },
+ {
+ workflowExecution: { phase: 'initializing' },
+ conditions: first.networkPolicyOwnershipConditions,
+ },
undefined,
'sdk-recipe',
undefined
)
expect(createdNames()).toContain(foreignName)
- expect(second.workflowConditions).toBeDefined()
- expect(ownershipCondition(second.workflowConditions)).toBeUndefined()
+ expect(second.networkPolicyOwnershipConditions).toEqual([])
})
- it('workflow lane keeps the existing condition when the eager host fails before applying', async () => {
+ // The pass never reached the apply, so it cannot say whether the conflict is
+ // gone. The field stays undefined and patchStatus keeps the published one.
+ it('workflow lane leaves the ownership field undefined when the eager host fails before applying', async () => {
const reconciler = new WorkflowReconciler(makeDeps())
const provisioner = (
reconciler as unknown as {
@@ -1772,7 +1782,8 @@ describe('WorkflowReconciler — Plugin Workload SDK eager mcp-host', () => {
expect(ensure).toHaveBeenCalledTimes(1)
expect(result.phase).toBe('failed')
- expect(ownershipCondition(result.workflowConditions)).toEqual(existing)
+ expect(result).not.toHaveProperty('networkPolicyOwnershipConditions')
+ expect(ownershipCondition(result.workflowConditions)).toBeUndefined()
})
})
diff --git a/workflow-recipes/src/workflow/workflowReconciler.ts b/workflow-recipes/src/workflow/workflowReconciler.ts
index 181592bd7..eee85caa7 100644
--- a/workflow-recipes/src/workflow/workflowReconciler.ts
+++ b/workflow-recipes/src/workflow/workflowReconciler.ts
@@ -246,20 +246,28 @@ export interface PluginWorkloadSdkCleanupOptions {
export const NETWORK_POLICY_OWNERSHIP_CONDITION_TYPE = 'WorkflowNetworkPolicyOwnership'
+/**
+ * Merged by its own group in `patchStatus`, apart from the workflow-output
+ * group: a pass that never reached the policy apply leaves the field
+ * undefined, and the published condition must survive that pass's patch.
+ */
+export const NETWORK_POLICY_OWNERSHIP_CONDITION_TYPES = new Set([
+ NETWORK_POLICY_OWNERSHIP_CONDITION_TYPE,
+])
+
export const WORKFLOW_OUTPUT_CONDITION_TYPES = new Set([
'WorkflowOutputRwoCompatibility',
'WorkflowOutputWrcManagedLifecycle',
'WorkflowOutputPrepareGate',
'WorkflowOutputExternalClaim',
'WorkflowOutputLegacyGlobalClaim',
- NETWORK_POLICY_OWNERSHIP_CONDITION_TYPE,
])
/**
* The ownership condition for one policy apply pass: `False` naming every
- * policy another controller owns, or none when every policy converged. The
- * type is in `WORKFLOW_OUTPUT_CONDITION_TYPES`, so an empty result removes a
- * previously published condition.
+ * policy another controller owns, or `[]` when every policy converged. The
+ * result goes in `networkPolicyOwnershipConditions`, where `[]` removes a
+ * previously published condition and `undefined` keeps it.
*/
export function buildNetworkPolicyOwnershipConditions(
summary: WorkflowNetworkPolicyApplySummary,
@@ -285,17 +293,6 @@ export function buildNetworkPolicyOwnershipConditions(
]
}
-/**
- * The ownership condition as last published. A pass that returns before it
- * applies the policies re-emits it, because a patch that carries owned
- * conditions without it would remove it.
- */
-export function carriedNetworkPolicyOwnershipConditions(
- existingConditions?: StatusCondition[]
-): StatusCondition[] {
- return (existingConditions ?? []).filter(c => c.type === NETWORK_POLICY_OWNERSHIP_CONDITION_TYPE)
-}
-
interface CoordinatorTokenRefreshOptions {
includeMcpHostToken?: boolean
useCustomCoordinatorWrcToken?: boolean
@@ -806,6 +803,12 @@ export interface WorkflowReconcileResult {
workflowPhase?: WorkflowPhase
clearWorkflowExecution?: boolean
workflowConditions?: StatusCondition[]
+ /**
+ * The `WorkflowNetworkPolicyOwnership` condition from this pass's policy
+ * apply. Undefined when the pass returned before the apply, which keeps the
+ * published condition; `[]` when every policy converged, which removes it.
+ */
+ networkPolicyOwnershipConditions?: StatusCondition[]
/**
* Set when a transient K8s API blip aborted reconcile: the caller must NOT
* patch the CRD status (preserve the current execution state) and should
@@ -1648,15 +1651,17 @@ export class WorkflowReconciler {
new Date().toISOString(),
currentStatus?.conditions
)
- // Carried until this pass applies the policies, then replaced by what the
- // apply found. A return before the apply keeps the published condition.
- let networkPolicyOwnershipConditions = carriedNetworkPolicyOwnershipConditions(
- currentStatus?.conditions
- )
+ // Undefined until this pass applies the policies, then what the apply
+ // found. A return before the apply leaves it undefined, and patchStatus
+ // keeps the published condition.
+ let networkPolicyOwnershipConditions: StatusCondition[] | undefined
let networkPolicyRetryPending = false
const withWorkflowConditions = (result: WorkflowReconcileResult): WorkflowReconcileResult => ({
...result,
- workflowConditions: [...workflowConditions, ...networkPolicyOwnershipConditions],
+ workflowConditions,
+ ...(networkPolicyOwnershipConditions !== undefined
+ ? { networkPolicyOwnershipConditions }
+ : {}),
...(networkPolicyRetryPending ? { networkPolicyRetryPending } : {}),
})
const outputAnchorPodName = runtime.output.anchorRequired
@@ -1824,13 +1829,13 @@ export class WorkflowReconciler {
// "still booting".
const providerUnavailableMessage = `Plugin Workload SDK mcp-host provider unavailable: /configure failed repeatedly (${classification})`
return {
- phase: 'active',
- message: providerUnavailableMessage,
- clearWorkflowExecution: true,
- ...(networkPolicyRetryPending ? { networkPolicyRetryPending } : {}),
+ ...withWorkflowConditions({
+ phase: 'active',
+ message: providerUnavailableMessage,
+ clearWorkflowExecution: true,
+ }),
workflowConditions: [
...workflowConditions,
- ...networkPolicyOwnershipConditions,
buildStatusCondition(
'PluginWorkloadSdkProviderUnavailable',
'EagerConfigureFailed',
diff --git a/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts b/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts
index 732dd443f..efa2e1f79 100644
--- a/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts
+++ b/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts
@@ -3198,15 +3198,14 @@ describe('WorkflowReconciler — reconcile loop', () => {
expect(readPolicyNames(api)).toEqual(expectedNames)
expect(second.phase).not.toBe('failed')
expect(second.workflowPhase).not.toBe('failed')
- expect(
- second.workflowConditions?.find(
- condition => condition.type === 'WorkflowNetworkPolicyOwnership'
- )
- ).toMatchObject({
- status: 'False',
- reason: 'OwnershipConflict',
- message: expect.stringContaining('test-wf-coord-to-wrc'),
- })
+ expect(second.networkPolicyOwnershipConditions).toEqual([
+ expect.objectContaining({
+ type: 'WorkflowNetworkPolicyOwnership',
+ status: 'False',
+ reason: 'OwnershipConflict',
+ message: expect.stringContaining('test-wf-coord-to-wrc'),
+ }),
+ ])
expect(
api.replaceNamespacedNetworkPolicy.mock.calls.filter(
([arg]) => arg.name === 'test-wf-coord-to-wrc'
@@ -3244,11 +3243,9 @@ describe('WorkflowReconciler — reconcile loop', () => {
expect(second.networkPolicyRetryPending).toBe(true)
expect(second.phase).not.toBe('failed')
expect(second.workflowPhase).not.toBe('failed')
- expect(
- second.workflowConditions?.find(
- condition => condition.type === 'WorkflowNetworkPolicyOwnership'
- )
- ).toBeUndefined()
+ // A policy being deleted is not a conflict: the pass reached the apply
+ // and found none, so the owned set is empty rather than absent.
+ expect(second.networkPolicyOwnershipConditions).toEqual([])
expect(
api.replaceNamespacedNetworkPolicy.mock.calls.filter(
([arg]) => arg.name === 'test-wf-coord-to-wrc'