Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

[stable/redis] zero slaveCount is ignored #17142

Closed

Description

@slavniyteo

In redis-slave-statefulset.yaml:

{{- if .Values.cluster.slaveCount }}
  replicas: {{ .Values.cluster.slaveCount }}
{{- end }}

According to docs:

{{if pipeline}} T1 {{end}}
	If the value of the pipeline is empty, no output is generated;
	otherwise, T1 is executed. The empty values are false, 0, any
	nil pointer or interface value, and any array, slice, map, or
	string of length zero.
	Dot is unaffected.

So when .Values.cluster.slaveCount is set to 0, replicas values doesn't set and has it's default value 1. This doesn't happen when .Values.cluster.slaveCount is set to "0" (string value).

Which chart: stable/redis

What happened: Scale of redis-slave statefulset is set to 1.

What you expected to happen: Scale of redis-slave statefulset is set to 1.

How to reproduce it: It happens only when cluster.slaveCount is set to zero with integer value (0 not "0").

helm install stable/redis -f - <<EOF
cluster:
  slaveCount: 0
EOF

Additional info: When I use helm install stable/redis --set cluster.slaveCount=0 or set in values.yaml slaveCount as string value (slaveCount: "0") then everything is ok and slave replicas is set to 0.

Activity

  1. juan131 commented on Sep 16, 2019

    @juan131
    Collaborator

    HI @slavniyteo

    I guess that you should be setting the parameter cluster.enabled to false if you don't want any slaves in your Redis setup.

    Am I missing something or is there any reason why you want to configure a master-slave topology without slave replicas?

  2. slavniyteo commented on Sep 16, 2019

    @slavniyteo
    Author

    I'm not an expert in Redis so even when I've red the whole chart I couldn't be sure that cluster.enabled = false is equivalent to cluster.slaveCount = 0 (there might be a kind of initialization issues).

    What I tried to do when I found this issue is to set up a single instance of Redis with ability of scale it up later. I mean start the master only and later add slaves to it.


    Anyway two types of checking (cluster.enabled in slave statefulset vs cluster.claveCount >= 1.0 in network policy) seems a bit inconsistent.

  3. juan131 commented on Sep 17, 2019

    @juan131
    Collaborator

    What I tried to do when I found this issue is to set up a single instance of Redis with ability of scale it up later. I mean start the master only and later add slaves to it.

    In that case, it makes sense to provide a way to create a sts for the slave with 0 replicas.

    Anyway two types of checking (cluster.enabled in slave statefulset vs cluster.claveCount >= 1.0 in network policy) seems a bit inconsistent.

    I totally agree on that and it's something we should definitely clarify.

    I just created a PR to address your suggestions.

  4. juan131 commented on Sep 17, 2019

    @juan131
    Collaborator

    Hi @slavniyteo

    We just merged the PR and you should be able to install the stable/redis chart with 0 slave replicas. Please give the latest version a try and provide feedback about it. Thanks in advance.

  5. slavniyteo commented on Sep 23, 2019

    @slavniyteo
    Author

    Everything works, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions