Skip to content
Snippets Groups Projects
Verified Commit 2ddaa7bf authored by egon w. stemle's avatar egon w. stemle :robot:
Browse files

Merge branch 'master' into start_new

Update branch with work on .gitlab-ci and kustomize
parents 0351240c cfa033bb
No related branches found
No related tags found
No related merge requests found
variables:
CONTAINER_IMAGE: "gitlab.inf.unibz.it:4567/commul/merlin-platform/www/master"
DOCKER_BUILDER_IMAGE: "docker:19.03.1"
DOCKER_TLS_CERTDIR: "" # See https://gitlab.com/gitlab-org/gitlab-runner/issues/4501
KUBECTL: "https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl"
stages:
- build
- tag
- deploy
build:
stage: build
tags:
- commul
image: ${DOCKER_BUILDER_IMAGE}
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN https://gitlab.inf.unibz.it:4567
script:
- docker build --rm --no-cache --tag=${CONTAINER_IMAGE}:${CI_COMMIT_SHA} .
- docker push ${CONTAINER_IMAGE}:${CI_COMMIT_SHA}
- docker tag ${CONTAINER_IMAGE}:${CI_COMMIT_SHA} ${CONTAINER_IMAGE}:staging
- docker push ${CONTAINER_IMAGE}:staging
only:
- master
deploy_staging:
stage: deploy
tags:
- commul
image: ${DOCKER_BUILDER_IMAGE}
services:
- docker:dind
before_script:
- wget ${KUBECTL}
- mv kubectl /usr/bin/
- chmod +x /usr/bin/kubectl
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN gitlab.inf.unibz.it:4567
script:
- docker pull ${CONTAINER_IMAGE}:${CI_COMMIT_SHA}
- kubectl --namespace kommul-dev set image deployment/merlin browser=${CONTAINER_IMAGE}:${CI_COMMIT_SHA}
only:
- master
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
containers:
- name: webserver
imagePullPolicy: Always
resources: {}
ports:
- name: http
containerPort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
spec:
rules:
- host: HOST
http:
paths:
- backend:
serviceName: service-http
servicePort: 80
path: /PATH
tls:
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- ingress.yaml
---
apiVersion: v1
kind: Service
metadata:
name: service-http
spec:
ports:
- name: http
port: 80
selector:
app: app
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment
spec:
template:
spec:
containers:
- name: webserver
image: WEBSERVER
ports:
- name: http
containerPort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
annotations:
ingress.kubernetes.io/configuration-snippet: |
rewrite ^(/PATH)$ $1/ permanent;
ingress.kubernetes.io/rewrite-target: /
kubernetes.io/tls-acme: "true"
spec:
rules:
- host: HOST
http:
paths:
- backend:
serviceName: service-http
servicePort: 80
path: /PATH
tls:
- hosts:
- kommul-dev.eurac.edu
secretName: kommul-dev.eurac.edu-NAME-tls
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
patchesStrategicMerge:
- deployment.yaml
- ingress.yaml
namePrefix: merlin-platform-
# nameSuffix: -v1
commonLabels:
variant: staging
org: commul
app: merlin-webpage
commonAnnotations:
note: merlin-platform-note
namespace: kommul-dev
images:
- name: WEBSERVER
newName: gitlab.inf.unibz.it:4567/commul/merlin-platform/www/master:445bc35dde4520cab61a36c793c7c5a626f43e62
patchesJSON6902:
- target:
group: extensions
version: v1beta1
kind: Ingress
name: ingress
patch: |-
- op: replace
path: /metadata/annotations/ingress.kubernetes.io~1configuration-snippet
value: |
rewrite ^(/merlin)$ $1/ permanent;
- op: replace
path: /spec/rules/0/host
value: kommul-dev.eurac.edu
- op: replace
path: /spec/rules/0/http/paths/0/path
value: /merlin
- op: replace
path: /spec/tls/0/secretName
value: kommul-dev.eurac.edu-merlin-tls
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment