diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 063a2a6d263a5a6206cf311cd7bd553b362ddc8d..bc5cb531c40c0116c94246702fd9fa4acc5a1a88 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 ceec285b667c0a035a061d6f752814184feff38a..3438a42e96ffee5e385121ca59536ac560449123 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 9c67cf479d7e435c3d9b9f9849cadea926102325..0000000000000000000000000000000000000000 --- 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