charts icon indicating copy to clipboard operation
charts copied to clipboard

[chart/redis-ha] Adding extra labels to antiAffinity

Open tschirmer opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. Because antiAffinities aren't namespaced, if you run 2 redis-ha helm charts with the same name across 2 namespaces (and example would be a SaaS that does user isolation with namespaces), they will avoid each other. If we can add an extra label set in there, we can them to co-exist in the same servers.

tschirmer avatar Oct 30 '24 11:10 tschirmer

@tschirmer We already support this with override the affinity.

Is there something more specific you're asking for? My concern would be if this was "too specific" it becomes overly more complex than it already is.

    affinity:
    {{- if .Values.affinity }}
    {{- with .Values.affinity }}
{{ tpl . $ | indent 8 }}
    {{- end }}
    {{- else }}
    {{- if .Values.additionalAffinities }}
{{ toYaml .Values.additionalAffinities | indent 8 }}
    {{- end }}
        podAntiAffinity:
    {{- if .Values.hardAntiAffinity }}
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels:
                  app: {{ template "redis-ha.name" . }}
                  release: {{ .Release.Name }}
                  {{ template "redis-ha.fullname" . }}: replica
              topologyKey: kubernetes.io/hostname
    {{- else }}
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app: {{ template "redis-ha.name" . }}
                    release: {{ .Release.Name }}
                    {{ template "redis-ha.fullname" . }}: replica
                topologyKey: kubernetes.io/hostname
    {{- end }}
    {{- end }}

DandyDeveloper avatar Nov 07 '24 11:11 DandyDeveloper