From 0afe4a7ab58cbee7da53e0c5ad49e9511e0bc06b Mon Sep 17 00:00:00 2001 From: Deni Bertovic Date: Tue, 2 Oct 2018 16:26:57 +0200 Subject: [PATCH 1/3] Adds ingress and fixes CI deployment --- .gitlab-ci.yml | 22 +++++--- etc/kube/cron_deployment_template.yaml | 61 ++++++++++++++++++++++ etc/kube/deployment_template.yaml | 14 ++++- etc/kube/hoogle_deployment_template.yaml | 65 ++++++++++++++++++++++++ etc/kube/hoogle_service_template.yaml | 19 +++++++ etc/kube/ingress_template.yaml | 21 ++++++++ 6 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 etc/kube/cron_deployment_template.yaml create mode 100644 etc/kube/hoogle_deployment_template.yaml create mode 100644 etc/kube/hoogle_service_template.yaml create mode 100644 etc/kube/ingress_template.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 349d063..3f88fde 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,8 +14,12 @@ stages: variables: STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root" DEPLOYMENT_IMAGE: "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_SLUG}_${CI_PIPELINE_ID}" - DEPLOYMENT_NAME: "stackage-server-${CI_BUILD_REF_SLUG}" - DEPLOYMENT_APP: "${CI_ENVIRONMENT_SLUG}" + DEPLOYMENT_NAME: "stackage-server-prod" + HOOGLE_DEPLOYMENT_NAME: "stackage-server-hoogle-prod" + CRON_DEPLOYMENT_NAME: "stackage-server-cron-prod" + DEPLOYMENT_APP: "stackage-server-prod" + CRON_DEPLOYMENT_APP: "stackage-server-cron-prod" + HOOGLE_DEPLOYMENT_APP: "stackage-server-hoogle-prod" # This creates anchors for bits of script that are reused between builds .anchors: @@ -27,8 +31,11 @@ variables: kubectl config use-context cluster - &KUBEAPPLY kubectl apply -f <(envsubst Date: Fri, 12 Oct 2018 17:14:45 +0200 Subject: [PATCH 2/3] Route ingress hoogle traffic to separate service --- etc/kube/ingress_template.yaml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/etc/kube/ingress_template.yaml b/etc/kube/ingress_template.yaml index b1ce813..ba6dca9 100644 --- a/etc/kube/ingress_template.yaml +++ b/etc/kube/ingress_template.yaml @@ -7,15 +7,25 @@ metadata: annotations: kubernetes.io/ingress.class: "nginx" kubernetes.io/tls-acme: "true" + nginx.ingress.kubernetes.io/use-regex: "true" spec: rules: - host: "${HOST}" http: paths: - - backend: - serviceName: "${DEPLOYMENT_NAME}" - servicePort: 80 + - path: /haddock.* + backend: + serviceName: "${DEPLOYMENT_NAME}" + servicePort: 80 + - path: /.+/hoogle + backend: + serviceName: "${HOOGLE_DEPLOYMENT_NAME}" + servicePort: 80 + - backend: + serviceName: "${DEPLOYMENT_NAME}" + servicePort: 80 tls: - hosts: - "${HOST}" secretName: "${DEPLOYMENT_NAME}-tls" + From 91dfb99a6eb2fb90b6058f8f677bd82facf6a9f2 Mon Sep 17 00:00:00 2001 From: Deni Bertovic Date: Fri, 12 Oct 2018 17:17:29 +0200 Subject: [PATCH 3/3] Don't deploy ingress for prod deploys --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3f88fde..fc36cb4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,8 +34,7 @@ variables: kubectl apply -f <(envsubst