Docker: add kubernetes deployment files
authorNsukami Patrick <ndkpatt at gmail dot com>
Thu, 16 May 2019 07:30:24 +0000
changeset 93 e49209d5bc8e
parent 92 42bbf4dcc56d
child 94 16f45bd19cf0
Docker: add kubernetes deployment files
deploy/deployment.yaml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/deployment.yaml	Thu May 16 07:30:24 2019 +0000
@@ -0,0 +1,136 @@
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: fresh
+data:
+  default.conf: |
+    server {
+      listen 8000 default_server;
+      root /etc/cubicweb.d/fresh/data;
+      rewrite ^/intra/(.*) /$1 last;
+
+      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 {
+        alias /etc/cubicweb.d/fresh/data;
+        expires 30d;
+      }
+    }
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: fresh
+spec:
+  selector:
+    matchLabels:
+      app: fresh
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: fresh
+    spec:
+      imagePullSecrets:
+        - name: regcred
+      volumes:
+        - name: static
+          emptyDir: {}
+        - name: config
+          configMap:
+            name: fresh
+      containers:
+        - name: fresh
+          image: hub.extranet.logilab.fr/logilab/fresh
+          imagePullPolicy: Always
+          envFrom:
+            - secretRef:
+                name: fresh-env
+          volumeMounts:
+            - name: static
+              mountPath: /etc/cubicweb.d/fresh/data
+          resources:
+            requests:
+              cpu: 500m
+              memory: 500Mi
+            limits:
+              memory: 500Mi
+        - name: nginx
+          image: hub.extranet.logilab.fr/library/nginx
+          imagePullPolicy: Always
+          volumeMounts:
+            - name: config
+              mountPath: /etc/nginx/conf.d/default.conf
+              subPath: default.conf
+            - name: static
+              mountPath: /etc/cubicweb.d/fresh/data
+          resources:
+            requests:
+              cpu: 100m
+              memory: 50Mi
+            limits:
+              memory: 50Mi
+          readinessProbe:
+            initialDelaySeconds: 5
+            periodSeconds: 10
+            timeoutSeconds: 5
+            failureThreshold: 20
+            httpGet:
+              path: /siteinfo
+              port: 8000
+              httpHeaders:
+                - name: X-Remote-User
+                  value: nico
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: fresh-scheduler
+spec:
+  selector:
+    matchLabels:
+      app: fresh-scheduler
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: fresh-scheduler
+    spec:
+      imagePullSecrets:
+        - name: regcred
+      containers:
+        - name: fresh
+          image: hub.extranet.logilab.fr/logilab/fresh
+          imagePullPolicy: Always
+          envFrom:
+            - secretRef:
+                name: fresh-env
+          command: ["cubicweb-ctl", "scheduler", "fresh"]
+          resources:
+            requests:
+              cpu: 100m
+              memory: 250Mi
+            limits:
+              memory: 250Mi
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: fresh
+spec:
+  selector:
+    app: fresh
+  ports:
+    - protocol: TCP
+      port: 8000