Skip to content

Commit

Permalink
helm: introduce affinity to select specific nodes for the DaemonSet
Browse files Browse the repository at this point in the history
Allow users to define custom affinity rules in values.yaml, specifying
preferred nodes for plugin DaemonSet Pods. Follows Kubernetes structure
for affinity fields.

Signed-off-by: Feruzjon Muyassarov <[email protected]>
  • Loading branch information
fmuyassarov authored and klihub committed Nov 18, 2023
1 parent 67ab522 commit be77baf
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 8 deletions.
4 changes: 3 additions & 1 deletion deployment/helm/balloons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ customize with their own values, along with the default values.
| `hostPort` | 8891 | metrics port to expose on the host |
| `config` | <pre><code>ReservedResources:</code><br><code> cpu: 750m</code></pre> | plugin configuration data |
| `nri.patchRuntimeConfig` | false | enable NRI in containerd or CRI-O |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `affinity` | [] | specify node affinity |
| `nodeSelector` | [] | specify node selector labels |
7 changes: 7 additions & 0 deletions deployment/helm/balloons/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccount: nri-resource-policy-balloons
nodeSelector:
kubernetes.io/os: "linux"
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.nri.patchRuntimeConfig }}
initContainers:
- name: patch-runtime
Expand Down
21 changes: 21 additions & 0 deletions deployment/helm/balloons/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,24 @@ tolerations: []
# - key: "node-role.kubernetes.io/control-plane"
# operator: "Exists"
# effect: "NoSchedule"

affinity: []
#
# Example:
#
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: topology.kubernetes.io/disk
# operator: In
# values:
# - ssd

nodeSelector: []
#
# Example:
#
# nodeSelector:
# kubernetes.io/disk: "ssd"
6 changes: 4 additions & 2 deletions deployment/helm/memory-qos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ customize with their own values, along with the default values.

| Name | Default | Description |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `image.name` | [ghcr.io/containers/nri-plugins/nri-memory-qos](https://ghcr.io/containers/nri-plugins/nri-memory-qos) | container image name |
| `image.name` | [ghcr.io/containers/nri-plugins/nri-memory-qos](https://ghcr.io/containers/nri-plugins/nri-memory-qos) | container image name |
| `image.tag` | unstable | container image tag |
| `image.pullPolicy` | Always | image pull policy |
| `resources.cpu` | 10m | cpu resources for the Pod |
| `resources.memory` | 100Mi | memory qouta for the |
| `nri.patchRuntimeConfig` | false | enable NRI in containerd or CRI-O |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `affinity` | [] | specify node affinity |
| `nodeSelector` | [] | specify node selector labels |
7 changes: 7 additions & 0 deletions deployment/helm/memory-qos/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
nodeSelector:
kubernetes.io/os: "linux"
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.nri.patchRuntimeConfig }}
initContainers:
- name: patch-runtime
Expand Down
21 changes: 21 additions & 0 deletions deployment/helm/memory-qos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,24 @@ tolerations: []
# - key: "node-role.kubernetes.io/control-plane"
# operator: "Exists"
# effect: "NoSchedule"

affinity: []
#
# Example:
#
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: topology.kubernetes.io/disk
# operator: In
# values:
# - ssd

nodeSelector: []
#
# Example:
#
# nodeSelector:
# kubernetes.io/disk: "ssd"
6 changes: 4 additions & 2 deletions deployment/helm/memtierd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,16 @@ customize with their own values, along with the default values.

| Name | Default | Description |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `image.name` | [ghcr.io/containers/nri-plugins/nri-memtierd](https://ghcr.io/containers/nri-plugins/nri-memtierd) | container image name |
| `image.name` | [ghcr.io/containers/nri-plugins/nri-memtierd](https://ghcr.io/containers/nri-plugins/nri-memtierd) | container image name |
| `image.tag` | unstable | container image tag |
| `image.pullPolicy` | Always | image pull policy |
| `resources.cpu` | 250m | cpu resources for the Pod |
| `resources.memory` | 100Mi | memory qouta for the |
| `outputDir` | empty string | host directory for memtierd.output files |
| `nri.patchRuntimeConfig` | false | enable NRI in containerd or CRI-O |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `affinity` | [] | specify node affinity |
| `nodeSelector` | [] | specify node selector labels |
7 changes: 7 additions & 0 deletions deployment/helm/memtierd/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
nodeSelector:
kubernetes.io/os: "linux"
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
hostPID: true
{{- if .Values.nri.patchRuntimeConfig }}
initContainers:
Expand Down
21 changes: 21 additions & 0 deletions deployment/helm/memtierd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,24 @@ tolerations: []
# - key: "node-role.kubernetes.io/control-plane"
# operator: "Exists"
# effect: "NoSchedule"

affinity: []
#
# Example:
#
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: topology.kubernetes.io/disk
# operator: In
# values:
# - ssd

nodeSelector: []
#
# Example:
#
# nodeSelector:
# kubernetes.io/disk: "ssd"
6 changes: 4 additions & 2 deletions deployment/helm/sgx-epc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ customize with their own values, along with the default values.

| Name | Default | Description |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `image.name` | [ghcr.io/containers/nri-plugins/nri-sgx-epc](https://ghcr.io/containers/nri-plugins/nri-sgx-epc) | container image name |
| `image.name` | [ghcr.io/containers/nri-plugins/nri-sgx-epc](https://ghcr.io/containers/nri-plugins/nri-sgx-epc) | container image name |
| `image.tag` | unstable | container image tag |
| `image.pullPolicy` | Always | image pull policy |
| `resources.cpu` | 25m | cpu resources for the Pod |
| `resources.memory` | 100Mi | memory qouta for the |
| `nri.patchRuntimeConfig` | false | enable NRI in containerd or CRI-O |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `affinity` | [] | specify node affinity |
| `nodeSelector` | [] | specify node selector labels |
7 changes: 7 additions & 0 deletions deployment/helm/sgx-epc/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: Always
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
nodeSelector:
kubernetes.io/os: "linux"
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.nri.patchRuntimeConfig }}
initContainers:
- name: patch-runtime
Expand Down
21 changes: 21 additions & 0 deletions deployment/helm/sgx-epc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,24 @@ tolerations: []
# - key: "node-role.kubernetes.io/control-plane"
# operator: "Exists"
# effect: "NoSchedule"

affinity: []
#
# Example:
#
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: topology.kubernetes.io/disk
# operator: In
# values:
# - ssd

nodeSelector: []
#
# Example:
#
# nodeSelector:
# kubernetes.io/disk: "ssd"
4 changes: 3 additions & 1 deletion deployment/helm/topology-aware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ customize with their own values, along with the default values.
| `hostPort` | 8891 | metrics port to expose on the host |
| `config` | <pre><code>ReservedResources:</code><br><code> cpu: 750m</code></pre> | plugin configuration data |
| `nri.patchRuntimeConfig` | false | enable NRI in containerd or CRI-O |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.name` | [ghcr.io/containers/nri-plugins/config-manager](https://ghcr.io/containers/nri-plugins/config-manager) | init container image name |
| `initImage.tag` | unstable | init container image tag |
| `initImage.pullPolicy` | Always | init container image pull policy |
| `tolerations` | [] | specify taint toleration key, operator and effect |
| `affinity` | [] | specify node affinity |
| `nodeSelector` | [] | specify node selector labels |
7 changes: 7 additions & 0 deletions deployment/helm/topology-aware/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccount: nri-resource-policy-topology-aware
nodeSelector:
kubernetes.io/os: "linux"
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.nri.patchRuntimeConfig }}
initContainers:
- name: patch-runtime
Expand Down
21 changes: 21 additions & 0 deletions deployment/helm/topology-aware/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,24 @@ tolerations: []
# - key: "node-role.kubernetes.io/control-plane"
# operator: "Exists"
# effect: "NoSchedule"

affinity: []
#
# Example:
#
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: topology.kubernetes.io/disk
# operator: In
# values:
# - ssd

nodeSelector: []
#
# Example:
#
# nodeSelector:
# kubernetes.io/disk: "ssd"

0 comments on commit be77baf

Please sign in to comment.