feat(cache): add configurable JetStream KV replica count#3024
Merged
Conversation
javirln
reviewed
Apr 13, 2026
There was a problem hiding this comment.
1 issue found across 12 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="deployment/chainloop/values.yaml">
<violation number="1" location="deployment/chainloop/values.yaml:197">
P3: Bump the Helm chart patch version in Chart.yaml when updating values.yaml so chart consumers can pick up the change.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
a4e865d to
00a734e
Compare
NATS KV buckets in pkg/cache were created with the default replica count of 1, causing inconsistent reads in clustered NATS deployments. Add a WithReplicas option to pkg/cache and thread the replica count from Helm values through proto config, natsconn, and bundle caches. Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
00a734e to
6c558bc
Compare
migmartri
approved these changes
Apr 13, 2026
There was a problem hiding this comment.
1 issue found across 12 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="pkg/natsconn/natsconn.go">
<violation number="1" location="pkg/natsconn/natsconn.go:57">
P2: `Replicas` is documented as defaulting to 1, but `New` passes through `cfg.Replicas` without applying that default.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
|
|
||
| l := log.NewHelper(log.With(logger, "component", "natsconn")) | ||
| rc := &ReloadableConnection{logger: l} | ||
| rc := &ReloadableConnection{logger: l, Replicas: cfg.Replicas} |
There was a problem hiding this comment.
P2: Replicas is documented as defaulting to 1, but New passes through cfg.Replicas without applying that default.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At pkg/natsconn/natsconn.go, line 57:
<comment>`Replicas` is documented as defaulting to 1, but `New` passes through `cfg.Replicas` without applying that default.</comment>
<file context>
@@ -52,7 +54,7 @@ func New(cfg *Config, logger log.Logger) (*ReloadableConnection, func(), error)
l := log.NewHelper(log.With(logger, "component", "natsconn"))
- rc := &ReloadableConnection{logger: l}
+ rc := &ReloadableConnection{logger: l, Replicas: cfg.Replicas}
opts := []nats.Option{
</file context>
Suggested change
| rc := &ReloadableConnection{logger: l, Replicas: cfg.Replicas} | |
| replicas := cfg.Replicas | |
| if replicas <= 0 { | |
| replicas = 1 | |
| } | |
| rc := &ReloadableConnection{logger: l, Replicas: replicas} |
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
WithReplicasoption topkg/cacheso NATS JetStream KV buckets can be created with a configurable replica count. Max 3 replicasnatsconn.Config→ReloadableConnection→ attestationbundle/policyevalbundle cachesFollow-up of PFM-5440.