Skip to content

Commit

Permalink
Merge pull request #108 from hyperspike/replicas
Browse files Browse the repository at this point in the history
fix: fix replicas calculation in update code
  • Loading branch information
dmolik authored Nov 18, 2024
2 parents dd6acbf + f8bd776 commit 4aee7f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/controller/valkey_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,8 @@ export VALKEY_CLUSTER_ANNOUNCE_HOSTNAME="${POD_NAME}.%s"
}

if *sts.Spec.Replicas != valkey.Spec.Nodes {
sts.Spec.Replicas = &valkey.Spec.Nodes
replicas := valkey.Spec.Nodes * (valkey.Spec.Replicas + 1)
sts.Spec.Replicas = &replicas
sts.Spec.Template.Spec.Containers[0].Env[1].Value = getNodeNames(valkey)
if err := r.Update(ctx, sts); err != nil {
logger.Error(err, "failed to update statefulset", "valkey", valkey.Name, "namespace", valkey.Namespace)
Expand Down

0 comments on commit 4aee7f0

Please sign in to comment.