From f3c41dd13a0a86382b80d564e9de0d6b06fb1dbf Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 11 Mar 2018 19:56:38 +0100 Subject: Various fixes before moving to hardware installation --- roles/ands_kaas/templates/50-kaas-pods.yml.j2 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'roles/ands_kaas/templates/50-kaas-pods.yml.j2') 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 %} -- cgit v1.2.3