feat(stackresource): report the last port-dial result on status - #57
Merged
Conversation
PortCheck used to exist only while a declared port was failing: it was written on the first refusal seen while serving and deleted once every port verified open. The hub had nothing to build a release event from, and no way to tell "ports verified" from "never checked". It now reports what the last dial said, on both the serving and the not-serving path: status Success or Failure failingPortNumbers the ports that refused the last dial failingSince when the grace window opened, if one is open A port that is slow to bind reports Failure and then Success once it comes up. That is intended — it tells the user the ports were actually scanned. The workload is still only condemned when a Failure outlives the grace window, which is unchanged. failingSince keeps its old job as the operator's countdown, and only verifyServingPorts sets it. Reading it through graceWindowStart means a Success record (no timestamp) opens a fresh window on the next failure instead of dereferencing a nil pointer. capturePortDiagnosisForNotServingWorkload reports the dial but never opens the window: a pod that has not started listening yet must not burn it, or the serving path would condemn on its first refusal. Writing the same record every pass also keeps StatusHash stable, so a not-serving workload no longer looks like it is changing on every reconcile.
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.
What
PortCheckused to exist only while a declared port was failing — written on the first refusal seen while serving, deleted once every port verified open. The hub had nothing to build a release event from, and no way to tell "ports verified" from "never checked".It now reports what the last dial said, on both the serving and the not-serving path:
statusSuccessorFailure— the result of the last dialfailingPortNumbersfailingSinceA port that is slow to bind reports
Failureand thenSuccessonce it comes up. That is intended: it tells the user the ports were actually scanned, and the follow-up corrects it. The workload is still only condemned when aFailureoutlives the grace window — that behaviour and the 3 minute default are unchanged.How
failingSincekeeps its old job as the operator's countdown, and onlyverifyServingPortssets it. It is read through one helper:A
Successrecord has no timestamp, so a port that goes bad after verifying open opens a fresh window instead of reading through a nil pointer.capturePortDiagnosisForNotServingWorkload(renamed fromcapturePortDiagnosis, so the precondition is in the name) reports the dial but never opens the window. A pod that has not started listening yet must not burn it, or the serving path would condemn on its first refusal. Writing the same record on every pass also keepsStatusHashstable, so a not-serving workload no longer looks like it is changing on every reconcile.Tests
Two new specs in
readiness_failure_test.go:opens a fresh window when a verified-open port goes bad on the same revision— the nil-pointer path.reports the dial without opening the grace window, and writes the same record every pass— assertsfailingSincestays nil andStatusHash()does not move across three passes.Existing specs updated for the pointer field and for
Successnow writing a record instead of clearing it.make testgreen.Follow-up
Hub side: show
Failureas in-progress while the resource is stillPending, and as a failed release once it isFailed/Stalled. Related to the open thread on mappingPhase=Failed + Available=True.