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

Feat: Add custom affinity config #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion charts/dremio_v2/templates/_helpers_coordinator.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,15 @@ Coordinator - Pod Tolerations
tolerations:
{{- toYaml $coordinatorTolerations | nindent 2 }}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Coordinator - Pod Affinity
*/}}
{{- define "dremio.coordinator.affinity" -}}
{{- $coordinatorAffinity := coalesce $.Values.coordinator.affinity $.Values.affinity -}}
{{- if $coordinatorAffinity -}}
affinity:
{{- toYaml $coordinatorAffinity | nindent 2 }}
{{- end -}}
{{- end -}}
16 changes: 15 additions & 1 deletion charts/dremio_v2/templates/_helpers_executor.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,18 @@ Executor - Pod Tolerations
tolerations:
{{- toYaml $engineTolerations | nindent 2 }}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Executor - Pod Affinity
*/}}
{{- define "dremio.executor.affinity" -}}
{{- $context := index . 0 -}}
{{- $engineName := index . 1 -}}
{{- $engineConfiguration := default (dict) (get (default (dict) $context.Values.executor.engineOverride) $engineName) -}}
{{- $engineAffinity := coalesce $engineConfiguration.affinity $context.Values.executor.affinity $context.Values.affinity -}}
{{- if $engineAffinity -}}
affinity:
{{- toYaml $engineAffinity | nindent 2 }}
{{- end -}}
{{- end -}}
13 changes: 12 additions & 1 deletion charts/dremio_v2/templates/_helpers_general.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,15 @@ Admin - Pod Tolerations
tolerations:
{{- toYaml $adminPodTolerations | nindent 2 }}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Admin - Pod Affinity
*/}}
{{- define "dremio.admin.affinity" -}}
{{- $adminPodAffinity := coalesce $.Values.coordinator.affinity $.Values.affinity -}}
{{- if $adminPodAffinity -}}
affinity:
{{- toYaml $adminPodAffinity | nindent 2 }}
{{- end -}}
{{- end -}}
13 changes: 12 additions & 1 deletion charts/dremio_v2/templates/_helpers_zookeeper.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,15 @@ Zookeeper - Pod Tolerations
tolerations:
{{- toYaml $zookeeperTolerations | nindent 2 }}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Zookeeper - Pod Affinity
*/}}
{{- define "dremio.zookeeper.affinity" -}}
{{- $zookeeperAffinity := coalesce $.Values.zookeeper.affinity $.Values.affinity -}}
{{- if $zookeeperAffinity -}}
affinity:
{{- toYaml $zookeeperAffinity | nindent 2 }}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions charts/dremio_v2/templates/dremio-admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
{{- include "dremio.imagePullSecrets" $ | nindent 2 }}
{{- include "dremio.admin.nodeSelector" $ | nindent 2 }}
{{- include "dremio.admin.tolerations" $ | nindent 2 }}
{{- include "dremio.admin.affinity" $ | nindent 2 }}
volumes:
- name: dremio-master-volume
persistentVolumeClaim:
Expand Down
4 changes: 3 additions & 1 deletion charts/dremio_v2/templates/dremio-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ spec:
spec:
{{- include "dremio.coordinator.serviceAccount" $ | nindent 6 }}
terminationGracePeriodSeconds: 120
affinity:
{{- include "dremio.coordinator.affinity" $ | nindent 8 }}
{{- include "dremio.coordinator.nodeSelector" $ | nindent 6 }}
{{- include "dremio.coordinator.tolerations" $ | nindent 6 }}
containers:
Expand Down Expand Up @@ -176,4 +178,4 @@ spec:
{{- end }}
{{- include "dremio.coordinator.extraVolumes" $ | nindent 6 }}
{{- include "dremio.imagePullSecrets" $ | nindent 6}}
{{- end -}}
{{- end -}}
1 change: 1 addition & 0 deletions charts/dremio_v2/templates/dremio-executor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
terminationGracePeriodSeconds: 120
{{- include "dremio.executor.nodeSelector" (list $ $engineName) | nindent 6}}
{{- include "dremio.executor.tolerations" (list $ $engineName) | nindent 6}}
{{- include "dremio.executor.affinity" (list $ $engineName) | nindent 6}}
containers:
- name: dremio-executor
image: {{ $.Values.image }}:{{ $.Values.imageTag }}
Expand Down
11 changes: 1 addition & 10 deletions charts/dremio_v2/templates/dremio-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,7 @@ spec:
{{- include "dremio.coordinator.podAnnotations" $ | nindent 8}}
spec:
{{- include "dremio.coordinator.serviceAccount" $ | nindent 6 }}
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- dremio-coordinator
topologyKey: "kubernetes.io/hostname"
{{- include "dremio.coordinator.affinity" $ | nindent 6 }}
terminationGracePeriodSeconds: 120
{{- include "dremio.coordinator.nodeSelector" $ | nindent 6 }}
{{- include "dremio.coordinator.tolerations" $ | nindent 6 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/dremio_v2/templates/dremio-service-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ spec:
clusterIP: None
selector:
role: dremio-cluster-pod
{{- end -}}
{{- end -}}
11 changes: 1 addition & 10 deletions charts/dremio_v2/templates/zookeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,7 @@ spec:
{{- include "dremio.zookeeper.podAnnotations" $ | nindent 8 }}
spec:
{{- include "dremio.zookeeper.serviceAccount" $ | nindent 6 }}
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- zk
topologyKey: "kubernetes.io/hostname"
{{- include "dremio.zookeeper.affinity" $ | nindent 6 }}
{{- include "dremio.zookeeper.nodeSelector" $ | nindent 6 }}
{{- include "dremio.zookeeper.tolerations" $ | nindent 6 }}
containers:
Expand Down
25 changes: 24 additions & 1 deletion charts/dremio_v2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ labels: {}
podLabels: {}
nodeSelector: {}
tolerations: []
affinity: {}

# Dremio Coordinator
coordinator:
Expand Down Expand Up @@ -78,6 +79,16 @@ coordinator:
#podLabels: {}
#nodeSelector: {}
#tolerations: []
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- dremio-coordinator
topologyKey: "kubernetes.io/hostname"

# Web UI
web:
Expand Down Expand Up @@ -180,14 +191,15 @@ executor:
volumes:
- size: 100Gi

# These values, when defined and not empty, override the provided shared annotations, labels, node selectors, or tolerations.
# These values, when defined and not empty, override the provided shared annotations, labels, node selectors, tolerations, or affinity.
# Uncomment only if you are trying to override the chart's shared values.
#annotations: {}
#podAnnotations: {}
#labels: {}
#podLabels: {}
#nodeSelector: {}
#tolerations: []
#affinity: {}

# Engine Overrides
#
Expand Down Expand Up @@ -216,6 +228,7 @@ executor:
# podLabels: {}
# nodeSelector: {}
# tolerations: []
# affinity: {}
#
# serviceAccount: ""
#
Expand Down Expand Up @@ -275,6 +288,16 @@ zookeeper:
#podLabels: {}
#nodeSelector: {}
#tolerations: []
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- zk
topologyKey: "kubernetes.io/hostname"

# Control where uploaded files are stored for Dremio.
# For more information, see https://docs.dremio.com/deployment/distributed-storage.html
Expand Down