demo.yaml is generated
This commit is contained in:
parent
687ada3af2
commit
5140545ac0
4 changed files with 111 additions and 90 deletions
|
@ -13,6 +13,6 @@ releases.
|
||||||
### scripts
|
### scripts
|
||||||
|
|
||||||
1. `./make-docker-images.sh`: builds and pushes images to the specified Docker repository.
|
1. `./make-docker-images.sh`: builds and pushes images to the specified Docker repository.
|
||||||
2. `./make-release-artifacts.sh`: injects updated images/tag into
|
2. `./make-release-artifacts.sh`: generates a combined YAML file with image $TAG at:
|
||||||
`./release/kubernetes-manifests/demo.yaml`.
|
`./release/kubernetes-manifests/demo.yaml`.
|
||||||
3. `./make-release.sh`: runs scripts 1 and 2, then runs `git tag` / pushes updated manifests to master.
|
3. `./make-release.sh`: runs scripts 1 and 2, then runs `git tag` / pushes updated manifests to master.
|
||||||
|
|
|
@ -23,10 +23,25 @@ fail() { log "$1"; exit 1; }
|
||||||
TAG="${TAG?TAG env variable must be specified}"
|
TAG="${TAG?TAG env variable must be specified}"
|
||||||
REPO_PREFIX="${REPO_PREFIX?REPO_PREFIX env variable must be specified}"
|
REPO_PREFIX="${REPO_PREFIX?REPO_PREFIX env variable must be specified}"
|
||||||
|
|
||||||
|
# overwrite release/ with the latest manifests, adding "---" separator.
|
||||||
# inject new tag into the relevant k8s manifest
|
src="./kubernetes-manifests/*"
|
||||||
manifestfile="./release/kubernetes-manifests/demo.yaml"
|
manifestfile="./release/kubernetes-manifests/demo.yaml"
|
||||||
|
tmp="./release/kubernetes-manifests/tmp.yaml"
|
||||||
|
[ -e $manifestfile ] && rm $manifestfile
|
||||||
|
for f in $src; do (cat "${f}"; echo "---") >> $tmp; done
|
||||||
|
|
||||||
|
# remove extra google headers
|
||||||
|
gsed -i '/^#/d' $tmp
|
||||||
|
|
||||||
|
# remove empty lines
|
||||||
|
gsed -r -i '/^\s*$/d' $tmp
|
||||||
|
|
||||||
|
# add 1 google header to the top
|
||||||
|
cat "./release/.googleheader" $tmp > $manifestfile
|
||||||
|
rm $tmp
|
||||||
|
|
||||||
|
|
||||||
|
# replace image repo, tag for each deployment
|
||||||
for dir in ./src/*/
|
for dir in ./src/*/
|
||||||
do
|
do
|
||||||
svcname="$(basename $dir)"
|
svcname="$(basename $dir)"
|
||||||
|
@ -34,7 +49,7 @@ do
|
||||||
|
|
||||||
pattern="^(\s*)image:\s.*$svcname(.*)(\s*)"
|
pattern="^(\s*)image:\s.*$svcname(.*)(\s*)"
|
||||||
replace="\1image: $image\3"
|
replace="\1image: $image\3"
|
||||||
gsed -r -i "s|$pattern|$replace|g" $manifestfile
|
gsed -r -i "s|$pattern|$replace|g" $manifestfile
|
||||||
done
|
done
|
||||||
|
|
||||||
log "Successfully injected image tag into demo.yaml".
|
log "Successfully added image tags > wrote to demo.yaml".
|
||||||
|
|
13
release/.googleheader
Normal file
13
release/.googleheader
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Copyright 2019 Google LLC
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
|
@ -11,8 +11,6 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -129,38 +127,38 @@ spec:
|
||||||
app: checkoutservice
|
app: checkoutservice
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: server
|
- name: server
|
||||||
image: checkoutservice
|
image: checkoutservice
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 5050
|
- containerPort: 5050
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
exec:
|
exec:
|
||||||
command: ["/bin/grpc_health_probe", "-addr=:5050"]
|
command: ["/bin/grpc_health_probe", "-addr=:5050"]
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
exec:
|
exec:
|
||||||
command: ["/bin/grpc_health_probe", "-addr=:5050"]
|
command: ["/bin/grpc_health_probe", "-addr=:5050"]
|
||||||
env:
|
env:
|
||||||
- name: PRODUCT_CATALOG_SERVICE_ADDR
|
- name: PRODUCT_CATALOG_SERVICE_ADDR
|
||||||
value: "productcatalogservice:3550"
|
value: "productcatalogservice:3550"
|
||||||
- name: SHIPPING_SERVICE_ADDR
|
- name: SHIPPING_SERVICE_ADDR
|
||||||
value: "shippingservice:50051"
|
value: "shippingservice:50051"
|
||||||
- name: PAYMENT_SERVICE_ADDR
|
- name: PAYMENT_SERVICE_ADDR
|
||||||
value: "paymentservice:50051"
|
value: "paymentservice:50051"
|
||||||
- name: EMAIL_SERVICE_ADDR
|
- name: EMAIL_SERVICE_ADDR
|
||||||
value: "emailservice:5000"
|
value: "emailservice:5000"
|
||||||
- name: CURRENCY_SERVICE_ADDR
|
- name: CURRENCY_SERVICE_ADDR
|
||||||
value: "currencyservice:7000"
|
value: "currencyservice:7000"
|
||||||
- name: CART_SERVICE_ADDR
|
- name: CART_SERVICE_ADDR
|
||||||
value: "cartservice:7070"
|
value: "cartservice:7070"
|
||||||
# - name: JAEGER_SERVICE_ADDR
|
# - name: JAEGER_SERVICE_ADDR
|
||||||
# value: "jaeger-collector:14268"
|
# value: "jaeger-collector:14268"
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
memory: 64Mi
|
memory: 64Mi
|
||||||
limits:
|
limits:
|
||||||
cpu: 200m
|
cpu: 200m
|
||||||
memory: 128Mi
|
memory: 128Mi
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
@ -275,50 +273,50 @@ spec:
|
||||||
app: frontend
|
app: frontend
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: server
|
- name: server
|
||||||
image: frontend
|
image: frontend
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 10
|
||||||
httpGet:
|
httpGet:
|
||||||
path: "/_healthz"
|
path: "/_healthz"
|
||||||
port: 8080
|
port: 8080
|
||||||
httpHeaders:
|
httpHeaders:
|
||||||
- name: "Cookie"
|
- name: "Cookie"
|
||||||
value: "shop_session-id=x-readiness-probe"
|
value: "shop_session-id=x-readiness-probe"
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 10
|
||||||
httpGet:
|
httpGet:
|
||||||
path: "/_healthz"
|
path: "/_healthz"
|
||||||
port: 8080
|
port: 8080
|
||||||
httpHeaders:
|
httpHeaders:
|
||||||
- name: "Cookie"
|
- name: "Cookie"
|
||||||
value: "shop_session-id=x-liveness-probe"
|
value: "shop_session-id=x-liveness-probe"
|
||||||
env:
|
env:
|
||||||
- name: PRODUCT_CATALOG_SERVICE_ADDR
|
- name: PRODUCT_CATALOG_SERVICE_ADDR
|
||||||
value: "productcatalogservice:3550"
|
value: "productcatalogservice:3550"
|
||||||
- name: CURRENCY_SERVICE_ADDR
|
- name: CURRENCY_SERVICE_ADDR
|
||||||
value: "currencyservice:7000"
|
value: "currencyservice:7000"
|
||||||
- name: CART_SERVICE_ADDR
|
- name: CART_SERVICE_ADDR
|
||||||
value: "cartservice:7070"
|
value: "cartservice:7070"
|
||||||
- name: RECOMMENDATION_SERVICE_ADDR
|
- name: RECOMMENDATION_SERVICE_ADDR
|
||||||
value: "recommendationservice:8080"
|
value: "recommendationservice:8080"
|
||||||
- name: SHIPPING_SERVICE_ADDR
|
- name: SHIPPING_SERVICE_ADDR
|
||||||
value: "shippingservice:50051"
|
value: "shippingservice:50051"
|
||||||
- name: CHECKOUT_SERVICE_ADDR
|
- name: CHECKOUT_SERVICE_ADDR
|
||||||
value: "checkoutservice:5050"
|
value: "checkoutservice:5050"
|
||||||
- name: AD_SERVICE_ADDR
|
- name: AD_SERVICE_ADDR
|
||||||
value: "adservice:9555"
|
value: "adservice:9555"
|
||||||
# - name: JAEGER_SERVICE_ADDR
|
# - name: JAEGER_SERVICE_ADDR
|
||||||
# value: "jaeger-collector:14268"
|
# value: "jaeger-collector:14268"
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
memory: 64Mi
|
memory: 64Mi
|
||||||
limits:
|
limits:
|
||||||
cpu: 200m
|
cpu: 200m
|
||||||
memory: 128Mi
|
memory: 128Mi
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
@ -361,7 +359,7 @@ spec:
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: wait-frontend
|
- name: wait-frontend
|
||||||
image: loadgenerator
|
image: alpine:3.6
|
||||||
command: ['sh', '-c', 'set -x; apk add --no-cache curl;
|
command: ['sh', '-c', 'set -x; apk add --no-cache curl;
|
||||||
until timeout -t 2 curl -f "http://${FRONTEND_ADDR}"; do
|
until timeout -t 2 curl -f "http://${FRONTEND_ADDR}"; do
|
||||||
echo "waiting for http://${FRONTEND_ADDR}";
|
echo "waiting for http://${FRONTEND_ADDR}";
|
||||||
|
@ -451,9 +449,6 @@ spec:
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
exec:
|
exec:
|
||||||
command: ["/bin/grpc_health_probe", "-addr=:3550"]
|
command: ["/bin/grpc_health_probe", "-addr=:3550"]
|
||||||
# env:
|
|
||||||
# - name: JAEGER_SERVICE_ADDR
|
|
||||||
# value: "jaeger-collector:14268"
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
|
@ -595,9 +590,6 @@ spec:
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
exec:
|
exec:
|
||||||
command: ["/bin/grpc_health_probe", "-addr=:50051"]
|
command: ["/bin/grpc_health_probe", "-addr=:50051"]
|
||||||
# env:
|
|
||||||
# - name: JAEGER_SERVICE_ADDR
|
|
||||||
# value: "jaeger-collector:14268"
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
|
@ -618,3 +610,4 @@ spec:
|
||||||
- name: grpc
|
- name: grpc
|
||||||
port: 50051
|
port: 50051
|
||||||
targetPort: 50051
|
targetPort: 50051
|
||||||
|
---
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue