Skip to content

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

TypeScript

refactor(wrc): name the NetworkPolicy conflict reason once

Alfredo Lopez31700b7360ae
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index f1e0f7720..9ea1a300f 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.391",
+ "version": "0.1.392",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.391",
+ "version": "0.1.392",
"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 634b901f2..45f3f5be6 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.391",
+ "version": "0.1.392",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/reconciler/networkPolicyConvergence.ts b/workflow-recipes/src/reconciler/networkPolicyConvergence.ts
index 2a7096498..c6b353714 100644
--- a/workflow-recipes/src/reconciler/networkPolicyConvergence.ts
+++ b/workflow-recipes/src/reconciler/networkPolicyConvergence.ts
@@ -14,30 +14,23 @@ export type NetworkPolicyFamily =
| 'oauth-broker-egress'
| 'webhook-gateway'
+/** Why a live NetworkPolicy belongs to another owner and is left untouched. */
+export type NetworkPolicyConflictReason =
+ | 'desired-owner-uid-missing'
+ | 'identity-label-mismatch'
+ | 'controller-owner-mismatch'
+ | 'owner-reference-mismatch'
+
export type NetworkPolicyOwnershipDecision =
| { kind: 'owned' }
| { kind: 'repairable-owner' }
- | {
- kind: 'conflict'
- reason:
- | 'desired-owner-uid-missing'
- | 'identity-label-mismatch'
- | 'controller-owner-mismatch'
- | 'owner-reference-mismatch'
- }
+ | { kind: 'conflict'; reason: NetworkPolicyConflictReason }
export type NetworkPolicyConvergenceDecision =
| { action: 'unchanged' }
| { action: 'replace'; reason: 'live-drift' | 'owner-repair' }
| { action: 'retry'; reason: 'terminating' }
- | {
- action: 'conflict'
- reason:
- | 'desired-owner-uid-missing'
- | 'identity-label-mismatch'
- | 'controller-owner-mismatch'
- | 'owner-reference-mismatch'
- }
+ | { action: 'conflict'; reason: NetworkPolicyConflictReason }
const GATEWAY_IDENTITY_LABELS = [
'clerum.io/managed-by',
diff --git a/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts b/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts
index c729b8b16..764b5c1c7 100644
--- a/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts
+++ b/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts
@@ -2,6 +2,7 @@ import * as k8s from '@kubernetes/client-node'
import { randomBytes } from 'node:crypto'
import { type Logger, createLogger } from '../observability/logger'
import { getErrorCode } from '../reconciler/k8sErrors'
+import type { NetworkPolicyConflictReason } from '../reconciler/networkPolicyConvergence'
import { effectiveWorkflowContextRefForSpec } from '../reconciler/workflowContext'
import type { WorkflowRecipeSpec } from '../types'
import { resolveEagerSdkMcpHostAgent } from './agentResolution'
@@ -56,7 +57,7 @@ export type EagerSdkMcpHostStatus =
* twice.
*/
export type WorkflowNetworkPolicyApplySummary = {
- conflicts: { policy: string; reason: string }[]
+ conflicts: { policy: string; reason: NetworkPolicyConflictReason }[]
retryPending: boolean
}
diff --git a/workflow-recipes/src/workflow/workflowReconciler.ts b/workflow-recipes/src/workflow/workflowReconciler.ts
index 52c051c4f..18c81ccfe 100644
--- a/workflow-recipes/src/workflow/workflowReconciler.ts
+++ b/workflow-recipes/src/workflow/workflowReconciler.ts
@@ -32,6 +32,7 @@ import {
isRetryableInfraError,
} from '../reconciler/k8sErrors'
import {
+ type NetworkPolicyConflictReason,
type NetworkPolicyConvergenceDecision,
buildNetworkPolicyReplacement,
classifyOwnerlessNetworkPolicyOwnership,
@@ -218,11 +219,7 @@ type RunLaneNetworkPolicyApplyResult =
action: 'retry'
reason: 'terminating' | 'absent-after-write-conflict' | 'replace-conflicted-twice'
}
- | {
- policy: string
- action: 'conflict'
- reason: Extract<NetworkPolicyConvergenceDecision, { action: 'conflict' }>['reason']
- }
+ | { policy: string; action: 'conflict'; reason: NetworkPolicyConflictReason }
const MCP_HOST_READINESS_WAIT_TIMEOUT_MS = 4 * 60_000
const DNS_SUBDOMAIN_RE =
/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/