Skip to content

fix: correct RDS Valkey webhook registration and failover defaults#77

Merged
chideat merged 1 commit intomainfrom
test-fix
Mar 16, 2026
Merged

fix: correct RDS Valkey webhook registration and failover defaults#77
chideat merged 1 commit intomainfrom
test-fix

Conversation

@chideat
Copy link
Owner

@chideat chideat commented Mar 16, 2026

Two bugs in the RDS Valkey admission webhook:

  1. Webhook annotations referenced the wrong API group (rds.inst.buf.red instead of rds.valkey.buf.red), causing both the mutating and validating webhooks to never fire for Valkey CR operations. This meant the sentinel access serviceType was never propagated from spec.access.serviceType to spec.sentinel.access.serviceType, resulting in sentinel services always being ClusterIP even when NodePort was requested.

  2. For ValkeyFailover arch, spec.replicas.shards was only defaulted to 1 when spec.replicas was nil. If the user provided a Replicas object with only ReplicasOfShard set, Shards defaulted to 0 and the validating webhook would reject the CR. Fixed by always enforcing Shards=1 for failover, matching the existing ValkeyReplica behavior.

Two bugs in the RDS Valkey admission webhook:

1. Webhook annotations referenced the wrong API group (rds.inst.buf.red
   instead of rds.valkey.buf.red), causing both the mutating and validating
   webhooks to never fire for Valkey CR operations. This meant the sentinel
   access serviceType was never propagated from spec.access.serviceType to
   spec.sentinel.access.serviceType, resulting in sentinel services always
   being ClusterIP even when NodePort was requested.

2. For ValkeyFailover arch, spec.replicas.shards was only defaulted to 1
   when spec.replicas was nil. If the user provided a Replicas object with
   only ReplicasOfShard set, Shards defaulted to 0 and the validating webhook
   would reject the CR. Fixed by always enforcing Shards=1 for failover,
   matching the existing ValkeyReplica behavior.
Copilot AI review requested due to automatic review settings March 16, 2026 14:36
@chideat chideat merged commit f9177a6 into main Mar 16, 2026
4 checks passed
@chideat chideat deleted the test-fix branch March 16, 2026 14:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the RDS Valkey webhook configuration and CRD manifests to align with the rds.valkey.buf.red API group and updated webhook endpoints, and tweaks defaulting behavior for failover instances.

Changes:

  • Renames the Valkey mutating/validating webhook paths and API group from the old rds.inst.buf.red naming to rds.valkey.buf.red (code + manifests).
  • Forces spec.replicas.shards = 1 in the failover defaulter path.
  • Updates several CRD schema description strings (notably pod affinity weighting text).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
internal/webhook/rds/v1alpha1/valkey_webhook.go Updates webhook markers and changes defaulting behavior for failover shards.
config/webhook/manifests.yaml Updates webhook configuration paths and apiGroups to match the Valkey RDS API group.
config/crd/bases/valkey.buf.red_sentinels.yaml CRD schema description text updates (includes pod affinity weighting wording).
config/crd/bases/valkey.buf.red_failovers.yaml CRD schema description text updates (includes pod affinity weighting wording in multiple places).
config/crd/bases/valkey.buf.red_clusters.yaml CRD schema description text updates (includes pod affinity weighting wording).
config/crd/bases/rds.valkey.buf.red_valkeys.yaml CRD schema description text updates (includes pod affinity weighting wording in multiple places).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 118 to 123
ReplicasOfShard: 2,
}
}
inst.Spec.Replicas.Shards = 1
if inst.Spec.Sentinel == nil {
inst.Spec.Sentinel = &v1alpha1.SentinelSettings{}
Comment on lines +686 to +687
compute a sum by iterating through the elements of this field and subtracting
"weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
Comment on lines +638 to +639
compute a sum by iterating through the elements of this field and subtracting
"weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
Comment on lines +681 to +682
compute a sum by iterating through the elements of this field and subtracting
"weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
Comment on lines +2274 to +2275
compute a sum by iterating through the elements of this field and subtracting
"weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
Comment on lines +703 to +704
compute a sum by iterating through the elements of this field and subtracting
"weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
Comment on lines +2310 to +2311
compute a sum by iterating through the elements of this field and subtracting
"weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
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.

2 participants