-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37d5c23
commit ca176cf
Showing
8 changed files
with
222 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
usage() { | ||
echo "Deploy to k8s" | ||
echo " -c Context for kubectl" | ||
echo " -v Version of the Docker image, i.e. the value of the tag" | ||
echo " -h Print usage instructions" | ||
} | ||
|
||
while getopts "v:c:h" opt; do | ||
case $opt in | ||
c) | ||
KUBECTL_CONTEXT=$OPTARG | ||
;; | ||
v) | ||
VERSION=$OPTARG | ||
;; | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$VERSION" ]; then | ||
VERSION=$(git tag | grep hello-tracing-backend | tr -d 'hello-tracing-backend-' | sort --version-sort -r | head -1 | cut -c 2-) | ||
if [ -z "$VERSION" ]; then | ||
echo "ERROR: cannot determine version" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
export VERSION | ||
echo "Deploying version $VERSION" | ||
|
||
current_dir=$(pwd) | ||
cd $(dirname $0) | ||
kustomize build | envsubst | kubectl apply -f - | ||
cd $current_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: hello-tracing-backend-grpc | ||
namespace: hello-tracing | ||
spec: | ||
selector: | ||
app: hello-tracing-backend | ||
ports: | ||
- name: grpc | ||
port: 80 | ||
targetPort: grpc | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: hello-tracing-backend | ||
namespace: hello-tracing | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: hello-tracing-backend | ||
template: | ||
metadata: | ||
name: hello-tracing-backend | ||
namespace: hello-tracing | ||
labels: | ||
app: hello-tracing-backend | ||
spec: | ||
containers: | ||
- name: hello-tracing-backend | ||
image: hseeberger/hello-tracing-backend:latest | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- name: grpc | ||
containerPort: 8080 | ||
resources: | ||
requests: | ||
cpu: 25m | ||
memory: 25Mi | ||
limits: | ||
cpu: 100m | ||
memory: 100Mi | ||
# readinessProbe: | ||
# grpc: | ||
# port: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- hello-tracing-backend.yaml | ||
images: | ||
- name: hseeberger/hello-tracing-backend | ||
newTag: $VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
usage() { | ||
echo "Deploy to k8s" | ||
echo " -c Context for kubectl" | ||
echo " -v Version of the Docker image, i.e. the value of the tag" | ||
echo " -h Print usage instructions" | ||
} | ||
|
||
while getopts "v:c:h" opt; do | ||
case $opt in | ||
c) | ||
KUBECTL_CONTEXT=$OPTARG | ||
;; | ||
v) | ||
VERSION=$OPTARG | ||
;; | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$VERSION" ]; then | ||
VERSION=$(git tag | grep hello-tracing-gateway | tr -d 'hello-tracing-gateway-' | sort --version-sort -r | head -1 | cut -c 2-) | ||
if [ -z "$VERSION" ]; then | ||
echo "ERROR: cannot determine version" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
export VERSION | ||
echo "Deploying version $VERSION" | ||
|
||
current_dir=$(pwd) | ||
cd $(dirname $0) | ||
kustomize build | envsubst | kubectl apply -f - | ||
cd $current_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: hello-tracing-gateway-http | ||
namespace: hello-tracing | ||
spec: | ||
selector: | ||
app: hello-tracing-gateway | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: http | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: hello-tracing-gateway | ||
namespace: hello-tracing | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: hello-tracing-gateway | ||
template: | ||
metadata: | ||
name: hello-tracing-gateway | ||
namespace: hello-tracing | ||
labels: | ||
app: hello-tracing-gateway | ||
spec: | ||
containers: | ||
- name: hello-tracing-gateway | ||
image: hseeberger/hello-tracing-gateway:latest | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
resources: | ||
requests: | ||
cpu: 25m | ||
memory: 25Mi | ||
limits: | ||
cpu: 100m | ||
memory: 100Mi | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
env: | ||
- name: APP__BACKEND__ENDPOINT | ||
value: http://hello-tracing-backend-grpc:80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- hello-tracing-gateway.yaml | ||
images: | ||
- name: hseeberger/hello-tracing-backend | ||
newTag: $VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: hello-tracing | ||
|
||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: hello-tracing | ||
namespace: hello-tracing | ||
annotations: | ||
cert-manager.io/cluster-issuer: letsencrypt | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- hello-tracing.heikoseeberger.de | ||
secretName: hello-tracing-tls | ||
rules: | ||
- host: hello-tracing.heikoseeberger.de | ||
http: | ||
paths: | ||
- pathType: Prefix | ||
path: / | ||
backend: | ||
service: | ||
name: hello-tracing-gateway-http | ||
port: | ||
name: http |