Skip to content

feat: new major 1.0 release - #389

Merged
ilya-lesikov merged 14 commits into
mainfrom
1
Oct 9, 2026
Merged

ilya-lesikov merged 14 commits into
mainfrom
1

Conversation

@ilya-lesikov

Copy link
Copy Markdown
Member

No description provided.

@ilya-lesikov
ilya-lesikov force-pushed the 1 branch 2 times, most recently from e0dc842 to 8f937d7 Compare March 27, 2026 21:12
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
dmmordvi and others added 13 commits May 26, 2026 18:26
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Evgeniy Frolov <evgeniy.frolov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
…alues

Add an exact contrib rule for postgresql.cnpg.io/Cluster so readiness is
decided by status.conditions[type=Ready].status instead of falling through
to the implicit-ready fallback. A CNPG Cluster previously reported ready
the moment it appeared: none of the universal rules matched it, because its
status.phase values are free-text and the universal condition rules only
ever match lowercase condition types. Exact rules treat an unresolved
JSONPath as pending, so this also covers the window before the operator
writes any condition — verified against a live cluster.

Stop writing the matched value into the shared package-global rule. It was
read back three times to build the indicator and compute ready/failed, so
concurrent tracking could interleave and produce wrong verdicts: a Pending
resource was reported ready 12 times per 4000 concurrent evaluations, and a
Running one not-ready 13 times. The value now lives in a local, leaving the
rule table immutable after init().

Also emit a debug-only line when the implicit-ready fallback fires, so the
empty INFO column that was the only signal of this class of bug can be
diagnosed with KUBEDOG_TRACKER_DEBUG=1.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
The universal condition rules build their JSONPaths from casify(value)[0],
which is always the raw lowercase input, so they only ever match condition
types spelled "ready", "available" and so on. Real resources use CamelCase,
so all 17 of those rules have never matched anything and custom resources
whose readiness lives in status.conditions fall through to the
implicit-ready fallback.

Fixing that changes when deployments block, so it is opt-in: callers pass
CaseInsensitiveConditionTracking through DynamicReadinessTrackerOptions and
generic.NewTrackerOptions. Two complete rule tables are built once at init()
and selected per tracker, so the tables stay immutable and the default one
is behaviourally identical to before. The variant table expands each
condition type to its casify() spellings, CamelCase first so it wins when a
resource carries several, giving 51 condition rules instead of 17.

Contrib and low-priority rules are shared between both tables rather than
rebuilt, which keeps the exact-rule priority and the phase/state/health
value rules identical in both modes. The three exported constructors take
options variadically so existing callers keep compiling.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
This package had no tests at all, which is how the lowercase condition
types and the shared-rule mutation both survived. Cover the CNPG rule
across its whole lifecycle, the implicit-ready fallback, the two rule
tables, and concurrent evaluation.

The tracker-level test drives the real Track loop over a fake dynamic
client for a Cluster created with no status, updated to Ready=False and
then Ready=True, asserting nothing reaches succeededCh until the last
step. Removing the CNPG rule makes it fail at 2s with "reported success
before any Ready condition existed", which is the reported bug, so the
test discriminates rather than merely passing. Events are disabled via
KUBEDOG_DISABLE_EVENTS because the events watcher needs a core v1 events
informer that the fake fixture does not provide.

Promote testify to a direct requirement now that it is actually imported.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
Assert the fallback diagnostic is debug-only by capturing stdout across
three cases: silent when KUBEDOG_TRACKER_DEBUG is unset, printed for a
resource with no recognized status field, and silent when a rule matched.
Without this the line could be dropped by a refactor unnoticed, since only
manual verification covered it. Driven by t.Setenv rather than log.SetDebug,
which installs a process-global override that never resets and would leak
into later tests.

Compare the two rule tables by value instead of by pointer: they currently
share the contrib and low-priority sub-slices, so pointer equality passed
tautologically and would not catch a future change that rebuilds those
sections per table. Verified by injecting a divergent low-priority rule,
which the value comparison now catches.

Extend casing-variant coverage from 4 ready condition types to all 17, and
assert the indicator value for both objects in the concurrency test rather
than only the pending one, since the original race corrupted values in both
directions.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
The variant-coverage test duplicated readyValuesByPriority as a literal, so a
ready type added to the builder would not have been covered. Derive the
expected types from the default table's condition rules instead, which yields
the same 17 types today and extends automatically. The paired rule count stays
hardcoded on purpose and now says so: it is the tripwire that makes someone
look when the set changes, since the derived list would otherwise accept a new
set silently.

Also make the stdout capture helper restore os.Stdout and close the pipe writer
even if the function under test panics, so a failure cannot leave the rest of
the binary writing into a dead pipe.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
Universal condition rules now always cover the casing variants of every ready
condition type, with CamelCase first so it wins the first-match-wins scan. The
opt-in that selected between a case-sensitive and a case-insensitive rule table
is gone, along with the table selector, NewTrackerOptions,
NewResourceStatusOptions, NewResourceStatusIndicatorOptions, the tracker field
and DynamicReadinessTrackerOptions.CaseInsensitiveConditionTracking; the
constructors return to their positional signatures and the single rule table
grows from 45 to 79 rules.

This changes when tracking blocks: a custom resource carrying a CamelCase
Ready/Available condition previously matched no rule and was reported ready
immediately, and will now block until that condition is True. Deployments that
appeared to succeed may start timing out.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
Take main's multi-path rule table (jsonPath -> jsonPaths) and the
managed-services.deckhouse.io rules, and main's non-fatal handling of
forbidden watch errors on the events feed.

Main's CaseInsensitiveConditionTracking opt-in is dropped: e8f61a4
superseded it by always matching condition types case-insensitively, so
the tracker, the dyntracker and the resource status constructors keep
their positional signatures and the single rule table. The default
non-fatal watch warning prints to stdout, since pkg/display is gone in
1.0.

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
Replace naked returns with explicit ones, rewrite a single-case switch as an if, and drop the unused saveLogsOnlyForNumberOfReplicas field, which was never assigned or read since the constructor forwards the option directly to sub-trackers.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
golangci-lint v1.62.0 is built with go1.23 and refuses to lint a module targeting go 1.25.0, so task lint failed everywhere, including CI. Pin v2.5.0 as nelm does and add a local .golangci.yaml, since the shared common-ci config is still v1 schema and unreadable by v2. The linter set is unchanged apart from typecheck, which v2 no longer exposes.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
@ilya-lesikov
ilya-lesikov merged commit b201189 into main Oct 9, 2026
2 checks passed
@ilya-lesikov
ilya-lesikov deleted the 1 branch October 9, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants