Skip to content

Rename all files accordingly to kuard 2nd edition, and ensure compliance with k8s 1.18 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions 10-0-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion 9-1-fluentd.yaml → 11-1-fluentd.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd
namespace: kube-system
labels:
app: fluentd
spec:
selector:
matchLabels:
app: fluentd
template:
metadata:
labels:
Expand Down
6 changes: 5 additions & 1 deletion 9-2-nginx-fast-storage.yaml → 11-2-nginx-fast-storage.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: "DaemonSet"
metadata:
labels:
app: nginx
ssd: "true"
name: nginx-fast-storage
spec:
selector:
matchLabels:
app: nginx
ssd: "true"
template:
metadata:
labels:
Expand Down
1 change: 1 addition & 0 deletions 10-1-job-oneshot.yaml → 12-1-job-oneshot.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO fix image name (blue) in book
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion 10-4-rs-queue.yaml → 12-4-rs-queue.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
metadata:
labels:
Expand All @@ -8,6 +8,11 @@ metadata:
name: queue
spec:
replicas: 1
selector:
matchLabels:
app: work-queue
component: queue
chapter: jobs
template:
metadata:
labels:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion 13-10-mongo-simple.yaml → 15-10-mongo-simple.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
spec:
serviceName: "mongo"
replicas: 3
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
Expand Down
File renamed without changes.
45 changes: 45 additions & 0 deletions 15-12-1-mongo-init.sh
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
5 changes: 4 additions & 1 deletion 13-13-mongo.yaml → 15-13-mongo.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
spec:
serviceName: "mongo"
replicas: 3
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 13-6-mysql-replicaset.yaml → 15-6-mysql-replicaset.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: mysql
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion 14-1-parse.yaml → 17-1-parse.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: parse-server
namespace: default
spec:
replicas: 1
selector:
matchLabels:
run: parse-server
template:
metadata:
labels:
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion 14-10-redis.yaml → 17-11-redis.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:
replicas: 3
selector:
matchLabels:
app: redis
serviceName: redis
template:
metadata:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 14-4-ghost.yaml → 17-4-ghost.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: ghost
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions 7-1-alpaca-prod-readiness.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions 8-1-kuard-rs.yaml → 9-1-kuard-rs.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
metadata:
labels:
app: kuard
name: kuard
spec:
replicas: 1
replicas: 10
selector:
matchLabels:
app: kuard
version: "2"
template:
metadata:
labels:
Expand Down