deployment.yaml 3.89 KB
Newer Older
1
2
3
4
5
6
7
8
9
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: intranet
data:
  default.conf: |
    server {
      listen 8000 default_server;
10
      root /etc/cubicweb.d/intranet/data;
11
      rewrite ^/intra/(.*) /$1 last;
12
      client_max_body_size 100M;
13
14
15
16
17
18
19
20
21
22
23
24
25
26

      location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect off;
        proxy_buffering off;
        # This make cubicweb-signedrequest works even if HTTP Host header is
        # not supposed to contains URL path...
        proxy_set_header Host $host/intra;
        proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Remote-user $http_x_remote_user;
      }

      location /data {
27
        alias /etc/cubicweb.d/intranet/data;
28
29
30
31
32
33
34
35
        expires 30d;
      }
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: intranet
36
  annotations:
Arthur Lutz's avatar
Arthur Lutz committed
37
38
    prometheus.io/scrape: 'true'
    prometheus.io/port: '9117'
39
40
41
42
43
44
45
46
47
48
spec:
  selector:
    matchLabels:
      app: intranet
  replicas: 1
  template:
    metadata:
      labels:
        app: intranet
    spec:
49
50
      imagePullSecrets:
        - name: regcred-crm
51
52
53
54
55
56
      volumes:
        - name: static
          emptyDir: {}
        - name: config
          configMap:
            name: intranet
Philippe Pepiot's avatar
Philippe Pepiot committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
        - name: backup
          persistentVolumeClaim:
            claimName: backup
      initContainers:
        - name: upgrade
          image: r.intra.logilab.fr/intranet/intranet
          imagePullPolicy: Always
          command: ["cubicweb-ctl", "upgrade", "--backup-db=y", "--force", "--verbosity=0", "intranet"]
          envFrom:
            - secretRef:
                name: intranet-env
          resources:
            requests:
              cpu: 50m
              memory: 500Mi
          volumeMounts:
            - name: backup
              mountPath: /etc/cubicweb.d/intranet/backup
75
76
      containers:
        - name: intranet
77
          image: r.intra.logilab.fr/intranet/intranet
78
79
80
81
82
83
          imagePullPolicy: Always
          envFrom:
            - secretRef:
                name: intranet-env
          volumeMounts:
            - name: static
84
              mountPath: /etc/cubicweb.d/intranet/data
Philippe Pepiot's avatar
Philippe Pepiot committed
85
86
            - name: backup
              mountPath: /etc/cubicweb.d/intranet/backup
87
88
          resources:
            requests:
89
              cpu: 50m
90
91
92
              memory: 500Mi
            limits:
              memory: 500Mi
93
94
95
96
97
98
99
        - name: uwsgi-prometheus
          image: timonwong/uwsgi-exporter
          args:
            - '--stats.uri'
            - 'http://localhost:8001'
          ports:
            - containerPort: 9117
100
        - name: nginx
101
          image: r.intra.logilab.fr/library/nginx
102
103
104
105
106
107
          imagePullPolicy: Always
          volumeMounts:
            - name: config
              mountPath: /etc/nginx/conf.d/default.conf
              subPath: default.conf
            - name: static
108
              mountPath: /etc/cubicweb.d/intranet/data
109
110
          resources:
            requests:
111
              cpu: 5m
112
              memory: 100Mi
113
            limits:
114
              memory: 100Mi
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: intranet-scheduler
spec:
  selector:
    matchLabels:
      app: intranet-scheduler
  replicas: 1
  template:
    metadata:
      labels:
        app: intranet-scheduler
    spec:
130
131
      imagePullSecrets:
        - name: regcred-crm
132
133
      containers:
        - name: intranet
134
          image: r.intra.logilab.fr/intranet/intranet
135
136
137
138
          imagePullPolicy: Always
          envFrom:
            - secretRef:
                name: intranet-env
139
          command: ["cubicweb-ctl", "scheduler", "intranet"]
140
141
          resources:
            requests:
142
              cpu: 50m
143
144
145
146
147
148
149
150
151
152
153
154
155
156
              memory: 250Mi
            limits:
              memory: 250Mi
---
apiVersion: v1
kind: Service
metadata:
  name: intranet
spec:
  selector:
    app: intranet
  ports:
    - protocol: TCP
      port: 8000