Skip to content

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

TypeScript

fix(egress): judge the live policy by rebuild, not by another projection

Alfredo Lopez91791768e6a9
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index acfde797a..4317836a5 100644
--- a/host-context-controller/package-lock.json
+++ b/host-context-controller/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.294",
+ "version": "0.1.295",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.294",
+ "version": "0.1.295",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@clerum/codex-catalog-projection": "file:../packages/codex-catalog-projection",
diff --git a/host-context-controller/package.json b/host-context-controller/package.json
index 7e3e6e342..a8980c5b6 100644
--- a/host-context-controller/package.json
+++ b/host-context-controller/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.294",
+ "version": "0.1.295",
"description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API",
"main": "dist/main.js",
"engines": {
diff --git a/host-context-controller/src/networkPolicyReconciler.egressClassification.test.ts b/host-context-controller/src/networkPolicyReconciler.egressClassification.test.ts
index 16712cadb..cc4bc902f 100644
--- a/host-context-controller/src/networkPolicyReconciler.egressClassification.test.ts
+++ b/host-context-controller/src/networkPolicyReconciler.egressClassification.test.ts
@@ -139,8 +139,11 @@ describe('#513: a non-DNS exception inside the resolve block is not a DNS condit
})
/** Bootstrap a written policy, then re-serve it with the window optionally lapsed. */
- async function seedAccumulatedPolicy(opts: { lapsed: boolean }): Promise<void> {
- await reconciler.reconcileExternalEgress(server, { isCurrent: () => true })
+ async function seedAccumulatedPolicy(opts: {
+ lapsed: boolean
+ srv?: McpServerCRD
+ }): Promise<void> {
+ await reconciler.reconcileExternalEgress(opts.srv ?? server, { isCurrent: () => true })
const written = (
mockApi.createNamespacedNetworkPolicy.mock.calls[0][0] as { body: k8s.V1NetworkPolicy }
).body
@@ -556,6 +559,211 @@ describe('#513: a non-DNS exception inside the resolve block is not a DNS condit
expect(served).toContain('1.2.3.4')
})
+ /** The live policy the fixture seeded, cloned and handed to a drift mutation. */
+ async function driftLivePolicy(mutate: (spec: k8s.V1NetworkPolicySpec) => void): Promise<string> {
+ const items = (await mockApi.listNamespacedNetworkPolicy({ namespace: 'mcp-server' })) as {
+ items: Array<{ metadata?: { name?: string }; spec?: k8s.V1NetworkPolicySpec }>
+ }
+ const drifted = JSON.parse(JSON.stringify(items)) as typeof items
+ mutate(drifted.items[0].spec!)
+ mockApi.listNamespacedNetworkPolicy.mockResolvedValue(drifted)
+ return drifted.items[0].metadata!.name!
+ }
+
+ /** Everything the status wrote, as one string — what the operator ends up seeing. */
+ function servedPayload(): string {
+ return JSON.stringify(
+ mockCustomApi.patchNamespacedCustomObjectStatus.mock.calls.map(
+ (call: unknown[]) => (call[0] as { body?: unknown } | undefined)?.body
+ )
+ )
+ }
+
+ it('T11d revokes a policy that grew an egress rule with no `to` (allow-all)', async () => {
+ // Review of #567 round 2, R2-H1. The same defect as #590, one level up.
+ //
+ // #590 fixed the PEER projection: a `to[]` entry that was not an ipBlock
+ // stopped vanishing before the comparison. This is the RULE projection.
+ // `flatMap(rule => rule.to ?? [])` gives a rule with NO `to` exactly zero
+ // peers, so it contributes nothing to `enforced`, nothing to `every`, and the
+ // length comparison went back to being 0 === 0 — a number compared with
+ // itself, which is the shape of all three findings in this class.
+ //
+ // And it was the worst member of the class to miss. An egress rule with no
+ // `to` means allow-all destinations. Under the namespace L0 deny-all the
+ // served pod kept egress to EVERY destination on that port for as long as the
+ // fault repeated, and the `continue` skips the rewrite, so nothing healed it.
+ await seedAccumulatedPolicy({ lapsed: false })
+ const policyName = await driftLivePolicy(spec => {
+ spec.egress!.push({ ports: [{ port: 53, protocol: 'UDP' }] })
+ })
+ injectPostResolutionTypeError()
+
+ // Liveness witness: the fault branch ran and blocked. Without it, "the
+ // allow-all is not enforced" is satisfied by a pass that never got here.
+ await expect(
+ reconciler.reconcileExternalEgress(server, { isCurrent: () => true })
+ ).rejects.toThrow(TypeError)
+
+ expect(mockApi.deleteNamespacedNetworkPolicy).toHaveBeenCalledWith(
+ expect.objectContaining({ name: policyName })
+ )
+ const egress = statusConditions().filter(c => c.type === 'ExternalEgressReady')
+ expect(egress.at(-1)?.reason).toBe('ExternalEgressReconcileFailed')
+ // The CIDRs were all fine; it is the SHAPE that is not one we write, and the
+ // operator message has to say which of the two it was.
+ expect(egress.at(-1)?.message).toContain('REVOKED')
+ expect(egress.at(-1)?.message).toContain('shape')
+ expect(egress.at(-1)?.message).not.toContain('left untouched')
+ // Nothing untrustworthy is published as the resolution of the hostname.
+ expect(servedPayload()).not.toContain('1.2.3.4')
+ })
+
+ it('T11e revokes a policy whose `ports` were widened out-of-band', async () => {
+ // R2-M1, same root as T11d and the same fix. Dropping the `ports` block from
+ // a rule means every port, not just the one the binding declared. The old
+ // verdict never looked at `ports` at all, so a policy whose `to` was still the
+ // correct /32 stayed enforced with the widened ports while the fault repeated.
+ //
+ // On the merge-base this same input self-healed: the fault was laundered into
+ // the permanent branch, which rebuilt from `binding.port` and rewrote it. So,
+ // like T11, this is an input #567 made strictly worse.
+ await seedAccumulatedPolicy({ lapsed: false })
+ const policyName = await driftLivePolicy(spec => {
+ delete spec.egress![0]!.ports
+ })
+ injectPostResolutionTypeError()
+
+ await expect(
+ reconciler.reconcileExternalEgress(server, { isCurrent: () => true })
+ ).rejects.toThrow(TypeError)
+
+ expect(mockApi.deleteNamespacedNetworkPolicy).toHaveBeenCalledWith(
+ expect.objectContaining({ name: policyName })
+ )
+ const egress = statusConditions().filter(c => c.type === 'ExternalEgressReady')
+ expect(egress.at(-1)?.message).toContain('REVOKED')
+ expect(servedPayload()).not.toContain('1.2.3.4')
+ })
+
+ // Every remaining dimension of the shape, in one table. The point of judging by
+ // rebuild-and-compare rather than by predicate is that no dimension needs its
+ // own arm — so the table is the evidence for that claim, not decoration. Each
+ // row dies to replacing `sameNetworkPolicySpec(...)` with `true`; the
+ // podSelector, policyTypes and ingress rows additionally die to a verdict that
+ // compares only `spec.egress`.
+ const shapeDrifts: Array<[string, (spec: k8s.V1NetworkPolicySpec) => void]> = [
+ ['a changed port', spec => void (spec.egress![0]!.ports = [{ port: 80, protocol: 'TCP' }])],
+ [
+ 'an added endPort range',
+ spec => void (spec.egress![0]!.ports = [{ port: 443, protocol: 'TCP', endPort: 8443 }]),
+ ],
+ [
+ 'a changed protocol',
+ spec => void (spec.egress![0]!.ports = [{ port: 443, protocol: 'UDP' }]),
+ ],
+ ['a widened policyTypes', spec => void (spec.policyTypes = ['Egress', 'Ingress'])],
+ ['an emptied podSelector', spec => void (spec.podSelector = {})],
+ [
+ 'a podSelector pointing at another server',
+ spec => void (spec.podSelector = { matchLabels: { 'clerum.io/mcpserver': 'other-mcp' } }),
+ ],
+ [
+ 'an ipBlock.except carve-out',
+ spec => void (spec.egress![0]!.to![0]!.ipBlock!.except = ['1.2.3.0/30']),
+ ],
+ [
+ 'two ipBlocks folded into one rule',
+ spec => void spec.egress![0]!.to!.push({ ipBlock: { cidr: '5.6.7.8/32' } }),
+ ],
+ ['an added ingress rule', spec => void (spec.ingress = [{}])],
+ ]
+
+ it.each(shapeDrifts)('T11f revokes a policy with %s', async (_label, mutate) => {
+ await seedAccumulatedPolicy({ lapsed: false })
+ const policyName = await driftLivePolicy(mutate)
+ injectPostResolutionTypeError()
+
+ await expect(
+ reconciler.reconcileExternalEgress(server, { isCurrent: () => true })
+ ).rejects.toThrow(TypeError)
+
+ expect(mockApi.deleteNamespacedNetworkPolicy).toHaveBeenCalledWith(
+ expect.objectContaining({ name: policyName })
+ )
+ expect(
+ statusConditions()
+ .filter(c => c.type === 'ExternalEgressReady')
+ .at(-1)?.message
+ ).toContain('REVOKED')
+ })
+
+ it('T11g still serves a clean multi-CIDR UDP binding — the shape check reads the binding', async () => {
+ // Anti-over-correction, the half T11c cannot cover. T11c serves ONE /32 on the
+ // default TCP/443 binding, so a verdict that rebuilt the shape with a
+ // hardcoded TCP, a hardcoded port, or only the first CIDR would still satisfy
+ // it. This binding is UDP and resolves to two addresses, so the rebuild has to
+ // read `binding.protocol`, `binding.port` and the whole live CIDR list to
+ // agree with what the controller actually wrote.
+ //
+ // Over-correction is the real risk of this change: a comparator stricter than
+ // what the controller writes revokes legitimate policies, which is an egress
+ // outage — worse than the bug it closes.
+ const udpServer: McpServerCRD = {
+ ...server,
+ spec: {
+ ...server.spec,
+ egressBindings: [{ dns: 'api.example.com', port: 53, protocol: 'UDP' }],
+ },
+ }
+ resolve4Mock.mockResolvedValue(rec('1.2.3.4', '9.9.9.9'))
+ await seedAccumulatedPolicy({ lapsed: false, srv: udpServer })
+ injectPostResolutionTypeError()
+
+ // Fail-static in one assertion: a fault WITH something trustworthy to serve
+ // completes instead of throwing. It is also the liveness witness — the pass
+ // reached the fault branch and chose to serve, rather than never faulting.
+ await expect(
+ reconciler.reconcileExternalEgress(udpServer, { isCurrent: () => true })
+ ).resolves.toBeUndefined()
+
+ // Both accumulated addresses are still served, so a rebuild that kept only the
+ // first CIDR fails here rather than passing quietly.
+ const served = servedPayload()
+ expect(served).toContain('1.2.3.4')
+ expect(served).toContain('9.9.9.9')
+ expect(mockApi.deleteNamespacedNetworkPolicy).not.toHaveBeenCalled()
+ expect(
+ statusConditions()
+ .filter(c => c.type === 'ExternalEgressReady')
+ .at(-1)?.message
+ ).toContain('left untouched')
+ })
+
+ it('T11h revokes a live policy with no egress rules — a deny disguised as an allow', async () => {
+ // The emptiness trap, and the reason the verdict gates on `cidrs.length > 0`
+ // before comparing. A rebuild from an empty CIDR list produces an empty
+ // `egress`, which compares EQUAL to a live policy that has no rules — so the
+ // shape test alone would call the drift intact, report zero addresses as "what
+ // is enforced right now", and mark the pass non-blocking on the strength of a
+ // policy that allows nothing. The safety lane refuses the same shape for the
+ // same reason.
+ await seedAccumulatedPolicy({ lapsed: false })
+ const policyName = await driftLivePolicy(spec => {
+ spec.egress = []
+ })
+ injectPostResolutionTypeError()
+
+ await expect(
+ reconciler.reconcileExternalEgress(server, { isCurrent: () => true })
+ ).rejects.toThrow(TypeError)
+
+ expect(mockApi.deleteNamespacedNetworkPolicy).toHaveBeenCalledWith(
+ expect.objectContaining({ name: policyName })
+ )
+ expect(servedPayload()).not.toContain('1.2.3.4')
+ })
+
it('T8 still throws on a fault with nothing to serve (bootstrap)', async () => {
// The other half of the same decision, pinned so it cannot be lost: with no
// live policy there is no frozen set, so serving is not an option and the
@@ -566,6 +774,19 @@ describe('#513: a non-DNS exception inside the resolve block is not a DNS condit
await expect(
reconciler.reconcileExternalEgress(server, { isCurrent: () => true })
).rejects.toThrow(TypeError)
+
+ // Bootstrap is its own verdict, not a revocation, and the status has to say
+ // so. The old boolean made this case indistinguishable from "we served the
+ // accumulated set": with nothing live, `trustworthy` came out true by
+ // vacuity and the message claimed the accumulated egress was left untouched —
+ // describing an accumulation that never existed. Collapsing bootstrap back
+ // into either of the other two states is caught here rather than by the
+ // throw, which all three states share.
+ const egress = statusConditions().filter(c => c.type === 'ExternalEgressReady')
+ expect(egress.at(-1)?.reason).toBe('ExternalEgressReconcileFailed')
+ expect(egress.at(-1)?.message).toContain('no live policy to serve')
+ expect(egress.at(-1)?.message).not.toContain('REVOKED')
+ expect(egress.at(-1)?.message).not.toContain('left untouched')
})
it('T9 reports the rejected binding alongside the fault instead of dropping it', async () => {
diff --git a/host-context-controller/src/networkPolicyReconciler.ts b/host-context-controller/src/networkPolicyReconciler.ts
index 115c5af94..c5ddb82b6 100644
--- a/host-context-controller/src/networkPolicyReconciler.ts
+++ b/host-context-controller/src/networkPolicyReconciler.ts
@@ -140,6 +140,31 @@ function sameNetworkPolicySpec(
)
}
+/**
+ * The verdict on a live exact-host egress policy during a non-DNS fault.
+ * `drifted-*` is split because the operator message names the diagnosis, and
+ * "it enforced a CIDR we do not write" and "its shape is not one we write" send
+ * an operator to two different places.
+ */
+type LiveEgressVerdict =
+ | { state: 'none' }
+ | { state: 'intact'; cidrs: string[] }
+ | { state: 'drifted-shape' }
+ | { state: 'drifted-cidr' }
+
+/**
+ * What the ExternalEgressReady message says about the live policy on a non-DNS
+ * fault. One entry per verdict state so a new state cannot be added without
+ * deciding what the operator is told.
+ */
+const LIVE_EGRESS_FAULT_TEXT: Record<LiveEgressVerdict['state'], string> = {
+ none: 'no live policy to serve',
+ intact: 'accumulated egress left untouched',
+ 'drifted-cidr':
+ 'live policy REVOKED: it enforced a CIDR outside the /32 allowlist this controller writes',
+ 'drifted-shape': 'live policy REVOKED: its egress shape is not one this controller writes',
+}
+
function hasExpectedPolicyOwnership(policy: k8s.V1NetworkPolicy, policyType: string): boolean {
const labels = policy.metadata?.labels ?? {}
return labels[MANAGED_BY_LABEL] === MANAGED_BY_VALUE && labels[POLICY_TYPE_LABEL] === policyType
@@ -1815,6 +1840,70 @@ export class NetworkPolicyReconciler {
}
}
+ /**
+ * Judge a live exact-host egress policy WITHOUT resolving anything.
+ *
+ * The controller writes exactly ONE shape (buildExactHostEgressPolicy above):
+ * a podSelector on this McpServer, `policyTypes: ['Egress']`, and one rule per
+ * CIDR carrying `to: [{ipBlock:{cidr}}]` plus this binding's port/protocol. So
+ * the live object is trustworthy only if it IS that shape rebuilt with its own
+ * CIDRs — the safety lane's "modulo cidr" comparison (see the DNS arm of
+ * collectSafetyInventory) — and every one of those CIDRs is the allowed /32
+ * this controller is the only writer of.
+ *
+ * Judging the SHAPE rather than a projection of it is the point. Reviews of
+ * #567 found the same defect three times at three depths, because each fix
+ * projected the policy down to the dimension that had just failed and compared
+ * the projection with itself:
+ *
+ * - #590 R1-L1: mapping peers to `ipBlock.cidr` and filtering out the
+ * undefineds dropped a `namespaceSelector` peer BEFORE the comparison.
+ * - #590: an over-broad but non-blocked prefix (1.0.0.0/8) passed the
+ * allowlist, which only rejects overlaps with the blocked ranges.
+ * - R2-H1: `flatMap(rule => rule.to ?? [])` drops a whole RULE that has no
+ * `to`. In NetworkPolicy a rule without `to` is allow-all, so the most
+ * dangerous drift of all contributed zero peers and every peer-level
+ * predicate over it was vacuously true.
+ * - R2-M1: `ports` was never looked at, so a widened port set read as clean.
+ *
+ * A rebuild-and-compare has no dimension to miss: anything the controller does
+ * not write differs from the rebuild, whatever it happens to allow.
+ */
+ private judgeLiveExactHostEgress(
+ server: McpServerCRD,
+ name: string,
+ binding: EgressBinding,
+ existingPolicy: k8s.V1NetworkPolicy | null
+ ): LiveEgressVerdict {
+ // Bootstrap: nothing live to judge, and nothing to serve.
+ if (existingPolicy === null) return { state: 'none' }
+
+ const cidrs = (existingPolicy.spec?.egress ?? [])
+ .flatMap(rule => rule.to ?? [])
+ .map(peer => peer.ipBlock?.cidr)
+ .filter((cidr): cidr is string => typeof cidr === 'string')
+
+ // A policy with no ipBlock peers is a deny disguised as an allow, and the
+ // rebuild from an empty CIDR list would compare equal to it. Gate first, the
+ // way the safety lane does, so emptiness is never mistaken for agreement.
+ const shapeIntact =
+ cidrs.length > 0 &&
+ sameNetworkPolicySpec(
+ existingPolicy,
+ this.buildExactHostEgressPolicy(server, name, binding, cidrs)
+ )
+ // The one condition the shape cannot carry: the rebuild uses the live CIDRs,
+ // so they compare against themselves and are never validated by it.
+ const cidrsIntact = cidrs.every(
+ cidr => cidr.endsWith('/32') && isAllowedExternalEgressCidr(cidr)
+ )
+
+ if (shapeIntact && cidrsIntact) return { state: 'intact', cidrs }
+ // A bad CIDR is the more specific diagnosis and the one an operator acts on
+ // first, so it wins when a policy drifted on both axes.
+ return { state: cidrsIntact ? 'drifted-shape' : 'drifted-cidr' }
+ }
+
private async resolveExternalEgressDns(
hostname: string
): Promise<{ address: string; ttl: number }[]> {
@@ -2076,7 +2165,7 @@ export class NetworkPolicyReconciler {
dns: string
err: unknown
blocking: boolean
- revoked: boolean
+ live: LiveEgressVerdict['state']
}> = []
const resolvedAtMs = Date.now()
const resolvedAt = new Date(resolvedAtMs).toISOString()
@@ -2299,77 +2388,36 @@ export class NetworkPolicyReconciler {
// from the live object, not recomputed — recomputing is what faulted.
// Only HCC: consumers of ExternalEgressReady treat any False as
// terminal, so a dependent WRC recipe still fails (#577).
- const peers = (existingPolicy?.spec?.egress ?? []).flatMap(rule => rule.to ?? [])
- const enforced = peers
- .map(to => to.ipBlock?.cidr)
- .filter((cidr): cidr is string => typeof cidr === 'string')
- // "What is enforced right now" is only worth serving if it is also
- // allowed. This is the one path that neither re-validates nor
- // self-heals the live policy — the safety lane retains DNS policies
- // modulo cidr, and the orphan list is by label without an ownership
- // read — so a policy edited out-of-band into a private range would be
- // published as the resolution of a public hostname AND counted as
- // something to serve, keeping the pass non-blocking and the range
- // enforced on every resync. A set containing anything blocked is not
- // known-good, so none of it is served and the fault blocks.
- //
- // The verdict has to judge the policy's SHAPE, not only the CIDRs it
- // happens to expose. Projecting to `ipBlock` and filtering out
- // everything else made two drift shapes invisible, because a
- // `namespaceSelector` peer maps to `undefined` and is dropped before
- // the comparison — leaving `enforced.length` compared against itself:
- //
- // 1. an added non-ipBlock egress rule beside a valid /32
- // 2. an over-broad but non-blocked public prefix, e.g. 1.0.0.0/8
- //
- // Both read as clean, were served, and were published in
- // `status.resolvedEgressIPs` as the resolution of the hostname. So:
- // every peer must BE an ipBlock, and every CIDR must be the /32 this
- // controller is the only thing that ever writes. Anything else is
- // drift by definition, whatever it happens to allow.
- const allIpBlocks = peers.every(to => typeof to.ipBlock?.cidr === 'string')
- const allowed = enforced.filter(
- cidr => isAllowedExternalEgressCidr(cidr) && cidr.endsWith('/32')
- )
- const trustworthy = allIpBlocks && allowed.length === enforced.length
+ const verdict = this.judgeLiveExactHostEgress(server, name, binding, existingPolicy)
- // Still DESIRED, but only while the live object is one we would keep.
- // The cleanup below deletes every external-egress policy NOT in this
- // set, so membership is the difference between "left untouched" and
- // "revoked", and the choice has to be made after the trustworthy
- // verdict, not before it (review of #567, R1-L1).
+ // Membership in `desiredPolicyNames` is the difference between "left
+ // untouched" and "revoked": cleanup deletes every external-egress
+ // policy NOT in this set, and it runs BEFORE the deferred throw, so a
+ // revocation actually happens rather than being skipped by the
+ // fail-loud exit. Revoking is fail-CLOSED — these are pure allow
+ // policies under the namespace L0 deny-all, so removing one closes
+ // that destination and cannot open one.
//
- // Trustworthy — including the bootstrap case, where there is no live
- // policy at all and `enforced` is empty, so the filter is vacuously
- // total: the binding is declared, we simply could not reconcile it
- // this pass. Without the add, cleanup would read the omission as "the
- // operator removed it" and delete the very policy this branch
- // promises to leave untouched.
+ // Nothing here can rewrite a drifted policy instead: rebuilding means
+ // recomputing the CIDR set, and recomputing is what faulted.
//
- // Untrustworthy: the live policy carries a CIDR outside the allowed
- // ranges. Nothing else in the system repairs that — the safety lane
- // retains DNS policies modulo cidr and the orphan list is by label
- // without an ownership read — and this branch cannot rewrite it,
- // because rebuilding means recomputing and recomputing is what
- // faulted. Leaving it in the desired set is what kept a private range
- // enforced on every resync for as long as the fault lasted, which the
- // merge-base did not do: there the fault was laundered into the
- // permanent branch, which rewrote the policy from the annotation
- // window and dropped the drift. Omitting it hands the object to
- // cleanup, which runs BEFORE the deferred throw below, so the
- // revocation actually happens rather than being skipped by the
- // fail-loud exit. Revoking an allow policy under the namespace L0
- // deny-all closes that destination; it cannot open one.
- if (trustworthy) desiredPolicyNames.add(name)
-
- if (trustworthy && enforced.length > 0) {
+ // `none` is bootstrap, and there the add is dataplane-NEUTRAL: the
+ // policy came from `existingPolicies.find(...)`, cleanup filters that
+ // same list by name, and a name that was not found has no live object
+ // to delete. It stays explicit because the status has to tell "nothing
+ // was live" apart from "what was live got revoked" — an earlier
+ // revision of this branch asserted the opposite in a comment.
+ const revoked = verdict.state === 'drifted-shape' || verdict.state === 'drifted-cidr'
+ if (!revoked) desiredPolicyNames.add(name)
+
+ if (verdict.state === 'intact') {
// Without this the binding vanishes from status.resolvedEgressIPs —
// the audit record an operator reads to learn what is allowed —
// while its /32s stay enforced. The status message would claim
// "accumulated egress left untouched" and the record would disagree.
resolvedEgressIPs.push({
dns: binding.dns,
- ips: enforced.map(cidr => cidr.replace(/\/32$/, '')),
+ ips: verdict.cidrs.map(cidr => cidr.replace(/\/32$/, '')),
resolvedAt,
})
}
@@ -2378,16 +2426,15 @@ export class NetworkPolicyReconciler {
// a `??` fallback would be an unreachable branch pretending to be a guard.
dns: binding.dns,
err,
- // Blocking only when there is nothing to serve. A fault on a
- // binding that has never been written has no frozen set behind it,
- // so completing the pass would publish a server as reconciled while
- // one of its declared destinations was never enforced at all.
- blocking: !trustworthy || enforced.length === 0,
- // The message below otherwise tells the operator the accumulated
- // egress was left untouched. On an untrustworthy live policy it is
- // revoked instead, and a status that describes the opposite of what
- // the pass did is the same defect class this branch exists to close.
- revoked: !trustworthy,
+ // Blocking unless there is a trustworthy live set to serve. A fault
+ // on a binding that has never been written has no frozen set behind
+ // it, so completing the pass would publish a server as reconciled
+ // while one of its declared destinations was never enforced at all.
+ blocking: verdict.state !== 'intact',
+ // The operator message reads off this. A status that describes the
+ // opposite of what the pass did is the same defect class this branch
+ // exists to close.
+ live: verdict.state,
})
continue
}
@@ -2492,11 +2539,9 @@ export class NetworkPolicyReconciler {
const first = blocking ?? reconcileFaults[0]
const parts = [
`External egress reconciliation failed on binding "${first.dns}" with a non-DNS error ` +
- `(not a resolver condition, ${
- first.revoked
- ? 'live policy REVOKED: it enforced an address outside the allowed ranges'
- : 'accumulated egress left untouched'
- }): ${this.errorMessage(first.err)}`,
+ `(not a resolver condition, ${LIVE_EGRESS_FAULT_TEXT[first.live]}): ${this.errorMessage(
+ first.err
+ )}`,
]
if (reconcileFaults.length > 1) {
parts.push(`and ${reconcileFaults.length - 1} more binding(s) faulted`)
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index 8549a3f01..50a6bcac6 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.341",
+ "version": "0.1.342",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.341",
+ "version": "0.1.342",
"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 0e09abecd..03ba8569f 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.341",
+ "version": "0.1.342",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/reconciler/fqdnResolver.ts b/workflow-recipes/src/reconciler/fqdnResolver.ts
index 2a116bbc2..30fcfaaf5 100644
--- a/workflow-recipes/src/reconciler/fqdnResolver.ts
+++ b/workflow-recipes/src/reconciler/fqdnResolver.ts
@@ -173,7 +173,11 @@ export const defaultFqdnLookup: FqdnLookup = async host => {
if (transient) {
return {
kind: 'error',
- error: `DNS resolution for "${host}" failed (${transient.code}) — resolver or upstream unavailable`,
+ // Read through `dnsCodeOf` like every other consumer below. A `transient`
+ // verdict already guarantees a string code, so this is display-only — but
+ // it is the last hand-rolled `.code` read left in the consumers, and the
+ // point of the shared helper is that there is exactly one way to ask.
+ error: `DNS resolution for "${host}" failed (${dnsCodeOf(transient) ?? 'unknown'}) — resolver or upstream unavailable`,
retryable: true,
}
}