blob: ecafbe1936931a95d200d6e35fe0db58aff8f4bb [file] [log] [blame]
Ilya Kharinfd293c42017-03-14 17:34:12 +04001{%- 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 Kharin6e041862017-03-06 15:32:28 +04004
5devops_portal_kubernetes_dir:
6 file.directory:
Ilya Kharinfd293c42017-03-14 17:34:12 +04007 - name: {{ config.base_dir }}/kubernetes
Ilya Kharin6e041862017-03-06 15:32:28 +04008 - user: root
9 - group: root
10 - mode: 0755
11 - makedirs: true
12
13devops_portal_k8s_svc:
14 file.managed:
Ilya Kharinfd293c42017-03-14 17:34:12 +040015 - name: {{ config.base_dir }}/kubernetes/devops_portal-svc.yaml
Ilya Kharin6e041862017-03-06 15:32:28 +040016 - source: salt://devops_portal/files/kubernetes/devops_portal-svc.yaml
17 - template: jinja
18 - require:
19 - file: devops_portal_kubernetes_dir
20
21devops_portal_k8s_cm:
22 file.managed:
Ilya Kharinfd293c42017-03-14 17:34:12 +040023 - name: {{ config.base_dir }}/kubernetes/devops_portal-cm.yaml
Ilya Kharin6e041862017-03-06 15:32:28 +040024 - 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
31devops_portal_k8s_deploy:
32 file.managed:
Ilya Kharinfd293c42017-03-14 17:34:12 +040033 - name: {{ config.base_dir }}/kubernetes/devops_portal-deploy.yaml
Ilya Kharin6e041862017-03-06 15:32:28 +040034 - 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
40devop_portal_namespace:
41 cmd.run:
42 - name: hyperkube kubectl create namespace {{ namespace }}
43 - unless: hyperkube kubectl get namespaces {{ namespace }}
44
45apply_devops_portal:
46 cmd.run:
47 - name: hyperkube kubectl apply
Ilya Kharinfd293c42017-03-14 17:34:12 +040048 --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 Kharin6e041862017-03-06 15:32:28 +040051 --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 %}