blob: 16e886eb4c18b9450f0e6de6f76bef5208b958c9 [file] [log] [blame]
Ilya Kharinfd293c42017-03-14 17:34:12 +04001{%- from "devops_portal/map.jinja" import config with context %}
Ilya Kharina7167fb2017-03-16 15:30:14 +04002{%- from "devops_portal/map.jinja" import setup with context %}
3{%- if setup.engine == "kubernetes" %}
4{%- set namespace = setup.kubernetes.namespace|default("oss") %}
Ilya Kharin6e041862017-03-06 15:32:28 +04005
6devops_portal_kubernetes_dir:
7 file.directory:
Ilya Kharinfd293c42017-03-14 17:34:12 +04008 - name: {{ config.base_dir }}/kubernetes
Ilya Kharin6e041862017-03-06 15:32:28 +04009 - user: root
10 - group: root
11 - mode: 0755
12 - makedirs: true
13
14devops_portal_k8s_svc:
15 file.managed:
Ilya Kharinfd293c42017-03-14 17:34:12 +040016 - name: {{ config.base_dir }}/kubernetes/devops_portal-svc.yaml
Ilya Kharin6e041862017-03-06 15:32:28 +040017 - source: salt://devops_portal/files/kubernetes/devops_portal-svc.yaml
18 - template: jinja
19 - require:
20 - file: devops_portal_kubernetes_dir
21
22devops_portal_k8s_cm:
23 file.managed:
Ilya Kharinfd293c42017-03-14 17:34:12 +040024 - name: {{ config.base_dir }}/kubernetes/devops_portal-cm.yaml
Ilya Kharin6e041862017-03-06 15:32:28 +040025 - source: salt://devops_portal/files/kubernetes/devops_portal-cm.yaml
26 - template: jinja
27 - require:
28 - file: devops_portal_kubernetes_dir
29 - file: devops_portal_nginx_conf
30 - file: devops_portal_config
31
32devops_portal_k8s_deploy:
33 file.managed:
Ilya Kharinfd293c42017-03-14 17:34:12 +040034 - name: {{ config.base_dir }}/kubernetes/devops_portal-deploy.yaml
Ilya Kharin6e041862017-03-06 15:32:28 +040035 - source: salt://devops_portal/files/kubernetes/devops_portal-deploy.yaml
36 - template: jinja
37 - require:
38 - file: devops_portal_kubernetes_dir
39 - file: devops_portal_k8s_cm
40
41devop_portal_namespace:
42 cmd.run:
43 - name: hyperkube kubectl create namespace {{ namespace }}
44 - unless: hyperkube kubectl get namespaces {{ namespace }}
45
46apply_devops_portal:
47 cmd.run:
48 - name: hyperkube kubectl apply
Ilya Kharinfd293c42017-03-14 17:34:12 +040049 --filename {{ config.base_dir }}/kubernetes/devops_portal-svc.yaml
50 --filename {{ config.base_dir }}/kubernetes/devops_portal-cm.yaml
51 --filename {{ config.base_dir }}/kubernetes/devops_portal-deploy.yaml
Ilya Kharin6e041862017-03-06 15:32:28 +040052 --namespace={{ namespace }}
53 --record
54 - require:
55 - cmd: devop_portal_namespace
56 - file: devops_portal_k8s_svc
57 - file: devops_portal_k8s_cm
58 - file: devops_portal_k8s_deploy
59
60{%- endif %}