fix: store config/pipeline hashes as int64 to fit the uint32 range (#232)#233
Merged
Merged
Conversation
The pipeline and Vector config hashes are CRC32 checksums (uint32,
0..4294967295), but their status fields were int32 (*uint32 in Go makes
controller-gen emit format: int32). Any hash above the int32 ceiling
(2147483647) - roughly half of all values - is rejected by the API server:
status: Invalid value: "": Checked value must be of type integer
with format int32 in LastAppliedPipelineHash
The status update then fails on every reconcile, so the resource stays
stuck with configCheckResult=false and the reconcile loop retries forever.
VectorPipeline only appeared unaffected when its hash happened to land
below the int32 ceiling; the defect is not specific to ClusterVectorPipeline.
Store the hashes as int64, which fully contains the uint32 range:
- VectorPipelineStatus.LastAppliedPipelineHash
- VectorCommonStatus.LastAppliedConfigHash
- VectorCommonStatus.LastAppliedGlobalConfigHash
int64 is backward compatible with the int32-range values already persisted
in status. CRDs regenerated with controller-gen v0.16.1 and the helm chart
CRD copies synced.
Fixes kaasops#232
Signed-off-by: Gaál György <gb12335@gmail.com>
aa1ex
approved these changes
Jul 3, 2026
aa1ex
left a comment
Contributor
There was a problem hiding this comment.
Hi! Nice catch, on 1.36+ this really does fire (kubernetes/kubernetes#136582). LGTM.
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.
Summary
Fixes #232.
ClusterVectorPipeline(and, as it turns out, theVector/VectorAggregator/ClusterVectorAggregatorresources) can get permanently stuck withconfigCheckResult: falseeven though the config check succeeds, with the operator log looping on:Root cause
The config/pipeline hash is a CRC32 checksum — a
uint32in the range0..4294967295(internal/utils/hash). It is stored in the status as a Go*uint32, which makescontroller-genemitformat: int32in the CRD schema.int32maxes out at2147483647, so any hash above that ceiling — roughly half of all values — is rejected by the API server on the status update. The update fails on every reconcile, the resource never reachesVALID: true, and the reconcile loop retries forever. TheInvalid value: ""wording is just how the apiserver's int32 range validator reports an out-of-range integer.This is not specific to
ClusterVectorPipeline— the namespacedVectorPipelineonly appeared unaffected because its hash happened to fall below the int32 ceiling. The same defect exists inVectorCommonStatus.LastAppliedConfigHash/LastAppliedGlobalConfigHash, which back the Vector agent and aggregator CRDs.Reproduction
On a kind cluster (k8s v1.36), with the unpatched CRD:
Fix
Store the hashes as
int64, which fully contains theuint32range:VectorPipelineStatus.LastAppliedPipelineHashVectorCommonStatus.LastAppliedConfigHashVectorCommonStatus.LastAppliedGlobalConfigHashGetPipelineHash/GetGlobalConfigHashand the controllers now widen theuint32CRC32 toint64(int64(hash.Get(...))), so the value is always non-negative and never overflows.int64is backward compatible with the int32-range values already persisted in existing resources' status.CRDs regenerated with
controller-gen v0.16.1; the helm-chart CRD copies underhelm/charts/vector-operator/crdswere synced to match.Testing
go build ./...,go vet,gofmtclean.go test ./internal/pipeline/... ./internal/utils/hash/...pass, including a new regression test (TestLastAppliedPipelineHashHoldsFullUint32Range) asserting auint32above the int32 ceiling round-trips through the status field without overflow.format: int64, and status updates with3632233996and4294967295(max uint32) are accepted, withconfigCheckResult: truepersisting.