From 7e0286208f0f5b989259d68b97587f4eb084b108 Mon Sep 17 00:00:00 2001
From: Thomas  MENARD <thomas.menard@pasteur.fr>
Date: Tue, 4 Jun 2019 17:04:34 +0200
Subject: [PATCH] Add Dockerfile, gitlab-ci

---
 .gitlab-ci.yml |  2 --
 manifest.yaml  | 16 +++++++-----
 polls.yaml     | 69 --------------------------------------------------
 3 files changed, 10 insertions(+), 77 deletions(-)
 delete mode 100755 polls.yaml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 063a2a6..bc5cb53 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,8 +16,6 @@ build:
     - docker build -t "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/polls:${CI_COMMIT_SHORT_SHA}" .
     - docker tag "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/polls:${CI_COMMIT_SHORT_SHA}" "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/polls:latest"
     - docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME/polls:${CI_COMMIT_SHORT_SHA}"
-  tags:
-    - k8s
 
 deploy:
   stage: deploy
diff --git a/manifest.yaml b/manifest.yaml
index ceec285..3438a42 100644
--- a/manifest.yaml
+++ b/manifest.yaml
@@ -29,6 +29,10 @@ metadata:
   labels:
     app: postgresql
 spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: postgresql
   strategy:
     type: Recreate
   template:
@@ -44,18 +48,18 @@ spec:
         - name: POSTGRES_USER
           valueFrom:
             secretKeyRef:
-            name: postgresql-credentials
-            key: username
+              name: postgresql-credentials
+              key: username
         - name: POSTGRES_DB
           valueFrom:
             secretKeyRef:
-            name: postgresql-credentials
-            key: database
+              name: postgresql-credentials
+              key: database
         - name: POSTGRES_PASSWORD
           valueFrom:
             secretKeyRef:
-            name: postgresql-credentials
-            key: password
+              name: postgresql-credentials
+              key: password
         ports:
         - containerPort: 5432
           name: postgresql
diff --git a/polls.yaml b/polls.yaml
deleted file mode 100755
index 9c67cf4..0000000
--- a/polls.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
-  name: polls
-  labels:
-    app: polls
-spec:
-  replicas: 3
-  template:
-    metadata:
-      labels:
-        app: polls
-    spec:
-      containers:
-       name: polls-app
-        image: ${CI_REGISTRY}/${CI_PROJECT_NAME}/polls:${CI_COMMIT_SHORT_SHA}
-        # This setting makes nodes pull the docker image every time before
-        # starting the pod. This is useful when debugging, but should be turned
-        # off in production.
-        imagePullPolicy: Always
-        env:
-            - name: DATABASE_USER
-              valueFrom:
-                secretKeyRef:
-                  name: postgresql-credentials
-                  key: username
-            - name: DATABASE_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: postgresql-credentials
-                  key: password
-        ports:
-        - containerPort: 8080
-      volumes:
-        - name: postgresql-credentials
-          secret:
-            secretName: postgresql
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: polls
-  labels:
-    app: polls
-spec:
-  type: ClusterIP
-  ports:
-  - port: 80
-    targetPort: 8080
-  selector:
-    app: polls
----
-apiVersion: extensions/v1beta1
-kind: Ingress
-metadata:
-  annotations:
-    kubernetes.io/ingress.class: traefik
-  labels:
-    app: polls
-  name: polls
-spec:
-  rules:
-  - host: ${CI_PROJECT_NAME}.pasteur.cloud
-    http:
-      paths:
-      - backend:
-          serviceName: polls
-          servicePort: 80
-        path: /
\ No newline at end of file
-- 
GitLab