Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Schwieger, Jana
lab-k8s
Commits
e8b8c035
Commit
e8b8c035
authored
Nov 12, 2020
by
Nane Kratzke
Browse files
Merge branch 'master' of
https://git.mylab.th-luebeck.de/cloud-native/lab-k8s
parents
3b4c35d5
d866594b
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
e8b8c035
...
...
@@ -3,6 +3,10 @@ variables:
NAMESPACE
:
"
nane-kratzke"
VERSION
:
"
0.0.1"
URL
:
"
prime-nk.loki.th-luebeck.dev"
PRIME
:
"
yes"
CACHE
:
"
no"
PERSISTENT_CACHE
:
"
yes"
stages
:
-
prepare
...
...
@@ -23,14 +27,21 @@ prepare:
--docker-password=$CI_REGISTRY_TOKEN
\
-n
$NAMESPACE"
build
:
claim-volume
:
stage
:
prepare
only
:
variables
:
-
$PERSISTENT_CACHE == "yes"
image
:
name
:
$KUBECTL
entrypoint
:
[
"
"
]
script
:
-
kubectl apply -f deploy/storage -n $NAMESPACE
build-prime
:
stage
:
build
services
:
-
docker:dind
only
:
changes
:
-
prime/*
-
.gitlab-ci.yml
script
:
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
cd prime
...
...
@@ -38,18 +49,46 @@ build:
-
docker push $CI_REGISTRY_IMAGE/prime:$VERSION
-
docker push $CI_REGISTRY_IMAGE/prime:latest
deploy
:
deploy
-prime
:
stage
:
deploy
only
:
variables
:
-
$PRIME == "yes"
image
:
name
:
$KUBECTL
entrypoint
:
[
"
"
]
script
:
-
echo "Deploying to Kubernetes"
-
wget -q https://github.com/mikefarah/yq/releases/download/3.4.0/yq_linux_amd64 -O ./yq && chmod +x yq
-
./yq w -i deploy/service/prime-ingress.yaml spec.rules[0].host $URL
-
./yq w -i deploy/service/prime-ingress.yaml spec.tls[0].hosts[0] $URL
-
cat deploy/service/prime-ingress.yaml
-
kubectl delete -f deploy/service -n $NAMESPACE ||
true
-
kubectl apply -f deploy/service -n $NAMESPACE
-
./yq w -i deploy/prime/prime-ingress.yaml spec.rules[0].host $URL
-
./yq w -i deploy/prime/prime-ingress.yaml spec.tls[0].hosts[0] $URL
-
kubectl delete -f deploy/prime -n $NAMESPACE ||
true
-
kubectl apply -f deploy/prime -n $NAMESPACE
deploy-cache
:
stage
:
deploy
only
:
variables
:
-
$CACHE == "yes"
image
:
name
:
$KUBECTL
entrypoint
:
[
"
"
]
script
:
-
kubectl delete -f deploy/persistent-redis -n $NAMESPACE ||
true
-
kubectl delete -f deploy/redis -n $NAMESPACE ||
true
-
kubectl apply -f deploy/redis -n $NAMESPACE
deploy-persistent-cache
:
stage
:
deploy
only
:
variables
:
-
$PERSISTENT_CACHE == "yes"
image
:
name
:
$KUBECTL
entrypoint
:
[
"
"
]
script
:
-
kubectl delete -f deploy/redis -n $NAMESPACE ||
true
-
kubectl delete -f deploy/persistent-redis -n $NAMESPACE ||
true
-
kubectl apply -f deploy/persistent-redis -n $NAMESPACE
deploy/
service
/redis.yaml
→
deploy/
persistent-redis
/redis.yaml
View file @
e8b8c035
File moved
deploy/
servic
e/prime-deployment.yaml
→
deploy/
prim
e/prime-deployment.yaml
View file @
e8b8c035
File moved
deploy/
servic
e/prime-ingress.yaml
→
deploy/
prim
e/prime-ingress.yaml
View file @
e8b8c035
File moved
deploy/
servic
e/prime-service.yaml
→
deploy/
prim
e/prime-service.yaml
View file @
e8b8c035
File moved
deploy/redis/redis.yaml
0 → 100644
View file @
e8b8c035
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
redis
labels
:
app
:
redis
spec
:
selector
:
matchLabels
:
app
:
redis
replicas
:
1
template
:
metadata
:
labels
:
app
:
redis
spec
:
containers
:
-
name
:
master
image
:
k8s.gcr.io/redis
resources
:
limits
:
cpu
:
100m
memory
:
100Mi
ports
:
-
containerPort
:
6379
volumeMounts
:
-
mountPath
:
"
/data"
name
:
redis-volume
volumes
:
-
name
:
redis-volume
persistentVolumeClaim
:
claimName
:
redis-volume-claim
---
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
redis-service
spec
:
selector
:
app
:
redis
ports
:
-
protocol
:
TCP
port
:
6379
targetPort
:
6379
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment