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

Fix templating for podAntiAffinity. Fixes #129 #130

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Configure your Infinispan cluster by specifying values in the `deploy.*` section
| `deploy.nodeSelector` | Defines the nodeSelector policy used by the cluster's StatefulSet | `{}` | - |
| `deploy.nodeAffinity` | Defines the nodeAffinity policy used by the cluster's StatefulSet | `{}` | - |
| `deploy.podAffinity` | Defines the podAffinity policy used by the cluster's StatefulSet | `{}` | - |
| `deploy.podAntiAffinity` | Defines the podAntiAffinity policy used by the cluster's StatefulSet | <pre><code>podAntiAffinity: <br>preferredDuringSchedulingIgnoredDuringExecution:<br> - podAffinityTerm:<br> labelSelector:<br> matchLabels:<br> clusterName: "{{ tpl include \"infinispan-helm-charts.name\" . }}"<br> app: infinispan-pod<br> topologyKey: kubernetes.io/hostname<br> weight: 100</code></pre> | - |
| `deploy.podAntiAffinity` | Defines the podAntiAffinity policy used by the cluster's StatefulSet | <pre><code>podAntiAffinity: ><br>preferredDuringSchedulingIgnoredDuringExecution:<br> - podAffinityTerm:<br> labelSelector:<br> matchLabels:<br> clusterName: {{ include "infinispan-helm-charts.name" . }}<br> app: infinispan-pod<br> topologyKey: kubernetes.io/hostname<br> weight: 100</code></pre> | - |
| `deploy.makeDataDirWritable` | Allows write access to the `data` directory for each Infinispan Server node. | false | Setting the value to `true` creates an initContainer that runs `chmod -R` on the `/opt/infinispan/server/data` directory and changes its permissions. |
| `deploy.monitoring.enabled` | Enable or disable `ServiceMonitor` functionality. | false | Users must have `monitoring-edit` role assigned by the admin to deploy the Helm chart with `ServiceMonitor` enabled. |
| `deploy.nameOverride` | Specifies a name for all Infinispan cluster resources. | Helm Chart release name | Configure a name for the created resources only if you need it to be different to the Helm Chart release name. |
Expand Down
2 changes: 1 addition & 1 deletion README.md.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Configure your {brandname} cluster by specifying values in the `deploy.*` sectio
| `deploy.nodeSelector` | Defines the nodeSelector policy used by the cluster's StatefulSet | `{}` | - |
| `deploy.nodeAffinity` | Defines the nodeAffinity policy used by the cluster's StatefulSet | `{}` | - |
| `deploy.podAffinity` | Defines the podAffinity policy used by the cluster's StatefulSet | `{}` | - |
| `deploy.podAntiAffinity` | Defines the podAntiAffinity policy used by the cluster's StatefulSet | <pre><code>podAntiAffinity: <br>preferredDuringSchedulingIgnoredDuringExecution:<br> - podAffinityTerm:<br> labelSelector:<br> matchLabels:<br> clusterName: "{{ tpl include \"infinispan-helm-charts.name\" . }}"<br> app: infinispan-pod<br> topologyKey: kubernetes.io/hostname<br> weight: 100</code></pre> | - |
| `deploy.podAntiAffinity` | Defines the podAntiAffinity policy used by the cluster's StatefulSet | <pre><code>podAntiAffinity: ><br>preferredDuringSchedulingIgnoredDuringExecution:<br> - podAffinityTerm:<br> labelSelector:<br> matchLabels:<br> clusterName: {{ include "infinispan-helm-charts.name" . }}<br> app: infinispan-pod<br> topologyKey: kubernetes.io/hostname<br> weight: 100</code></pre> | - |
| `deploy.makeDataDirWritable` | Allows write access to the `data` directory for each {brandname} Server node. | false | Setting the value to `true` creates an initContainer that runs `chmod -R` on the `/opt/infinispan/server/data` directory and changes its permissions. |
| `deploy.monitoring.enabled` | Enable or disable `ServiceMonitor` functionality. | false | Users must have `monitoring-edit` role assigned by the admin to deploy the Helm chart with `ServiceMonitor` enabled. |
| `deploy.nameOverride` | Specifies a name for all {brandname} cluster resources. | Helm Chart release name | Configure a name for the created resources only if you need it to be different to the Helm Chart release name. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ a|[source, yaml]
- podAffinityTerm:
labelSelector:
matchLabels:
clusterName: "{{ tpl include \"infinispan-helm-charts.name\" . }}"
clusterName: {{ tpl include "infinispan-helm-charts.name" . }}
app: infinispan-pod
topologyKey: kubernetes.io/hostname
weight: 100
Expand Down
8 changes: 5 additions & 3 deletions templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ spec:
{{- end }}
{{- if .Values.deploy.podAntiAffinity }}
podAntiAffinity:
{{- with .Values.deploy.podAntiAffinity }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- if typeIs "string" .Values.deploy.podAntiAffinity }}
{{- tpl .Values.deploy.podAntiAffinity . | nindent 10 }}
{{- else }}
{{- toYaml .Values.deploy.podAntiAffinity | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.deploy.nodeAffinity }}
nodeAffinity:
Expand Down
8 changes: 5 additions & 3 deletions values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Default values for infinispan-helm-charts.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

images:
# [USER] The container images for server pods.
server: quay.io/infinispan/server:15.0
Expand Down Expand Up @@ -88,12 +87,15 @@ deploy:

podAffinity: {}

podAntiAffinity:
# PodAntiAffinity is expressed as a string (note the > char)
# to allow dynamic replacing of clusterName in statefulSet
# chart also supports plain yaml value if dynamic replacement is not needed
podAntiAffinity: >
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
clusterName: "{{ tpl include \"infinispan-helm-charts.name\" . }}"
clusterName: {{ include "infinispan-helm-charts.name" . }}
app: infinispan-pod
topologyKey: kubernetes.io/hostname
weight: 100
Expand Down
Loading