Skip to content

Commit

Permalink
Adds support for node affinity and node selectors (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
digiserg authored Jun 14, 2023
1 parent ceabb16 commit 02eafe2
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Configure your Infinispan cluster by specifying values in the `deploy.*` section
| `deploy.svcLabels` | Adds labels to each service that you create.| `{}` | - |
| `deploy.resourceLabels` | Adds labels to all Infinispan resources including pods and services. | `{}` | - |
| `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.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 @@ -40,6 +40,8 @@ Configure your {brandname} cluster by specifying values in the `deploy.*` sectio
| `deploy.svcLabels` | Adds labels to each service that you create.| `{}` | - |
| `deploy.resourceLabels` | Adds labels to all {brandname} resources including pods and services. | `{}` | - |
| `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.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
12 changes: 12 additions & 0 deletions templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ spec:
clusterName: {{ include "infinispan-helm-charts.name" . }}
{{- include "infinispan-helm-charts.podLabels" . | nindent 8 }}
spec:
{{- if .Values.deploy.nodeSelector }}
nodeSelector:
{{- with .Values.deploy.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -37,6 +43,12 @@ spec:
app: infinispan-pod
topologyKey: kubernetes.io/hostname
weight: 100
{{- if .Values.deploy.nodeAffinity }}
nodeAffinity:
{{- with .Values.deploy.nodeAffinity }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{if .Values.deploy.makeDataDirWritable }}
initContainers:
- name: data-chmod-pv
Expand Down
14 changes: 14 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@
"null"
]
},
"nodeSelector": {
"description": "Defines the nodeSelector policy used by the cluster's StatefulSet",
"type": [
"object",
"null"
]
},
"nodeAffinity": {
"description": "Defines the nodeAffinity policy used by the cluster's StatefulSet",
"type": [
"object",
"null"
]
},
"expose": {
"description": "Controls network access to Infinispan Server endpoints.",
"properties": {
Expand Down
14 changes: 14 additions & 0 deletions values.schema.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@
"null"
]
},
"nodeSelector": {
"description": "Defines the nodeSelector policy used by the cluster's StatefulSet",
"type": [
"object",
"null"
]
},
"nodeAffinity": {
"description": "Defines the nodeAffinity policy used by the cluster's StatefulSet",
"type": [
"object",
"null"
]
},
"expose": {
"description": "Controls network access to {brandname} Server endpoints.",
"properties": {
Expand Down
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ deploy:

tolerations: []

nodeAffinity: {}

nodeSelector: {}

infinispan:
cacheContainer:
# [USER] Add cache, template, and counter configuration.
Expand Down

0 comments on commit 02eafe2

Please sign in to comment.