Skip to content

Commit

Permalink
Make affinity in charts more generic (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannick-roeder authored May 24, 2024
1 parent 80610af commit eef6918
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 144 deletions.
8 changes: 3 additions & 5 deletions charts/producer-app-cleanup-job/templates/job.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- $root := . -}}

apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -42,11 +41,10 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- if .Values.nodeAffinity }}
nodeAffinity:
{{ toYaml .Values.nodeAffinity | indent 10 }}
{{- end }}
{{- tpl (toYaml .) $root | nindent 8 }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
Expand Down
22 changes: 4 additions & 18 deletions charts/producer-app-cleanup-job/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,10 @@ tolerations: []
# operator: "Exists"
# effect: "NoSchedule"

nodeAffinity: {}
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 1
# preference:
# matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz
## Affinity for pod assignment (evaluated as template)
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}

resources:
requests:
Expand Down
6 changes: 3 additions & 3 deletions charts/producer-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Alternatively, a YAML file that specifies the values for the parameters can be p
### Job

| Parameter | Description | Default |
|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `nameOverride` | The name of the Kubernetes deployment. | `bakdata-producer-app` |
| `resources` | See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | see [values.yaml](values.yaml) for details |
| `annotations` | Map of custom annotations to attach to the deployment. | `{}` |
| `labels` | Map of custom labels to attach to the deployment. | `{}` |
| `tolerations` | Array containing taint references. When defined, pods can run on nodes, which would otherwise deny scheduling. Further information can be found in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | `{}` |
| `nodeAffinity` | Map to configure [pod affinities](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity). | `{}` |
| `affinity` | Map to configure [pod affinities](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity). | `{}` |
| `deployment` | Deploy the producer as a Kubernetes Deployment (thereby ignoring Job-related configurations) | false |
| `restartPolicy` | [Restart policy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy) to use for the job. | `OnFailure` |
| `schedule` | Cron expression to denote a schedule this producer app should be run on. It will then be deployed as a [CronJob](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/) instead of a [Job](https://kubernetes.io/docs/concepts/workloads/controllers/job/). | |
Expand Down Expand Up @@ -57,7 +57,7 @@ Alternatively, a YAML file that specifies the values for the parameters can be p
### Other

| Parameter | Description | Default |
|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `configurationEnvPrefix` | Prefix for environment variables to use that should be parsed as command line arguments. | `APP` |
| `commandLine` | Map of command line arguments passed to the producer app. | `{}` |
| `debug` | Configure logging to debug | `false` |
Expand Down
7 changes: 3 additions & 4 deletions charts/producer-app/templates/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 4 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- if .Values.nodeAffinity }}
nodeAffinity:
{{ toYaml .Values.nodeAffinity | indent 6 }}
{{- end }}
{{- tpl (toYaml .) $root | nindent 4 }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
Expand Down
22 changes: 4 additions & 18 deletions charts/producer-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,10 @@ tolerations: []
# operator: "Exists"
# effect: "NoSchedule"

nodeAffinity: {}
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 1
# preference:
# matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz
## Affinity for pod assignment (evaluated as template)
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}

resources:
requests:
Expand Down
8 changes: 4 additions & 4 deletions charts/rclone-copy/templates/rclone-cron.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $root := . -}}
{{- if .Capabilities.APIVersions.Has "batch/v1/CronJob" }}
apiVersion: batch/v1
{{- else }}
Expand Down Expand Up @@ -49,11 +50,10 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- if .Values.nodeAffinity }}
nodeAffinity:
{{ toYaml .Values.nodeAffinity | indent 14 }}
{{- end }}
{{- tpl (toYaml .) $root | nindent 12 }}
{{- end }}
containers:
- name: rclone-container
image: rclone/rclone:{{ .Values.imageRelease }}
Expand Down
22 changes: 4 additions & 18 deletions charts/rclone-copy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,10 @@ tolerations: []
# operator: "Exists"
# effect: "NoSchedule"

nodeAffinity: {}
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 1
# preference:
# matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz
## Affinity for pod assignment (evaluated as template)
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}

resources:
requests:
Expand Down
8 changes: 3 additions & 5 deletions charts/streams-app-cleanup-job/templates/job.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- $root := . -}}

apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -42,11 +41,10 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- if .Values.nodeAffinity }}
nodeAffinity:
{{ toYaml .Values.nodeAffinity | indent 10 }}
{{- end }}
{{- tpl (toYaml .) $root | nindent 8 }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
Expand Down
23 changes: 5 additions & 18 deletions charts/streams-app-cleanup-job/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,11 @@ tolerations: []
# operator: "Exists"
# effect: "NoSchedule"

nodeAffinity: {}
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 1
# preference:
# matchExpressions:
# - key: foo
# operator: In
# values:
# - bar
# - baz

## Affinity for pod assignment (evaluated as template)
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}

resources:
requests:
Expand Down
Loading

0 comments on commit eef6918

Please sign in to comment.