summaryrefslogtreecommitdiffstats
path: root/setup/projects/kaas/templates/40-kaas-manager.yml.j2
blob: e18173755c68e0086362973b00f2e56d5a59eb56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#jinja2: trim_blocks: "true", lstrip_blocks: "false"
---
{% set gid_range = kaas_openshift_gid_ranges[kaas_project].split("/") %}
apiVersion: v1
kind: Template
metadata:
  name: kaas-manager
  annotations:
    descriptions: KaaS Data Management Service
objects:
  - apiVersion: v1
    kind: DeploymentConfig
    metadata:
      name: kaas-manager
    spec:
      replicas: 1
      revisionHistoryLimit: {{ kaas_pod_history_limit }}
      strategy:
        type: Rolling
      triggers:
      - type: ConfigChange
      selector:
        name: kaas-manager
      triggers:
        - type: ConfigChange
        - type: ImageChange
          imageChangeParams:
            automatic: true
            from:
              kind: "ImageStreamTag"
              name: "kaas-manager:latest"
              namespace: "kaas"
            containerNames:
              - kaas-manager
      template:
        metadata:
          name: kaas-manager
          labels:
            name: kaas-manager
        spec:
          securityContext:
            supplementalGroups:
{% for ofs in range(gid_range[1] | default(1) | int) %}
              - {{ (gid_range[0] | int) + ofs }}
{% endfor %}
{% if (kaas_project_config.run_pods_as is defined) %}
{%   if ((kaas_project_config.uids | default(kaas_openshift_uids))[kaas_project_config.run_pods_as] is defined) %}
            runAsUser: {{ (kaas_project_config.uids | default(kaas_openshift_uids))[kaas_project_config.run_pods_as].id }}
{%   else %}
            runAsUser: {{ kaas_project_config.run_pods_as }}
{%   endif %}
{% endif %}
          volumes:
{% for name, vol in kaas_project_volumes.iteritems() %}
{%   set oc_name = name | regex_replace('_','-') %}
{%   if (vol.write | default(false)) %}
            - name: vol-{{ name }}
              persistentVolumeClaim:
                claimName: {{ oc_name }}
{%   endif %}
{% endfor %}
{% if ('data' not in kaas_project_volumes) %}
            - name: home
              emptyDir: {}
{% endif %}
          containers:
            - name: kaas-manager
              image: kaas-manager
              command: [ "/docker-entrypoint.sh", "/bin/sx" ]
              volumeMounts: 
{% for name, vol in kaas_project_volumes.iteritems() %}
{%   if (vol.write | default(false)) %}
                - name: vol-{{ name }}
                  mountPath: /mnt/{{ name }}
{%   endif %}
{% endfor %}
{% if ('data' not in kaas_project_volumes) %}
                - name: home
                  mountPath: /home
{% endif %}
              env:
                - name: HOME
{% if ('data' in kaas_project_volumes) %}
                  value: /mnt/data/home
{% else %}
                  value: /tmp
{% endif %}
#              lifecycle:
#                postStart:
#                  exec: 
#                    command: [ "/bin/bash", "[ -d $HOME ] || mkdir -p $HOME" ]