api-deployment.yaml 4.25 KB
Newer Older
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
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "nomad.fullname" . }}-api
  labels:
    app.kubernetes.io/name: {{ include "nomad.name" . }}-api
    helm.sh/chart: {{ include "nomad.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  replicas: {{ .Values.api.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ include "nomad.name" . }}-api
      app.kubernetes.io/instance: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ include "nomad.name" . }}-api
        app.kubernetes.io/instance: {{ .Release.Name }}
    spec:
      containers:
      - name: {{ include "nomad.name" . }}-api
        image: "{{ .Values.images.nomad.name }}:{{ .Values.images.nomad.tag }}"
        volumeMounts:
26
        - mountPath: /app/.volumes/fs/public
27
28
29
          name: public-volume
        - mountPath: /app/.volumes/fs/staging
          name: staging-volume
30
31
        - mountPath: /nomad
          name: nomad-volume
32
        env:
33
34
        - name: NOMAD_FILES_TMP_DIR
          value: "{{ .Values.volumes.tmp }}"
35
36
        - name: NOMAD_SERVICE
          value: "api"
37
38
        - name: NOMAD_RELEASE
          value: "{{ .Release.Name }}"
39
        - name: NOMAD_LOGSTASH_HOST
40
          value: "{{ .Values.logstash.host }}"
41
        - name: NOMAD_LOGSTASH_TCPPORT
42
          value: "{{ .Values.logstash.port }}"
43
        - name: NOMAD_CONSOLE_LOGLEVEL
44
          value: "{{ .Values.api.console_loglevel }}"
45
        - name: NOMAD_LOGSTASH_LEVEL
46
          value: "{{ .Values.api.logstash_loglevel }}"
47
48
        - name: NOMAD_API_HOST
          value: "{{ .Values.proxy.external.host }}"
49
        - name: NOMAD_API_PORT
50
51
          value: "{{ .Values.proxy.external.port }}"
        - name: NOMAD_API_BASE_PATH
52
          value: "{{ .Values.proxy.external.path }}/api"
53
        - name: NOMAD_API_SECRET
54
          value: "{{ .Values.api.secret }}"
55
56
57
58
        - name: NOMAD_API_ADMIN_PASSWORD
          value: "{{ .Values.api.adminPassword }}"
        - name: NOMAD_API_DISABLE_RESET
          value: "{{ .Values.api.disableReset }}"
59
60
61
62
63
64
65
        - name: NOMAD_RABBITMQ_HOST
          value: "{{ .Release.Name }}-rabbitmq"
        - name: NOMAD_ELASTIC_HOST
          value: "{{ .Values.elastic.host }}"
        - name: NOMAD_ELASTIC_PORT
          value: "{{ .Values.elastic.port }}"
        - name: NOMAD_ELASTIC_INDEX_NAME
66
          value: "{{ .Values.dbname }}"
67
68
69
70
71
        - name: NOMAD_MONGO_HOST
          value: "{{ .Values.mongo.host }}"
        - name: NOMAD_MONGO_PORT
          value: "{{ .Values.mongo.port }}"
        - name: NOMAD_MONGO_DB_NAME
72
          value: "{{ .Values.dbname }}"
73
74
75
76
77
        - name: NOMAD_COE_REPO_DB_HOST
          value: "{{ .Values.postgres.host }}"
        - name: NOMAD_COE_REPO_DB_PORT
          value: "{{ .Values.postgres.port }}"
        - name: NOMAD_COE_REPO_DB_NAME
78
          value: "{{ .Values.dbname }}"
79
        - name: NOMAD_CELERY_ROUTING
80
          value: "{{ .Values.worker.routing }}"
81
82
        - name: NOMAD_FILES_PREFIX_SIZE
          value: "{{ .Values.volumes.prefixSize }}"
83
        command: ["python", "-m", "gunicorn.app.wsgiapp", "--timeout", "3600", "--log-config", "ops/gunicorn.log.conf", "-w", "{{ .Values.api.worker }}", "-b 0.0.0.0:8000", "nomad.api:app"]
84
85
        livenessProbe:
          httpGet:
86
            path: "{{ .Values.proxy.external.path }}/api/alive"
87
88
89
90
91
            port: 8000
          initialDelaySeconds: 15
          periodSeconds: 15
        readinessProbe:
          httpGet:
92
            path: "{{ .Values.proxy.external.path }}/api/alive"
93
94
95
            port: 8000
          initialDelaySeconds: 5
          periodSeconds: 5
96
97
      nodeSelector:
        nomadtype: public
98
99
      imagePullSecrets:
      - name: {{ .Values.images.secret }}
100
      imagePullPolicy: always
101
      volumes:
102
      - name: public-volume
103
        hostPath:
104
          path: {{ .Values.volumes.public }}
105
          type: Directory
106
107
108
109
110
111
112
113
114
      - name: staging-volume
        {{ if eq( .Values.worker.routing "worker")}}
        emptyDir:
          medium: 'Memory'
        {{ else }}
        hostPath:
          path: {{ .Vallues.volumes.staging}}
          type: Directory
        {{ end }}
115
116
117
118
      - name: nomad-volume
        hostPath:
          path: {{ .Values.volumes.nomad }}
          type: Directory