api-deployment.yaml 2.69 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
27
        - mountPath: /app
          name: nomad-conf
28
        - mountPath: /app/.volumes/fs/public
29
30
31
          name: public-volume
        - mountPath: /app/.volumes/fs/staging
          name: staging-volume
32
33
        - mountPath: /nomad
          name: nomad-volume
34
      env:
35
36
37
        - name: NOMAD_SERVICE
          value: "api"
        - name: NOMAD_CONSOLE_LOGLEVEL
38
          value: "{{ .Values.api.console_loglevel }}"
39
        - name: NOMAD_LOGSTASH_LEVEL
40
          value: "{{ .Values.api.logstash_loglevel }}"
41
        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"]
42
43
        livenessProbe:
          httpGet:
44
            path: "{{ .Values.proxy.external.path }}/api/alive"
45
46
47
48
49
            port: 8000
          initialDelaySeconds: 15
          periodSeconds: 15
        readinessProbe:
          httpGet:
50
            path: "{{ .Values.proxy.external.path }}/api/alive"
51
52
53
            port: 8000
          initialDelaySeconds: 5
          periodSeconds: 5
54
55
      nodeSelector:
        nomadtype: public
56
57
      imagePullSecrets:
      - name: {{ .Values.images.secret }}
58
      imagePullPolicy: always
59
      volumes:
60
61
62
63
64
65
      - name: nomad-conf
        configMap:
          name: {{ include "nomad.fullname" . }}-configmap
          items:
          - key: nomad.yml
            path: nomad.yml
66
      - name: public-volume
67
        hostPath:
68
          path: {{ .Values.volumes.public }}
69
          type: Directory
70
      - name: staging-volume
71
        {{ if (eq .Values.worker.routing "worker") }}
72
73
74
75
        emptyDir:
          medium: 'Memory'
        {{ else }}
        hostPath:
76
          path: {{ .Values.volumes.staging}}
77
78
          type: Directory
        {{ end }}
79
80
81
82
      - name: nomad-volume
        hostPath:
          path: {{ .Values.volumes.nomad }}
          type: Directory