Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pump, Cedric
lab-tracing
Commits
d58d65cd
Commit
d58d65cd
authored
Dec 26, 2020
by
Nane Kratzke
Browse files
hiphop basic config
parent
74ead2a4
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
d58d65cd
hiphop/__pycache__/*
.gitlab-ci.yml
0 → 100644
View file @
d58d65cd
stages
:
-
build
-
deploy
-
teardown
variables
:
KUBECTL
:
"
transit/kubectl-plus:v1.19.4"
CLUSTER
:
"
rig.th-luebeck.dev"
container
:
stage
:
build
only
:
changes
:
-
hiphop/*
-
hiphop/*/*
script
:
-
mkdir -p /kaniko/.docker
-
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-
cd src
-
/kaniko/executor --context . --destination $CI_REGISTRY_IMAGE/hiphop:latest
secrets
:
stage
:
build
image
:
$KUBECTL
script
:
-
kubectl delete secret gitlab-registry-credentials ||
true
-
"
kubectl
create
secret
docker-registry
gitlab-registry-credentials
\
--docker-server=$CI_REGISTRY
\
--docker-username=image-registry
\
--docker-password=$REGISTRY_READ_TOKEN
\
"
hiphop
:
stage
:
deploy
image
:
$KUBECTL
script
:
-
NS=$(kubectl config view --minify --output 'jsonpath={..namespace}')
-
VHOST=hiphop.$NS.$CLUSTER TIER=1 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
-
VHOST=hiphop.$NS.$CLUSTER TIER=2 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
-
VHOST=hiphop.$NS.$CLUSTER TIER=3 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
-
VHOST=hiphop.$NS.$CLUSTER TIER=4 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
-
VHOST=hiphop.$NS.$CLUSTER mo deploy/hiphop-ingress.yaml | kubectl apply -f -
shutdown
:
stage
:
teardown
image
:
$KUBECTL
when
:
manual
script
:
-
NS=$(kubectl config view --minify --output 'jsonpath={..namespace}')
-
VHOST=hiphop.$NS.$CLUSTER TIER=1 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
-
VHOST=hiphop.$NS.$CLUSTER TIER=2 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
-
VHOST=hiphop.$NS.$CLUSTER TIER=3 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
-
VHOST=hiphop.$NS.$CLUSTER TIER=4 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
-
VHOST=hiphop.$NS.$CLUSTER mo deploy/hiphop-ingress.yaml | kubectl delete -f -
deploy/hiphop-deploy+svc.yaml
0 → 100644
View file @
d58d65cd
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
hiphop-deployment-{{ TIER }}
annotations
:
sidecar.jaegertracing.io/inject
:
"
true"
spec
:
replicas
:
{{
TIER
}}
selector
:
matchLabels
:
app
:
hiphop
tier
:
{{
TIER
}}
template
:
metadata
:
labels
:
app
:
hiphop
tier
:
{{
TIER
}}
spec
:
imagePullSecrets
:
-
name
:
gitlab-registry-credentials
containers
:
-
name
:
hiphop
image
:
git.mylab.th-luebeck.de:4181/cloud-native/lab-tracing/hiphop:latest
imagePullPolicy
:
Always
resources
:
limits
:
cpu
:
"
50m"
ports
:
-
containerPort
:
80
env
:
-
name
:
HIPHOP
value
:
"
hiphop"
-
name
:
TIER
value
:
{{
TIER
}}
---
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
hiphop-service-{{ TIER }}
spec
:
selector
:
app
:
hiphop
tier
:
{{
TIER
}}
ports
:
-
protocol
:
TCP
port
:
80
targetPort
:
80
deploy/hiphop-ingress.yaml
0 → 100644
View file @
d58d65cd
apiVersion
:
networking.k8s.io/v1beta1
kind
:
Ingress
metadata
:
name
:
hiphop-ingress
annotations
:
cert-manager.io/cluster-issuer
:
"
letsencrypt-production"
spec
:
rules
:
-
host
:
{{
VHOST
}}
http
:
paths
:
-
backend
:
serviceName
:
hiphop-service-1
servicePort
:
80
tls
:
-
secretName
:
prime-ingress-cert
hosts
:
-
{{
VHOST
}}
hiphop/Dockerfile
0 → 100644
View file @
d58d65cd
FROM
python:3.9-alpine
COPY
. /app/
WORKDIR
/app
RUN
apk update
&&
apk upgrade
&&
apk add
--no-cache
bash git openssh
RUN
pip3
install
-r
requirements.txt
ENV
FLASK_APP=service.py
EXPOSE
80
ENTRYPOINT
["flask", "run", "--host=0.0.0.0", "--port=80"]
hiphop/service.py
View file @
d58d65cd
from
flask
import
Flask
from
flask
import
Flask
,
redirect
from
jaeger_client
import
Config
from
flask_opentracing
import
FlaskTracing
import
requests
import
os
service
=
os
.
environ
.
get
(
'HIPHOP'
,
'hiphop'
)
tier
=
int
(
os
.
environ
.
get
(
'TIER'
,
'1'
))
...
...
Write
Preview
Markdown
is supported
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