Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tschirmer opened this issue Oct 30, 2024 · 1 comment
Open

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

tschirmer opened this issue Oct 30, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@tschirmer
Copy link

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 tschirmer added the enhancement New feature or request label Oct 30, 2024
@DandyDeveloper
Copy link
Owner

DandyDeveloper commented Nov 7, 2024

@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 }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants