kubernetes.yaml 1.61 KB
Newer Older
1
apiVersion: apps/v1
Jørn Åne de Jong's avatar
Jørn Åne de Jong committed
2
3
4
5
kind: Deployment
metadata:
  name: $CI_ENVIRONMENT_SLUG
  namespace: $KUBE_NAMESPACE
6
7
8
  annotations:
    app.gitlab.com/env: $CI_ENVIRONMENT_SLUG
    app.gitlab.com/app: $CI_PROJECT_PATH_SLUG
Jørn Åne de Jong's avatar
Jørn Åne de Jong committed
9
10
11
12
13
14
  labels:
    app: $CI_ENVIRONMENT_SLUG
    pipeline_id: "$CI_PIPELINE_ID"
    build_id: "$CI_BUILD_ID"
spec:
  replicas: $REPLICAS
15
16
17
  selector:
    matchLabels:
      app: $CI_ENVIRONMENT_SLUG
Jørn Åne de Jong's avatar
Jørn Åne de Jong committed
18
19
  template:
    metadata:
20
21
22
      annotations:
        app.gitlab.com/env: $CI_ENVIRONMENT_SLUG
        app.gitlab.com/app: $CI_PROJECT_PATH_SLUG
Jørn Åne de Jong's avatar
Jørn Åne de Jong committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
      labels:
        name: $CI_ENVIRONMENT_SLUG
        app: $CI_ENVIRONMENT_SLUG
    spec:
      containers:
      - name: app
        image: $CI_REGISTRY_IMAGE:$CI_REGISTRY_TAG
        ports:
        - name: web
          containerPort: $HTTP_PORT
        livenessProbe:
          httpGet:
            path: /
            port: $HTTP_PORT
          initialDelaySeconds: 15
          timeoutSeconds: 15
        readinessProbe:
          httpGet:
            path: /download/?idp=9;profile=10
            port: $HTTP_PORT
          initialDelaySeconds: 5
          timeoutSeconds: 15
45
46
47
48
49
50
51
52
53
54
55
56
57
        lifecycle:
          preStop:  # Give ingress container time to stop sending requests to this container during shutdown.
            exec:
              command: ['/bin/sleep', '15']
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  name: $CI_ENVIRONMENT_SLUG
              topologyKey: failure-domain.beta.kubernetes.io/zone
            weight: 10