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

Add affinity to template #89

Open
oburd opened this issue Nov 2, 2023 · 8 comments
Open

Add affinity to template #89

oburd opened this issue Nov 2, 2023 · 8 comments

Comments

@oburd
Copy link

oburd commented Nov 2, 2023

Hello!
Can you create affinity template for deployment ?
Because i don need hostname, i need zones
Is this possible ?
Thank you

@ryanemerson
Copy link
Contributor

That's not currently possible. PRs are welcome though 🙂

We could add deploy.affinity to the values.yaml and make it so the default value is what's currently specified in the template, e.g. values.yaml would look like:

deploy:
  affinity:
    podAntiAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
        - podAffinityTerm:
            labelSelector:
              matchLabels:
                clusterName: {{ include "infinispan-helm-charts.name" . }}
                app: infinispan-pod
            topologyKey: kubernetes.io/hostname
          weight: 100

@oburd
Copy link
Author

oburd commented Nov 2, 2023

You mean it's me need to create PR ?
About affinity, so i can add in values.yml ?
Something like this
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
clusterName: {{ include "infinispan-helm-charts.name" . }}
app: infinispan-pod
topologyKey: topology.kubernetes.io/zone

@ryanemerson
Copy link
Contributor

You mean it's me need to create PR ?

The feature may get added in the future by someone else (thanks for raising the issue), but submitting a PR yourself will definitely speed things up and ensure the feature is added.

About affinity, so i can add in values.yml ?

In order for us to support this there are two changes required:

  1. We need to update the default values.yaml included with the chart to include the yaml I posted. This is to ensure that the existing behaviour doesn't changes.
  2. The templates/statefulset.yaml template needs to be updated to remove the existing podAntiAffinity and instead include .Values.deploy.affinity. See how the spec.nodeSelector value is configured in this template for a similar example.

@oburd
Copy link
Author

oburd commented Nov 2, 2023

If i right understand
in stateful.yml
instead of this

affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    clusterName: {{ include "infinispan-helm-charts.name" . }}
                    app: infinispan-pod
                topologyKey: kubernetes.io/hostname
              weight: 100

add this to statefulset template

 {{- if .Values.deploy.affinity }}
      affinity :
      {{- with .Values.deploy.affinity }}
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- end }}

And need to add in value.yml:

affinity: {}

@ryanemerson
Copy link
Contributor

That looks correct 👍

@oburd
Copy link
Author

oburd commented Nov 2, 2023

So should i do the PR ? for this ?

@ryanemerson
Copy link
Contributor

If you're able to, it would be much appreciated!

@oburd
Copy link
Author

oburd commented Nov 3, 2023

Hello!
I will do little later

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

No branches or pull requests

2 participants