Skip to content

Commit

Permalink
Add affinity to jobTemplate (#2758)
Browse files Browse the repository at this point in the history
  • Loading branch information
takuyaymd authored Dec 3, 2024
1 parent 3d51a12 commit 9bd9034
Show file tree
Hide file tree
Showing 4 changed files with 435 additions and 0 deletions.
159 changes: 159 additions & 0 deletions charts/vald-helm-operator/crds/valdrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8406,6 +8406,51 @@ spec:
corrector:
type: object
properties:
affinity:
type: object
properties:
nodeAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: object
properties:
nodeSelectorTerms:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
podAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
podAntiAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
agent_namespace:
type: string
discoverer:
Expand Down Expand Up @@ -9037,6 +9082,9 @@ spec:
type: string
node_name:
type: string
nodeSelector:
type: object
x-kubernetes-preserve-unknown-fields: true
observability:
type: object
properties:
Expand Down Expand Up @@ -9714,6 +9762,11 @@ spec:
minimum: 1
suspend:
type: boolean
tolerations:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
ttlSecondsAfterFinished:
type: integer
version:
Expand All @@ -9722,6 +9775,51 @@ spec:
creator:
type: object
properties:
affinity:
type: object
properties:
nodeAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: object
properties:
nodeSelectorTerms:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
podAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
podAntiAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
agent_namespace:
type: string
concurrency:
Expand Down Expand Up @@ -10157,6 +10255,9 @@ spec:
type: string
node_name:
type: string
nodeSelector:
type: object
x-kubernetes-preserve-unknown-fields: true
observability:
type: object
properties:
Expand Down Expand Up @@ -10835,6 +10936,11 @@ spec:
type: array
items:
type: string
tolerations:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
ttlSecondsAfterFinished:
type: integer
version:
Expand Down Expand Up @@ -13012,6 +13118,51 @@ spec:
saver:
type: object
properties:
affinity:
type: object
properties:
nodeAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: object
properties:
nodeSelectorTerms:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
podAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
podAntiAffinity:
type: object
properties:
preferredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
requiredDuringSchedulingIgnoredDuringExecution:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
agent_namespace:
type: string
concurrency:
Expand Down Expand Up @@ -13445,6 +13596,9 @@ spec:
type: string
node_name:
type: string
nodeSelector:
type: object
x-kubernetes-preserve-unknown-fields: true
observability:
type: object
properties:
Expand Down Expand Up @@ -14123,6 +14277,11 @@ spec:
type: array
items:
type: string
tolerations:
type: array
items:
type: object
x-kubernetes-preserve-unknown-fields: true
ttlSecondsAfterFinished:
type: integer
version:
Expand Down
12 changes: 12 additions & 0 deletions charts/vald/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,10 @@ spec:
{{- toYaml .Job.securityContext | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Job.affinity }}
affinity:
{{- include "vald.affinity" .Job.affinity | nindent 8 }}
{{- end }}
containers:
- name: {{ .Job.name }}
image: "{{ .Job.image.repository }}:{{ default .default.Values.defaults.image.tag .Job.image.tag }}"
Expand Down Expand Up @@ -929,6 +933,14 @@ spec:
configMap:
defaultMode: 420
name: {{ .Job.name }}-config
{{- if .Job.nodeSelector }}
nodeSelector:
{{- toYaml .Job.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Job.tolerations }}
tolerations:
{{- toYaml .Job.tolerations | nindent 8 }}
{{- end }}
{{- if .Job.serviceAccount }}
serviceAccountName: {{ .Job.serviceAccount.name }}
{{- end }}
Expand Down
Loading

0 comments on commit 9bd9034

Please sign in to comment.