Ilya Kharin | fd293c4 | 2017-03-14 17:34:12 +0400 | [diff] [blame^] | 1 | {%- from "devops_portal/map.jinja" import config with context %} |
| 2 | {%- if config.setup.engine == "kubernetes" %} |
| 3 | {%- set namespace = config.setup.kubernetes.namespace|default("oss") %} |
Ilya Kharin | 6e04186 | 2017-03-06 15:32:28 +0400 | [diff] [blame] | 4 | |
| 5 | devops_portal_kubernetes_dir: |
| 6 | file.directory: |
Ilya Kharin | fd293c4 | 2017-03-14 17:34:12 +0400 | [diff] [blame^] | 7 | - name: {{ config.base_dir }}/kubernetes |
Ilya Kharin | 6e04186 | 2017-03-06 15:32:28 +0400 | [diff] [blame] | 8 | - user: root |
| 9 | - group: root |
| 10 | - mode: 0755 |
| 11 | - makedirs: true |
| 12 | |
| 13 | devops_portal_k8s_svc: |
| 14 | file.managed: |
Ilya Kharin | fd293c4 | 2017-03-14 17:34:12 +0400 | [diff] [blame^] | 15 | - name: {{ config.base_dir }}/kubernetes/devops_portal-svc.yaml |
Ilya Kharin | 6e04186 | 2017-03-06 15:32:28 +0400 | [diff] [blame] | 16 | - source: salt://devops_portal/files/kubernetes/devops_portal-svc.yaml |
| 17 | - template: jinja |
| 18 | - require: |
| 19 | - file: devops_portal_kubernetes_dir |
| 20 | |
| 21 | devops_portal_k8s_cm: |
| 22 | file.managed: |
Ilya Kharin | fd293c4 | 2017-03-14 17:34:12 +0400 | [diff] [blame^] | 23 | - name: {{ config.base_dir }}/kubernetes/devops_portal-cm.yaml |
Ilya Kharin | 6e04186 | 2017-03-06 15:32:28 +0400 | [diff] [blame] | 24 | - source: salt://devops_portal/files/kubernetes/devops_portal-cm.yaml |
| 25 | - template: jinja |
| 26 | - require: |
| 27 | - file: devops_portal_kubernetes_dir |
| 28 | - file: devops_portal_nginx_conf |
| 29 | - file: devops_portal_config |
| 30 | |
| 31 | devops_portal_k8s_deploy: |
| 32 | file.managed: |
Ilya Kharin | fd293c4 | 2017-03-14 17:34:12 +0400 | [diff] [blame^] | 33 | - name: {{ config.base_dir }}/kubernetes/devops_portal-deploy.yaml |
Ilya Kharin | 6e04186 | 2017-03-06 15:32:28 +0400 | [diff] [blame] | 34 | - source: salt://devops_portal/files/kubernetes/devops_portal-deploy.yaml |
| 35 | - template: jinja |
| 36 | - require: |
| 37 | - file: devops_portal_kubernetes_dir |
| 38 | - file: devops_portal_k8s_cm |
| 39 | |
| 40 | devop_portal_namespace: |
| 41 | cmd.run: |
| 42 | - name: hyperkube kubectl create namespace {{ namespace }} |
| 43 | - unless: hyperkube kubectl get namespaces {{ namespace }} |
| 44 | |
| 45 | apply_devops_portal: |
| 46 | cmd.run: |
| 47 | - name: hyperkube kubectl apply |
Ilya Kharin | fd293c4 | 2017-03-14 17:34:12 +0400 | [diff] [blame^] | 48 | --filename {{ config.base_dir }}/kubernetes/devops_portal-svc.yaml |
| 49 | --filename {{ config.base_dir }}/kubernetes/devops_portal-cm.yaml |
| 50 | --filename {{ config.base_dir }}/kubernetes/devops_portal-deploy.yaml |
Ilya Kharin | 6e04186 | 2017-03-06 15:32:28 +0400 | [diff] [blame] | 51 | --namespace={{ namespace }} |
| 52 | --record |
| 53 | - require: |
| 54 | - cmd: devop_portal_namespace |
| 55 | - file: devops_portal_k8s_svc |
| 56 | - file: devops_portal_k8s_cm |
| 57 | - file: devops_portal_k8s_deploy |
| 58 | |
| 59 | {%- endif %} |