Commit 9a0ac7ef authored by Nane Kratzke's avatar Nane Kratzke
Browse files

Aktualisieren .gitlab-ci.yml, deploy/service/prime-deployment.yaml,...

Aktualisieren .gitlab-ci.yml, deploy/service/prime-deployment.yaml, deploy/service/prime-ingress.yaml, deploy/service/prime-service.yaml, deploy/service/redis.yaml, deploy/storage/redis-volume.yaml Dateien
Gelöscht deploy/prod/prime-deployment.yaml, deploy/prod/prime-ingress.yaml, deploy/prod/prime-service.yaml, deploy/storage/redis-dev-volume.yaml Dateien
parent d2e86502
......@@ -5,6 +5,7 @@ variables:
BRANCH: "$CI_COMMIT_BRANCH"
stages:
- prepare
- build
- deploy
......@@ -25,46 +26,34 @@ prime-container:
- docker push $CI_REGISTRY_IMAGE/prime-$BRANCH:latest
prime-storage:
stage: build
stage: prepare
image:
name: $KUBECTL
entrypoint: [""]
script:
- kubectl apply -f deploy/storage -n $NAMESPACE
prime-dev:
stage: deploy
deploy-credentials:
stage: prepare
image:
name: $KUBECTL
entrypoint: [""]
script:
- echo "Deploying to Kubernetes"
- kubectl delete secret gitlab-registry-credentials -n $NAMESPACE || true
- "kubectl create secret docker-registry gitlab-registry-credentials \
--docker-server=$CI_REGISTRY \
--docker-username=image-registry \
--docker-password=$CI_REGISTRY_TOKEN \
-n $NAMESPACE"
- kubectl delete -f deploy/dev -n $NAMESPACE || true
- kubectl apply -f deploy/dev -n $NAMESPACE
prime-prod:
only:
- master
prime-service:
stage: deploy
image:
name: $KUBECTL
entrypoint: [""]
script:
- echo "Deploying to Kubernetes"
- kubectl delete secret gitlab-registry-credentials -n $NAMESPACE || true
- "kubectl create secret docker-registry gitlab-registry-credentials \
--docker-server=$CI_REGISTRY \
--docker-username=image-registry \
--docker-password=$CI_REGISTRY_TOKEN \
-n $NAMESPACE"
- kubectl delete -f deploy/prod -n $NAMESPACE || true
- kubectl apply -f deploy/prod -n $NAMESPACE
- kubectl delete -f deploy/dev -n $NAMESPACE || true
- kubectl apply -f deploy/dev -n $NAMESPACE
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: prime-dev-ingress
labels:
branch: dev
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-production"
spec:
rules:
- host: "prime-dev.loki.th-luebeck.dev"
http:
paths:
- backend:
serviceName: prime-dev-service
servicePort: 80
tls:
- secretName: prime-dev-ingress-cert
hosts: ["prime-dev.loki.th-luebeck.dev"]
apiVersion: v1
kind: Service
metadata:
name: prime-dev-service
labels:
branch: dev
spec:
selector:
app: prime
branch: dev
ports:
- protocol: TCP
port: 80
targetPort: 80
apiVersion: apps/v1
kind: Deployment
metadata:
name: prime-deployment
labels:
app: prime
branch: master
spec:
replicas: 5
selector:
matchLabels:
app: prime
branch: master
template:
metadata:
labels:
app: prime
branch: master
spec:
imagePullSecrets:
- name: gitlab-registry-credentials
containers:
- name: prime
image: git.mylab.th-luebeck.de:4181/cloud-native/lab-k8s/prime-master
imagePullPolicy: Always
ports:
- containerPort: 80
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: prime-ingress
name: prime-dev-ingress
labels:
branch: master
branch: dev
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-production"
spec:
......
......@@ -5,7 +5,6 @@ metadata:
spec:
selector:
app: prime
branch: master
ports:
- protocol: TCP
port: 80
......
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-dev
name: redis
labels:
app: redis
branch: dev
spec:
selector:
matchLabels:
app: redis
branch: dev
replicas: 1
template:
metadata:
labels:
app: redis
branch: dev
spec:
containers:
- name: master
......@@ -28,22 +25,19 @@ spec:
- containerPort: 6379
volumeMounts:
- mountPath: "/redis/data"
name: redis-dev-volume
name: redis-volume
volumes:
- name: redis-dev-volume
- name: redis-volume
persistentVolumeClaim:
claimName: redis-dev-volume-claim
claimName: redis-volume-claim
---
apiVersion: v1
kind: Service
metadata:
name: redis-dev-service
labels:
branch: dev
name: redis-service
spec:
selector:
app: redis
branch: dev
ports:
- protocol: TCP
port: 6379
......
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-dev-volume-claim
labels:
branch: dev
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 500M
......@@ -2,8 +2,6 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-volume-claim
labels:
branch: prod
spec:
accessModes:
- ReadWriteOnce
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment