Skip to content

feat: add tolerations, affinity, volumes & volumeMounts #9

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

Merged
merged 10 commits into from
Apr 18, 2023
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 stable/firehose/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: firehose
description: A Helm chart for deploying Firehose on Kubernetes
type: application
version: 0.1.3
version: 0.1.4
appVersion: 0.7.1
24 changes: 24 additions & 0 deletions stable/firehose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,30 @@ The following table lists the configurable parameters of Firehose chart and thei
| telegraf.resources.limits.memory | string | `"64Mi"` | telegraf container memory limit |
| telegraf.resources.requests.cpu | string | `"50m"` | telegraf container cpu requests |
| telegraf.resources.requests.memory | string | `"64Mi"` | telegraf container memory requests |
| tolerations | list | - | List of Kubernetes [tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
| volumes | list | - | List of Kubernetes [volumes](https://kubernetes.io/docs/concepts/storage/volumes/) |
| volumeMounts | list | - | List of Kubernetes [volume mounts](https://kubernetes.io/docs/concepts/storage/volumes/#using-volumes) |
| nodeAffinityMatchExpressions.requiredDuringSchedulingIgnoredDuringExecution | list | - | List of Kubernetes [node affinity match expressions](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity) that are required for the pod to be scheduled on a node |
| nodeAffinityMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution | list | - | List of Kubernetes [preferred node affinity match expressions](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#preferred-during-scheduling-ignoreduringexecution) for the pod scheduling |
| tolerations.key | string | `"key1"` | Key to be mached |
| tolerations.operator | string | `"Equal"` | Operation to be checked |
| tolerations.value | string | `"value1"` | Values against which operation is performed |
| tolerations.effect | string | `"NoSchedule"` | Taint effect |
| volumes.name | string | - | Name of the Kubernetes volume |
| volumes.items.key | string | - | Key of the secret data |
| volumes.items.path | string | - | Path where the secret data will be mounted |
| volumes.secretName | string | - | Name of the Kubernetes secret |
| volumes.defaultMode | integer | - | Default file permissions for the volume |
| volumeMounts.name | string | - | Name of the Kubernetes volume |
| volumeMounts.mountPath | string | - | Path within the container where the volume should be mounted |
| nodeAffinityMatchExpressions.requiredDuringSchedulingIgnoredDuringExecution.key | string | - | Key of the node affinity match expression |
| nodeAffinityMatchExpressions.requiredDuringSchedulingIgnoredDuringExecution.operator | string | - | Operator of the node affinity match expression |
| nodeAffinityMatchExpressions.requiredDuringSchedulingIgnoredDuringExecution.values | list | - | List of values of the node affinity match expression |
| nodeAffinityMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution.weight | integer | - | Weight of the preferred node affinity match expression |
| nodeAffinityMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution.preference.key | string | - | Key of the preferred node affinity match expression |
| nodeAffinityMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution.preference.operator | string | - | Operator of the preferred node affinity match expression |
| nodeAffinityMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution.preference.values | list | - | List of values of the preferred node affinity match expression |

---

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
Expand Down
54 changes: 54 additions & 0 deletions stable/firehose/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ spec:
name: {{ .Chart.Name }}
image: "{{ .Values.firehose.image.repository }}:{{ .Values.firehose.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.firehose.image.pullPolicy }}
{{- if or (index .Values "init-firehose" "enabled") (gt (len .Values.volumeMounts) 0) }}
volumeMounts:
{{- if index .Values "init-firehose" "enabled" }}
- mountPath: /work-dir
name: workdir
{{- end }}
{{- range $_, $volumeMount := .Values.volumeMounts }}
- name: {{ $volumeMount.name}}
mountPath: {{ $volumeMount.mountPath }}
{{- end}}
{{- end}}
resources:
{{- toYaml .Values.firehose.resources | nindent 12 }}
envFrom:
Expand Down Expand Up @@ -75,6 +81,7 @@ spec:
- mountPath: /work-dir
name: workdir
{{- end }}
{{if or (index .Values.telegraf.enabled) (index .Values "init-firehose" "enabled") (gt (len .Values.volumes) 0)}}
volumes:
{{- if index .Values.telegraf.enabled }}
- configMap:
Expand All @@ -85,3 +92,50 @@ spec:
- emptyDir: {}
name: workdir
{{- end }}
{{- range $_, $volume := .Values.volumes }}
- name: {{ $volume.name}}
secretName: {{ $volume.secretName }}
defaultMode: {{ $volume.defaultMode }}
items: {{- range $_, $item := $volume.items }}
- key: {{ $item.key }}
path: {{ $item.path }}
{{- end}}
{{- end}}
{{- end}}

{{- if (gt (len .Values.tolerations) 0) }}
tolerations: {{- range $_, $toleration := .Values.tolerations }}
- key: {{ $toleration.key }}
operator: {{ $toleration.operator }}
value: {{ $toleration.value }}
effect: {{ $toleration.effect }}
{{- end }}
{{- end}}
{{- if or (gt (len .Values.nodeAffinitiyMatchExpressions.requiredDuringSchedulingIgnoredDuringExecution) 0) (gt (len .Values.nodeAffinitiyMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution) 0) }}
affinity:
nodeAffinity:
{{- if (gt (len .Values.nodeAffinitiyMatchExpressions.requiredDuringSchedulingIgnoredDuringExecution) 0) }}
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions: {{- range $_, $expression := .Values.nodeAffinitiyMatchExpressions.requiredDuringSchedulingIgnoredDuringExecution }}
- key: {{ $expression.key }}
operator: {{ $expression.operator }}
values: {{- range $expression.values }}
- {{ . }}
{{- end}}
{{- end}}
{{- end}}
{{- if (gt (len .Values.nodeAffinitiyMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution) 0) }}
preferredDuringSchedulingIgnoredDuringExecution: {{- range $_, $expression := .Values.nodeAffinitiyMatchExpressions.preferredDuringSchedulingIgnoredDuringExecution }}
- weight: {{ $expression.weight}}
preference:
matchExpressions: {{- range $_, $pref := $expression.preference }}
- key: {{ $pref.key }}
operator: {{ $pref.operator }}
values: {{- range $pref.values }}
- {{ . }}
{{- end}}
{{- end}}
{{- end}}
{{- end}}
{{- end}}
10 changes: 10 additions & 0 deletions stable/firehose/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ firehose:
cpu: 200m
memory: 512Mi

tolerations: []

volumes: []

volumeMounts: []

nodeAffinitiyMatchExpressions:
requiredDuringSchedulingIgnoredDuringExecution: []
preferredDuringSchedulingIgnoredDuringExecution: []

init-firehose:
enabled: false
image:
Expand Down