Skip to content

Commit

Permalink
Replace redis master/slave terminology with leader/follower (kubernet…
Browse files Browse the repository at this point in the history
…es#127)

* init

* update guestbook all in one
  • Loading branch information
askmeegs committed Jun 24, 2020
1 parent d6efa11 commit abbb383
Show file tree
Hide file tree
Showing 17 changed files with 204 additions and 320 deletions.
34 changes: 11 additions & 23 deletions guestbook/all-in-one/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,16 @@ spec:
app: guestbook
tier: frontend
---
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
# these labels can be applied automatically
# from the labels in the pod template if not set
labels:
app: guestbook
tier: frontend
spec:
# this replicas value is default
# modify it according to your case
replicas: 3
# selector can be applied automatically
# from the labels in the pod template if not set
# selector:
# app: guestbook
# tier: frontend
selector:
matchLabels:
app: guestbook
tier: frontend
template:
metadata:
labels:
Expand All @@ -40,18 +32,14 @@ spec:
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
image: gcr.io/google_samples/gb-frontend:v5
env:
- name: GET_HOSTS_FROM
value: "dns"
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access environment variables to find service host
# info, comment out the 'value: dns' line above, and uncomment the
# line below.
# value: env
ports:
- containerPort: 80

110 changes: 37 additions & 73 deletions guestbook/all-in-one/guestbook-all-in-one.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
name: redis-leader
labels:
app: redis
role: leader
tier: backend
role: master
spec:
ports:
# the port that this service should serve on
- port: 6379
targetPort: 6379
selector:
app: redis
role: leader
tier: backend
role: master
---
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
# these labels can be applied automatically
# from the labels in the pod template if not set
name: redis-leader
labels:
app: redis
role: master
role: leader
tier: backend
spec:
# this replicas value is default
# modify it according to your case
replicas: 1
# selector can be applied automatically
# from the labels in the pod template if not set
# selector:
# app: guestbook
# role: master
# tier: backend
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
role: master
role: leader
tier: backend
spec:
containers:
- name: master
image: gcr.io/google_containers/redis:e2e # or just image: redis
- name: leader
image: "docker.io/redis:6.0.5"
resources:
requests:
cpu: 100m
Expand All @@ -56,62 +48,47 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: redis-slave
name: redis-follower
labels:
app: redis
role: follower
tier: backend
role: slave
spec:
ports:
# the port that this service should serve on
- port: 6379
selector:
app: redis
role: follower
tier: backend
role: slave
---
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
# these labels can be applied automatically
# from the labels in the pod template if not set
name: redis-follower
labels:
app: redis
role: slave
role: follower
tier: backend
spec:
# this replicas value is default
# modify it according to your case
replicas: 2
# selector can be applied automatically
# from the labels in the pod template if not set
# selector:
# app: guestbook
# role: slave
# tier: backend
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
role: slave
role: follower
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
- name: follower
image: gcr.io/google_samples/gb-redis-follower:v2
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access an environment variable to find the master
# service's host, comment out the 'value: dns' line above, and
# uncomment the line below.
# value: env
ports:
- containerPort: 6379
---
Expand All @@ -131,24 +108,16 @@ spec:
app: guestbook
tier: frontend
---
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
# these labels can be applied automatically
# from the labels in the pod template if not set
labels:
app: guestbook
tier: frontend
spec:
# this replicas value is default
# modify it according to your case
replicas: 3
# selector can be applied automatically
# from the labels in the pod template if not set
# selector:
# app: guestbook
# tier: frontend
selector:
matchLabels:
app: guestbook
tier: frontend
template:
metadata:
labels:
Expand All @@ -157,18 +126,13 @@ spec:
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
image: gcr.io/google_samples/gb-frontend:v5
env:
- name: GET_HOSTS_FROM
value: "dns"
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access environment variables to find service host
# info, comment out the 'value: dns' line above, and uncomment the
# line below.
# value: env
ports:
- containerPort: 80
- containerPort: 80
46 changes: 46 additions & 0 deletions guestbook/all-in-one/redis-follower.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: v1
kind: Service
metadata:
name: redis-follower
labels:
app: redis
role: follower
tier: backend
spec:
ports:
# the port that this service should serve on
- port: 6379
selector:
app: redis
role: follower
tier: backend
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-follower
labels:
app: redis
role: follower
tier: backend
spec:
replicas: 2
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
role: follower
tier: backend
spec:
containers:
- name: follower
image: gcr.io/google_samples/gb-redis-follower:v2
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379
61 changes: 0 additions & 61 deletions guestbook/all-in-one/redis-slave.yaml

This file was deleted.

0 comments on commit abbb383

Please sign in to comment.