Skip to content
Snippets Groups Projects
Verified Commit 6bfebb46 authored by Philipp S. Sommer's avatar Philipp S. Sommer
Browse files

only check the volumes mounted in the cronjob for podAffinity

parent 4075fdb8
No related branches found
No related tags found
No related merge requests found
Pipeline #266317 passed
......@@ -10,14 +10,14 @@
{%- raw %}
{{- /* due to scoping we need to use a dict for requiredPodAffinity and override the value if necessary */}}
{{- $requiredPodAffinity := dict "isRequired" false }}
{{- $builtinVolumes := include "{% endraw %}{{ cookiecutter.template_base_name }}{% raw %}.builtinVolumes" . | fromYaml }}
{{- $allVolumes := mustMergeOverwrite (dict) $builtinVolumes .Values.volumes }}
{{- range $name, $options := $allVolumes }}
{{- /* Check the necessity of podAffinity */}}
{{- if and (not $options.projected) (hasKey $options "accessModes") }}
{{- range $options.accessModes }}
{{- if eq . "ReadWriteOnce" }}
{{- $_ := set $requiredPodAffinity "isRequired" true }}
{{- if .volumes }}
{{- range $name, $options := .volumes }}
{{- /* Check the necessity of podAffinity */}}
{{- if and (not $options.projected) (hasKey $options "accessModes") }}
{{- range $options.accessModes }}
{{- if eq . "ReadWriteOnce" }}
{{- $_ := set $requiredPodAffinity "isRequired" true }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
......@@ -33,7 +33,6 @@ jobTemplate:
parent: {%raw %}{{ .name | quote }}{% endraw %}
spec:
{%- if cookiecutter.__include_volume != 'no' %}
{%- raw %}{{- if .volumes }}{%- endraw %}
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
......@@ -44,7 +43,6 @@ jobTemplate:
{{ "{{-" }} include "{{ cookiecutter.template_base_name }}.selectorLabels" $ | nindent 20 {{ "}}" }}
topologyKey: kubernetes.io/hostname
{% raw %}{{- end }}{% endraw %}
{%- raw %}{{- end }}{%- endraw %}
{%- endif %}
containers:
- name: {%raw %}{{ .name | quote }}{% endraw %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment