Skip to content

Commit

Permalink
Configurable pod (anti)Affinity. Fixes #89
Browse files Browse the repository at this point in the history
  • Loading branch information
rigazilla authored and ryanemerson committed Jul 31, 2024
1 parent 7f7f7ec commit 7db9abb
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Configure your Infinispan cluster by specifying values in the `deploy.*` section
| `deploy.tolerations` | Node taints to tolerate | `[]` | - |
| `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.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: 2 additions & 0 deletions README.md.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Configure your {brandname} cluster by specifying values in the `deploy.*` sectio
| `deploy.tolerations` | Node taints to tolerate | `[]` | - |
| `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.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 @@ -118,9 +118,30 @@ This can be used to change the group of mounted file systems. Set `securityConte
|Specifies a name for all {brandname} cluster resources.
|Helm Chart release name.

| `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
a|[source, yaml]
....
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
clusterName: "{{ tpl include \"infinispan-helm-charts.name\" . }}"
app: infinispan-pod
topologyKey: kubernetes.io/hostname
weight: 100
....

|`deploy.infinispan`
|{brandname} Server configuration.
|{brandname} provides default server configuration.
For more information about configuring server instances, see xref:#server-configuration-values_configuring-servers[_{brandname} Server configuration values_].

|===
19 changes: 11 additions & 8 deletions templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,18 @@ spec:
{{- end }}
{{- end }}
affinity:
{{- if .Values.deploy.podAffinity }}
podAffinity:
{{- with .Values.deploy.podAffinity }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.deploy.podAntiAffinity }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
clusterName: {{ include "infinispan-helm-charts.name" . }}
app: infinispan-pod
topologyKey: kubernetes.io/hostname
weight: 100
{{- with .Values.deploy.podAntiAffinity }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.deploy.nodeAffinity }}
nodeAffinity:
{{- with .Values.deploy.nodeAffinity }}
Expand Down
2 changes: 1 addition & 1 deletion values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@
"minLength": 1
}
},
"required": ["path"]
"required": ["alias","path","password"]

}
}
Expand Down
12 changes: 12 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ deploy:

nodeAffinity: {}

podAffinity: {}

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

nodeSelector: {}

securityContext: {}
Expand Down

0 comments on commit 7db9abb

Please sign in to comment.