summaryrefslogtreecommitdiffstats
path: root/roles/ands_kaas
diff options
context:
space:
mode:
Diffstat (limited to 'roles/ands_kaas')
-rw-r--r--roles/ands_kaas/templates/50-kaas-pods.yml.j216
1 files changed, 8 insertions, 8 deletions
diff --git a/roles/ands_kaas/templates/50-kaas-pods.yml.j2 b/roles/ands_kaas/templates/50-kaas-pods.yml.j2
index 216dc01..ad1fc58 100644
--- a/roles/ands_kaas/templates/50-kaas-pods.yml.j2
+++ b/roles/ands_kaas/templates/50-kaas-pods.yml.j2
@@ -5,7 +5,7 @@ kind: Template
metadata:
name: {{ kaas_project }}-pods
annotations:
- descriptions: {{ kaas_project_config.description | default(kaas_project ~ "auto-generated pod template") }}
+ descriptions: {{ kaas_project_config.description | default(kaas_project ~ " auto-generated pod template") }}
objects:
{% for name, pod in kaas_project_pods.iteritems() %}
{% set pubkey = "kaas_" ~ name ~ "_pubkey" %}
@@ -14,6 +14,9 @@ objects:
{% if pod.variant is defined %}
{% set pod = pod[pod.variant] %}
{% endif %}
+ {% set sched = pod.sched | default({}) %}
+ {% set node_selector = (sched.selector is defined) | ternary(sched.selector, ands_default_node_selector | combine(sched.restrict | default({}))) %}
+
{% if pod.service is defined %}
- apiVersion: v1
kind: Service
@@ -68,10 +71,10 @@ objects:
metadata:
name: {{ pod.name | default(name) }}
spec:
- replicas: {{ ( pod.sched | default({})).replicas | default(1) }}
+ replicas: {{ ( sched | default({})).replicas | default(1) }}
revisionHistoryLimit: 2
strategy:
- type: {{ (pod.sched | default({})).strategy | default('Rolling') }}
+ type: {{ (sched | default({})).strategy | default('Rolling') }}
triggers:
- type: ConfigChange
selector:
@@ -82,11 +85,8 @@ objects:
labels:
name: {{ pod.name | default(name) }}
spec:
- {% if pod.selector is defined %}
- nodeSelector:
- {% for skey, sval in pod.selector.iteritems() %}
- {{ skey }}: "{{ sval }}"
- {% endfor %}
+ {% if node_selector | length > 0 %}
+ nodeSelector: {{ node_selector | to_json }}
{% endif %}
{% set mappings = (pod.images | json_query('[*].mappings') | length) %}
{% if mappings > 0 %}