Skip to content

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

TypeScript

fix(hcc): warn once when external-egress periodic resync is disabled [R4-B]

Alfredo Lopez8085ebf21022
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index 60bbd9a99..2bdaa41b2 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.219",
+ "version": "0.1.220",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.219",
+ "version": "0.1.220",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@clerum/image-policy": "file:../packages/image-policy",
diff --git a/host-context-controller/package.json b/host-context-controller/package.json
index 2ce5af165..fa0139fb6 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.219",
+ "version": "0.1.220",
"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/externalEgressConvergenceCoordinator.test.ts b/host-context-controller/src/externalEgressConvergenceCoordinator.test.ts
index bccee5997..ac8a5d926 100644
--- a/host-context-controller/src/externalEgressConvergenceCoordinator.test.ts
+++ b/host-context-controller/src/externalEgressConvergenceCoordinator.test.ts
@@ -808,6 +808,46 @@ describe('ExternalEgressConvergenceCoordinator', () => {
expect(mutate).toHaveBeenCalledOnce()
})
+ it('warns once when periodic resync is disabled (intervalSec <= 0) and arms no timer', async () => {
+ vi.useFakeTimers()
+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
+ const selected = server('web-search')
+ const { instance, mutate, servers } = coordinator()
+ servers.set(selected.name, selected)
+
+ instance.startPeriodicResync(0, 5)
+ // No timer armed: advancing time never triggers a resync pass.
+ await vi.advanceTimersByTimeAsync(60_000)
+ expect(mutate).not.toHaveBeenCalled()
+
+ expect(warnSpy).toHaveBeenCalledTimes(1)
+ expect(warnSpy).toHaveBeenCalledWith(
+ expect.stringContaining('External egress periodic DNS resync disabled')
+ )
+
+ // Called again while still disabled: no duplicate warning (once only).
+ instance.startPeriodicResync(-1, 5)
+ expect(warnSpy).toHaveBeenCalledTimes(1)
+
+ instance.stop()
+ })
+
+ it('does not warn about a disabled resync when it is enabled (intervalSec > 0)', async () => {
+ vi.useFakeTimers()
+ vi.spyOn(Math, 'random').mockReturnValue(0)
+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
+ const selected = server('web-search')
+ const { instance, servers } = coordinator()
+ servers.set(selected.name, selected)
+
+ instance.startPeriodicResync(1, 1)
+ expect(warnSpy).not.toHaveBeenCalledWith(
+ expect.stringContaining('External egress periodic DNS resync disabled')
+ )
+
+ instance.stop()
+ })
+
it('arms one resync at a time, rescheduling only after each pass completes (H2)', async () => {
vi.useFakeTimers()
vi.spyOn(Math, 'random').mockReturnValue(0)
diff --git a/host-context-controller/src/externalEgressConvergenceCoordinator.ts b/host-context-controller/src/externalEgressConvergenceCoordinator.ts
index 55d8ec7c2..6a8a19db2 100644
--- a/host-context-controller/src/externalEgressConvergenceCoordinator.ts
+++ b/host-context-controller/src/externalEgressConvergenceCoordinator.ts
@@ -139,12 +139,29 @@ export class ExternalEgressConvergenceCoordinator {
private readonly inFlight = new Map<string, Promise<void>>()
private resyncInFlight: Promise<void> | null = null
private resyncTimer: ReturnType<typeof setTimeout> | null = null
+ private resyncDisabledWarned = false
private stopped = false
constructor(private readonly dependencies: ExternalEgressCoordinatorDependencies) {}
startPeriodicResync(intervalSec: number, floorSec: number): void {
- if (this.stopped || intervalSec <= 0 || this.resyncTimer) return
+ if (this.stopped || this.resyncTimer) return
+ if (intervalSec <= 0) {
+ // Disabled. Warn once (mirrors the Host/SFS/GFS resync lanes) so the
+ // operational consequence is visible: without periodic resync the
+ // accumulated external-egress DNS allows are never refreshed, so a
+ // binding whose upstream DNS rotates (issue #299) can drift until an
+ // unrelated McpServer event triggers reconciliation.
+ if (!this.resyncDisabledWarned) {
+ this.resyncDisabledWarned = true
+ console.warn(
+ '[K8s] External egress periodic DNS resync disabled; accumulated DNS allows will not ' +
+ 'be refreshed, so a binding whose upstream DNS rotates (issue #299) can drift until ' +
+ 'another McpServer event triggers reconciliation.'
+ )
+ }
+ return
+ }
// Self-rescheduling (not a fixed setInterval) so the delay can advance to
// <= observed TTL/2 (H2, issue #299), and rescheduling AFTER each pass
// completes guarantees no overlapping resyncs. runResync still dedupes any