Skip to content

fix(controller): skip unchanged ConfigMap and ServiceAccount writes - #112

Merged
amuraru merged 2 commits into
masterfrom
fix/controller-write-convergence
Nov 18, 2026
Merged

amuraru merged 2 commits into
masterfrom
fix/controller-write-convergence

Conversation

@amuraru

@amuraru amuraru commented Nov 17, 2026

Copy link
Copy Markdown

Change log description

  • Skip unchanged ConfigMap and custom ServiceAccount updates.
  • Preserve real configuration changes, conflict retries, and subsequent StatefulSet reconciliation.

Purpose of the change

Partial progress on #101, PR-08. This does not complete PR-08 or close #101.

What the code does

Compare ConfigMap Data/BinaryData and ServiceAccount ImagePullSecrets before writing. Retain the existing Update behavior when those fields change; leave StatefulSet, Service, status and resource-version handling unchanged.

Regression cases cover no-op writes, concurrent-update conflicts and retries, owned-field removal, and scaling past an unchanged ServiceAccount. The resource cases run against both the fake client and a real Kubernetes 1.34.1 API server.

This removes demonstrated unnecessary mutation requests, not a proven stored-data write storm. No throughput improvement is claimed; default-aware convergence for other resources remains deferred.

How to verify it

Local validation used the isolated checkout at .worktrees/controller-write-convergence:

Exact command Result
make -C .worktrees/controller-write-convergence test Passed; race-enabled unit suite
KUBEBUILDER_ASSETS="$PWD/.worktrees/controller-write-convergence/bin/k8s/k8s/1.34.1-darwin-arm64" go -C .worktrees/controller-write-convergence test -race -tags=envtest ./controllers -run '^TestEnvtest' -count=1 Passed; all controller envtests
make -C .worktrees/controller-write-convergence check Passed; formatting and licenses
cd .worktrees/controller-write-convergence && golangci-lint run --new-from-rev=da85c962611ab87ce0ff122a0f8d865f6c8c968f ./controllers/... Passed; 0 issues
cd .worktrees/controller-write-convergence && golangci-lint run --build-tags=envtest --new-from-rev=da85c962611ab87ce0ff122a0f8d865f6c8c968f ./controllers/... Passed; 0 issues
git -C .worktrees/controller-write-convergence diff --check Passed

RED verification: the unchanged ConfigMap and ServiceAccount cases both failed against the immutable original controller at da85c96, loaded with a Go source overlay without changing the checkout. The final implementation passes both.

Local kind/e2e was not run. The existing Kubernetes 1.34 hosted e2e workflow is requested with the e2e label.

@amuraru amuraru added the e2e label Nov 17, 2026
@amuraru

amuraru commented Nov 17, 2026 •

Copy link
Copy Markdown
Author

Completed the actual Talos pre-flight review at a72bbf5a007eef6ea0dbce055a52a0f0d9d29b79: six independent personas (security, correctness, standards, architecture, devops, documentation) plus the required challenge reviewer. All returned zero observations; validation dropped none, and the challenge accepted/rejected zero. Static routing; Scout unavailable because it is not installed. No code fixes or new commit were warranted.

Fresh local validation passed:

  • go -C .worktrees/controller-write-convergence test -race ./controllers -run '^(TestResourceWriteGuards|TestServiceAccountNoChangeStillScalesStatefulSet)$' -count=1 -v
  • KUBEBUILDER_ASSETS="$PWD/.worktrees/controller-write-convergence/bin/k8s/k8s/1.34.1-darwin-arm64" go -C .worktrees/controller-write-convergence test -race -tags=envtest ./controllers -run '^TestEnvtest' -count=1
  • make -C .worktrees/controller-write-convergence check
  • cd .worktrees/controller-write-convergence && golangci-lint run --new-from-rev=da85c962611ab87ce0ff122a0f8d865f6c8c968f ./controllers/...
  • cd .worktrees/controller-write-convergence && golangci-lint run --build-tags=envtest --new-from-rev=da85c962611ab87ce0ff122a0f8d865f6c8c968f ./controllers/...
  • git -C .worktrees/controller-write-convergence diff --check

Hosted checks refreshed at 2026-11-17 20:40 UTC: all active completed checks passed; Kubernetes 1.34 e2e remains in progress. Superseded cancelled jobs are not failures of that active run. No local kind/e2e run. Approved ConfigMap/custom ServiceAccount guard scope is unchanged; broader #101/PR-08 and #103 work remains deferred. No merge performed.

@amuraru

amuraru commented Nov 17, 2026 •

Copy link
Copy Markdown
Author

Resolved the aggregate CI status: e2e run 44168955056, attempt 2 passed at 2026-11-18 08:47:06 UTC on unchanged HEAD a72bbf5a007eef6ea0dbce055a52a0f0d9d29b79 (Kubernetes 1.34 e2e: 38m52s).

Fresh verification: every entry in gh pr checks passes; the full PR check rollup has no failed/cancelled/pending entries, and aggregate mergeStateStatus is now CLEAN. The cancelled duplicate previously left the PR UNSTABLE despite successful tests in the replacement run; rerunning the cancelled workflow resolved that status.

Talos review remains complete with zero findings. No source changes, commits or merge performed; PR remains open.

Guard owned data before existing updates while preserving conflicts and subsequent StatefulSet reconciliation. Cover no-ops, changes, removals and real API-server conflict retries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@amuraru
amuraru force-pushed the fix/controller-write-convergence branch from a72bbf5 to bf6367a Compare November 18, 2026 18:48
Keep the health lifecycle test compatible with the reconciler-local ZooKeeper client factory introduced by #117.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@amuraru
amuraru merged commit 7957b49 into master Nov 18, 2026
13 checks passed
@amuraru
amuraru deleted the fix/controller-write-convergence branch November 18, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workstream: controller correctness and operational health

1 participant