Repository navigation
Conversation
Removed Ingress paths could stay in the pushed tunnel configuration forever (edge 502 on a dead route). Three independent defects contributed: - The tunnelconfig controller wrote the whole configuration snapshot it had parsed at the start of the reconcile back into the ConfigMap, reverting any source updated concurrently by the Ingress controller. The reverted snapshot then matched the recorded LastHash, so every later reconcile short-circuited and the stale rule was never pushed away again. Only the sync status fields are now written, on a freshly read ConfigMap. - ComputeHash included per-source UpdatedAt/Generation, so it changed on every bookkeeping write and could not reliably detect content changes. It now hashes only the effective configuration (in stable source order), so a removed rule always changes the hash and an unchanged aggregate does not force a push. - Deletions observed only as "object is gone" (handleIngressDeletion) were a no-op, leaving the aggregate of every class config stale with no event left to rebuild it. Every TunnelIngressClassConfig is now rebuilt from the live Ingresses. Also surface rebuild failures on the TunnelIngressClassConfig (State=error and Ready=False) instead of leaving Ready=True with stale rules, and always end the pushed ingress list with the catch-all rule so an aggregate that lost all its sources still produces a valid configuration. Related to StringKe#49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the stale-rule behaviour described in #49, where a rule for a path removed from an Ingress stays in the tunnel configuration and the edge keeps returning 502 for it.
The plain rebuild path does prune a removed path, so this PR addresses the failure modes that make the stale rule stick permanently in the aggregated
Ingress/<ns>/<class-config>source.Root causes
updateConfigMapwrote the whole configuration snapshot it had parsed at the start of the reconcile back into the ConfigMap. If the Ingress controller pruned a source while the push was in flight, the tunnelconfig controller reverted the prune and recorded its own hash asSynced. Every later reconcile then short-circuited onLastHash == ComputeHash()andSyncStatus == "Synced", so both the ConfigMap and Cloudflare kept the removed rule indefinitely. This matches the "same version reported across many reconciles" observation in the issue.ComputeHashhashedSourcesincluding per-sourceUpdatedAt, so it changed on every write and could not be used to detect actual content changes reliably.handleIngressDeletionreturned immediately, so when the finalizer had already been removed (or the delete event was missed) nothing rebuilt the aggregate and there was no later event to fix it.Changes
internal/controller/tunnelconfig/controller.gohttp_status:404catch-all so the configuration is valid even with zero sources.internal/controller/tunnelconfig/types.goComputeHashnow hashes only the effective configuration (in stable source order) and ignoresUpdatedAt,Generationand the sync status fields.internal/controller/ingress/controller.gohandleIngressDeletionrebuilds everyTunnelIngressClassConfigfrom the live Ingresses;State=errorandReady=Falseon theTunnelIngressClassConfiginstead of leavingReady=Truewith stale rules.Tests
New tests cover:
go build ./...,go vetand the affected package tests pass. The envtest suite underinternal/controllerwas not run here because the etcd binaries are not available on my machine; this branch does not touch it.Notes
The issue also asks whether an Ingress update that only removes a path triggers a rebuild: it does - the watch has no predicates and the aggregate is rebuilt on every reconcile. The permanent staleness came from the defects above, not from a missing rebuild trigger.
Refs #49