Rename all files accordingly to kuard 2nd edition
- Move all objects, except for chapter 17 from v1beta to v1 - Fix an error on kuard image for Job chapter (#12)
This commit is contained in:
parent
c78e7500a1
commit
4f5c952545
24
10-0-deployment.yaml
Normal file
24
10-0-deployment.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: kuard
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
run: kuard
|
||||||
|
replicas: 200
|
||||||
|
strategy:
|
||||||
|
rollingUpdate:
|
||||||
|
maxSurge: 25%
|
||||||
|
maxUnavailable: 25%
|
||||||
|
type: RollingUpdate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/change-cause: "Update to blue kuard"
|
||||||
|
labels:
|
||||||
|
run: kuard
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: kuard
|
||||||
|
image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||||
@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: DaemonSet
|
kind: DaemonSet
|
||||||
metadata:
|
metadata:
|
||||||
name: fluentd
|
name: fluentd
|
||||||
@ -6,6 +6,9 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: fluentd
|
app: fluentd
|
||||||
spec:
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: fluentd
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: "DaemonSet"
|
kind: "DaemonSet"
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -6,6 +6,10 @@ metadata:
|
|||||||
ssd: "true"
|
ssd: "true"
|
||||||
name: nginx-fast-storage
|
name: nginx-fast-storage
|
||||||
spec:
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nginx
|
||||||
|
ssd: "true"
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
# TODO fix image name (blue) in book
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: ReplicaSet
|
kind: ReplicaSet
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -8,6 +8,11 @@ metadata:
|
|||||||
name: queue
|
name: queue
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: work-queue
|
||||||
|
component: queue
|
||||||
|
chapter: jobs
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -1,10 +1,13 @@
|
|||||||
apiVersion: apps/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: mongo
|
name: mongo
|
||||||
spec:
|
spec:
|
||||||
serviceName: "mongo"
|
serviceName: "mongo"
|
||||||
replicas: 3
|
replicas: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mongo
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
45
15-12-1-mongo-init.sh
Normal file
45
15-12-1-mongo-init.sh
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Need to wait for the readiness health check to pass so that the
|
||||||
|
# mongo names resolve. This is kind of wonky.
|
||||||
|
until ping -c 1 ${HOSTNAME}.mongo; do
|
||||||
|
echo "waiting for DNS (${HOSTNAME}.mongo)..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
until /usr/bin/mongo --eval 'printjson(db.serverStatus())'; do
|
||||||
|
echo "connecting to local mongo..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
echo "connected to local."
|
||||||
|
|
||||||
|
HOST=mongo-0.mongo:27017
|
||||||
|
|
||||||
|
until /usr/bin/mongo --host=${HOST} --eval 'printjson(db.serverStatus())'; do
|
||||||
|
echo "connecting to remote mongo..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
echo "connected to remote."
|
||||||
|
|
||||||
|
if [[ "${HOSTNAME}" != 'mongo-0' ]]; then
|
||||||
|
until /usr/bin/mongo --host=${HOST} --eval="printjson(rs.status())" \
|
||||||
|
| grep -v "no replset config has been received"; do
|
||||||
|
echo "waiting for replication set initialization"
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
echo "adding self to mongo-0"
|
||||||
|
/usr/bin/mongo --host=${HOST} \
|
||||||
|
--eval="printjson(rs.add('${HOSTNAME}.mongo'))"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${HOSTNAME}" == 'mongo-0' ]]; then
|
||||||
|
echo "initializing replica set"
|
||||||
|
/usr/bin/mongo --eval="printjson(rs.initiate(\
|
||||||
|
{'_id': 'rs0', 'members': [{'_id': 0, \
|
||||||
|
'host': 'mongo-0.mongo:27017'}]}))"
|
||||||
|
fi
|
||||||
|
echo "initialized"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
sleep 3600
|
||||||
|
done
|
||||||
@ -1,10 +1,13 @@
|
|||||||
apiVersion: apps/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: mongo
|
name: mongo
|
||||||
spec:
|
spec:
|
||||||
serviceName: "mongo"
|
serviceName: "mongo"
|
||||||
replicas: 3
|
replicas: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mongo
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: ReplicaSet
|
kind: ReplicaSet
|
||||||
metadata:
|
metadata:
|
||||||
name: mysql
|
name: mysql
|
||||||
@ -1,10 +1,13 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: parse-server
|
name: parse-server
|
||||||
namespace: default
|
namespace: default
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
run: parse-server
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -1,9 +1,12 @@
|
|||||||
apiVersion: apps/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: redis
|
name: redis
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: redis
|
||||||
serviceName: redis
|
serviceName: redis
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: ghost
|
name: ghost
|
||||||
44
7-1-alpaca-prod-readiness.yaml
Normal file
44
7-1-alpaca-prod-readiness.yaml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: alpaca
|
||||||
|
env: prod
|
||||||
|
ver: "1"
|
||||||
|
name: alpaca-prod
|
||||||
|
spec:
|
||||||
|
replicas: 3
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: alpaca
|
||||||
|
env: prod
|
||||||
|
ver: "1"
|
||||||
|
strategy:
|
||||||
|
rollingUpdate:
|
||||||
|
maxSurge: 25%
|
||||||
|
maxUnavailable: 25%
|
||||||
|
type: RollingUpdate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: alpaca
|
||||||
|
env: prod
|
||||||
|
ver: "1"
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
name: alpaca-prod
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
protocol: TCP
|
||||||
|
readinessProbe:
|
||||||
|
failureThreshold: 3
|
||||||
|
httpGet:
|
||||||
|
path: /ready
|
||||||
|
port: 8080
|
||||||
|
scheme: HTTP
|
||||||
|
periodSeconds: 2
|
||||||
|
successThreshold: 1
|
||||||
|
timeoutSeconds: 1
|
||||||
@ -1,9 +1,15 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: ReplicaSet
|
kind: ReplicaSet
|
||||||
metadata:
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: kuard
|
||||||
name: kuard
|
name: kuard
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 10
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: kuard
|
||||||
|
version: "2"
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
Loading…
Reference in New Issue
Block a user