fix(tektonchain): sync leader-election configmap - #3810
Conversation
Motivation: TektonConfig.spec.chain.performance values (e.g. buckets) were correctly propagated to the tekton-chains-controller Deployment's pod labels and container args, but the ConfigMap tekton-chains-config-leader-election was never updated to match, so it kept stale/default data instead of reflecting the current TektonConfig. This is a data-consistency bug in that ConfigMap, not a functional HA failure: the controller itself already receives the tuned values via the Deployment's args and pod labels, which are unaffected by this fix. Approach: tektonpipeline and tektonresult already call common.AddConfigMapValues(<leaderElectionConfigMapName>, ... Performance.PerformanceLeaderElectionConfig) alongside common.UpdatePerformanceFlagsInDeploymentAndLeaderConfigMap to keep their leader-election ConfigMaps in sync. The tektonchain transformer chain was missing that call. Add it, mirroring the existing pipeline/result behavior. Validation: Added TestUpdateLeaderElectionConfigMapForChains to pkg/reconciler/kubernetes/tektonchain/transform_test.go, with a new minimal fixture testdata/test-chain-leader-election-configmap.yaml. Confirmed (by temporarily reverting transform.go) that this test fails without the fix and passes with it. go build ./... go test ./pkg/reconciler/kubernetes/tektonchain/... ./pkg/reconciler/common/... Both commands pass. golangci-lint could not be downloaded in this sandbox (checksum mismatch fetching the pinned release binary, unrelated to this change); go vet and go build are clean. Fixes tektoncd#2884 ```release-note Fix `tekton-chains-config-leader-election` ConfigMap not being updated with `TektonConfig.spec.chain.performance` values. ``` Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a data-consistency gap in the Tekton Chains Kubernetes reconciler by ensuring the tekton-chains-config-leader-election ConfigMap is updated when TektonChain performance (leader election) settings change—matching the existing behavior in other components (e.g., pipeline/results).
Changes:
- Add
common.AddConfigMapValues(...)for the chains leader-election ConfigMap soperformanceleader-election fields (e.g.,buckets) are written into the ConfigMap during manifest transformation. - Add a focused unit test validating the leader-election ConfigMap is updated based on the CR’s performance settings.
- Introduce a minimal manifest fixture containing the chains controller Deployment and the leader-election ConfigMap for the new test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/reconciler/kubernetes/tektonchain/transform.go | Adds configmap-value injection for the chains leader-election ConfigMap to keep it in sync with performance settings. |
| pkg/reconciler/kubernetes/tektonchain/transform_test.go | Adds a unit test asserting buckets is updated in the leader-election ConfigMap after transformation. |
| pkg/reconciler/common/testdata/test-chain-leader-election-configmap.yaml | Adds a minimal Deployment+ConfigMap fixture used by the new unit test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3810 +/- ##
=======================================
Coverage 25.40% 25.40%
=======================================
Files 449 449
Lines 23477 23478 +1
=======================================
+ Hits 5964 5965 +1
Misses 16822 16822
Partials 691 691
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
hi @pujitha24 Can you go through easycla ? |
|
/easycla |
Motivation:
TektonConfig.spec.chain.performance values (e.g. buckets) were
correctly propagated to the tekton-chains-controller Deployment's
pod labels and container args, but the ConfigMap
tekton-chains-config-leader-election was never updated to match,
so it kept stale/default data instead of reflecting the current
TektonConfig. This is a data-consistency bug in that ConfigMap,
not a functional HA failure: the controller itself already
receives the tuned values via the Deployment's args and pod
labels, which are unaffected by this fix.
Approach:
tektonpipeline and tektonresult already call
common.AddConfigMapValues(, ...
Performance.PerformanceLeaderElectionConfig) alongside
common.UpdatePerformanceFlagsInDeploymentAndLeaderConfigMap to
keep their leader-election ConfigMaps in sync. The tektonchain
transformer chain was missing that call. Add it, mirroring the
existing pipeline/result behavior.
Validation:
Added TestUpdateLeaderElectionConfigMapForChains to
pkg/reconciler/kubernetes/tektonchain/transform_test.go, with a
new minimal fixture testdata/test-chain-leader-election-configmap.yaml.
Confirmed (by temporarily reverting transform.go) that this test
fails without the fix and passes with it.
go build ./...
go test ./pkg/reconciler/kubernetes/tektonchain/... ./pkg/reconciler/common/...
Both commands pass. golangci-lint could not be downloaded in this
sandbox (checksum mismatch fetching the pinned release binary,
unrelated to this change); go vet and go build are clean.
Fixes #2884
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com
AI assistance: this change was drafted with Claude Code.