diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2018-02-23 02:16:43 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2018-02-23 02:16:43 +0100 |
commit | ca5b5b005d2ca454015f8b0faa54372c60a0e40a (patch) | |
tree | e3dda23e189f4e15be0967ba83a31980dcd2d44d /roles | |
parent | e4751f88e52aa8e89e4c94bc6fe4c3346eccf6fe (diff) | |
download | ands-ca5b5b005d2ca454015f8b0faa54372c60a0e40a.tar.gz ands-ca5b5b005d2ca454015f8b0faa54372c60a0e40a.tar.bz2 ands-ca5b5b005d2ca454015f8b0faa54372c60a0e40a.tar.xz ands-ca5b5b005d2ca454015f8b0faa54372c60a0e40a.zip |
GlusterFS subpaths, ADEI frontend pods, fixes
Diffstat (limited to 'roles')
-rw-r--r-- | roles/ands_kaas/tasks/do_project.yml | 1 | ||||
-rw-r--r-- | roles/ands_kaas/tasks/file.yml | 2 | ||||
-rw-r--r-- | roles/ands_kaas/templates/00-gfs-volumes.yml.j2 (renamed from roles/ands_kaas/templates/0-gfs-volumes.yml.j2) | 4 | ||||
-rw-r--r-- | roles/ands_kaas/templates/50-kaas-pods.yml.j2 (renamed from roles/ands_kaas/templates/6-kaas-pods.yml.j2) | 25 | ||||
-rw-r--r-- | roles/openshift_resource/tasks/main.yml | 4 | ||||
-rw-r--r-- | roles/openshift_resource/tasks/resource.yml | 8 |
6 files changed, 23 insertions, 21 deletions
diff --git a/roles/ands_kaas/tasks/do_project.yml b/roles/ands_kaas/tasks/do_project.yml index 61b91d2..a876d94 100644 --- a/roles/ands_kaas/tasks/do_project.yml +++ b/roles/ands_kaas/tasks/do_project.yml @@ -59,4 +59,3 @@ - kaas_project_config.oc is undefined - kaas_project_config.pods != {} - diff --git a/roles/ands_kaas/tasks/file.yml b/roles/ands_kaas/tasks/file.yml index 479ec68..e6b2e8d 100644 --- a/roles/ands_kaas/tasks/file.yml +++ b/roles/ands_kaas/tasks/file.yml @@ -16,7 +16,7 @@ - name: "Setting up files in {{ path }}" file: path: "{{ path }}" - recurse: "{{ file.recurse | default(true) }}" + recurse: "{{ file.recurse | default(false) }}" mode: "{{ file.mode | default( ((file.state | default('directory')) == 'directory') | ternary('0755', '0644') ) }}" owner: "{{ owner }}" group: "{{ group }}" diff --git a/roles/ands_kaas/templates/0-gfs-volumes.yml.j2 b/roles/ands_kaas/templates/00-gfs-volumes.yml.j2 index 8e5842a..c90c610 100644 --- a/roles/ands_kaas/templates/0-gfs-volumes.yml.j2 +++ b/roles/ands_kaas/templates/00-gfs-volumes.yml.j2 @@ -16,10 +16,10 @@ objects: persistentVolumeReclaimPolicy: Retain glusterfs: endpoints: {{ kaas_glusterfs_endpoints }} - path: {{ vol.volume }} + path: "{{ vol.volume }}{{vol.path}}" readOnly: {{ not (vol.write | default(false)) }} accessModes: - - {{ vol.access | default('ReadWriteMany') }} + - {{ vol.access | default(vol.write | default(false) | ternary('ReadWriteMany', 'ReadOnlyMany')) }} capacity: storage: {{ vol.capacity | default(kaas_default_volume_capacity) }} claimRef: diff --git a/roles/ands_kaas/templates/6-kaas-pods.yml.j2 b/roles/ands_kaas/templates/50-kaas-pods.yml.j2 index d5418d3..49dab3f 100644 --- a/roles/ands_kaas/templates/6-kaas-pods.yml.j2 +++ b/roles/ands_kaas/templates/50-kaas-pods.yml.j2 @@ -32,7 +32,7 @@ objects: {% endfor %} {% endif %} {% if (pod.service.ports is defined) and (pod.service.host is defined) %} - {% set first_port = (pod.service.ports[0] | string).split('/')[0] %} + {% set first_port = (pod.service.ports[0] | string).split('/') %} - apiVersion: v1 kind: Route metadata: @@ -43,8 +43,8 @@ objects: kind: Service name: {{ pod.name | default(name) }} port: - targetPort: {{ first_port }} - {% if (first_port == "80") %} + targetPort: {{ (first_port[1] is defined) | ternary(first_port[1], first_port[0]) }} + {% if (first_port[0] == "80") %} tls: termination: edge insecureEdgeTerminationPolicy: Allow @@ -69,6 +69,11 @@ objects: name: {{ pod.name | default(name) }} spec: replicas: {{ pod.sched.replicas | default(1) }} + revisionHistoryLimit: 2 + strategy: + type: {{ pod.sched.strategy | default('Rolling') }} + triggers: + - type: ConfigChange selector: name: {{ pod.name | default(name) }} template: @@ -76,10 +81,6 @@ objects: name: {{ pod.name | default(name) }} labels: name: {{ pod.name | default(name) }} - strategy: - type: {{ pod.sched.strategy | default('Rolling') }} - triggers: - - type: ConfigChange spec: {% if pod.selector is defined %} nodeSelector: @@ -106,7 +107,7 @@ objects: {% if (kaas_project_config.uids | default(kaas_openshift_uids))[pod.run_as] is defined %} - {{ (kaas_project_config.uids | default(kaas_openshift_uids))[pod.run_as].id }} {% else %} - - pod.run_as + - {{ pod.run_as }} {% endif %} {% endif %} {% if (pod.groups is defined) %} @@ -115,7 +116,7 @@ objects: {% if (kaas_project_config.gids | default(kaas_openshift_gids))[group] is defined %} - {{ (kaas_project_config.gids | default(kaas_openshift_gids))[group].id }} {% else %} - - group + - {{ group }} {% endif %} {% endfor %} {% endif %} @@ -165,18 +166,18 @@ objects: volumeMounts: {% for vol in img.mappings %} - name: vol-{{imgidx}}-{{loop.index}} - subPath: {{ (((kaas_project_config.volumes | default(kaas_openshift_volumes))[vol.name].path | default("")) ~ "/") | regex_replace('^/','') }}{{ vol.path | default("") }} + subPath: {{ vol.path | default("") }} mountPath: {{ vol.mount }} {% endfor %} {% endif %} {% if img.probes is defined %} {% for probe in img.probes %} {% if (probe.type is undefined) %} - {% set seq = ['livenessProbe', 'readynessProbe'] %} + {% set seq = ['livenessProbe', 'readinessProbe'] %} {% elif (probe.type == "liveness") %} {% set seq = ['livenessProbe'] %} {% else %} - {% set seq = ['readynessProbe'] %} + {% set seq = ['readinessProbe'] %} {% endif %} {% for type in seq %} {{ type }}: diff --git a/roles/openshift_resource/tasks/main.yml b/roles/openshift_resource/tasks/main.yml index d44d2e0..af071f9 100644 --- a/roles/openshift_resource/tasks/main.yml +++ b/roles/openshift_resource/tasks/main.yml @@ -14,9 +14,9 @@ when: template.find(".json") == -1 - include_tasks: template.yml - when: tmpl.kind == "Template" + when: (tmpl.kind == "Template") and (tmpl.parameters is not defined) - include_tasks: resource.yml - when: tmpl.kind != "Template" + when: (tmpl.parameters is defined) or (tmpl.kind != "Template") run_once: true diff --git a/roles/openshift_resource/tasks/resource.yml b/roles/openshift_resource/tasks/resource.yml index 326abbb..769a89c 100644 --- a/roles/openshift_resource/tasks/resource.yml +++ b/roles/openshift_resource/tasks/resource.yml @@ -5,16 +5,18 @@ - name: Lookup the specified resource command: "oc get -n {{project}} {{rkind}}/{{rname}}" - register: result + register: find_result + changed_when: false failed_when: false - changed_when: (result | failed) - name: Detroy existing resources command: "oc delete -n {{project}} {{rkind}}/{{rname}}" + register: rm_result failed_when: false + changed_when: (rm_result | succeeded) when: (recreate|default(false)) - name: Create resources defined in template command: "oc create -n {{project}} -f '{{ template_path }}/{{ template }}' {{ create_args | default('') }}" - when: (recreate|default(false)) or (result | changed) + when: (recreate|default(false)) or (find_result.rc != 0) run_once: true |