Skip to content

Commit

Permalink
[CE-381] Support PodAntiAffinity in cello/ansible
Browse files Browse the repository at this point in the history
Support deployment to support equal distribution of pods across nodes
when using kubernetes in Cello/ansible by using PodAntiAffinity concept
in kubernetes.

Change-Id: Ied40caa97bf2942030b74c8b8e937fa7d91fc4c7
Signed-off-by: Surya <suryalnvs@gmail.com>
  • Loading branch information
suryalnvs committed Jun 11, 2018
1 parent 7b95454 commit 47a8f57
Showing 1 changed file with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,25 @@ metadata:
name: {{ zookeeper }}
labels:
k8s-app: {{ zookeeper }}
type: zookeeper
spec:
{% if creds %}
imagePullSecrets:
- name: regcred
{% endif %}
restartPolicy: OnFailure
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: type
operator: In
values:
- zookeeper
topologyKey: kubernetes.io/hostname
containers:
- name: {{ zookeeper }}
image: {{ fabric.repo.url }}fabric-zookeeper:{{ fabric.helper_tag }}
Expand Down Expand Up @@ -65,12 +78,25 @@ metadata:
name: {{ kafka }}
labels:
k8s-app: {{ kafka }}
type: kafka
spec:
{% if creds %}
imagePullSecrets:
- name: regcred
{% endif %}
restartPolicy: OnFailure
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: type
operator: In
values:
- kafka
topologyKey: kubernetes.io/hostname
containers:
- name: {{ kafka }}
image: {{ fabric.repo.url }}fabric-kafka:{{ fabric.helper_tag }}
Expand Down Expand Up @@ -111,6 +137,7 @@ metadata:
name: {{ ca.name }}
labels:
k8s-app: {{ ca.name }}
type: ca
spec:
{% if creds %}
imagePullSecrets:
Expand All @@ -121,6 +148,18 @@ spec:
- name: task-pv-storage
persistentVolumeClaim:
claimName: fabriccerts
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: type
operator: In
values:
- ca
topologyKey: kubernetes.io/hostname
containers:
- name: {{ ca.name }}
image: {{ fabric.repo.url }}fabric-ca:{{ fabric.ca.image_tag }}
Expand Down Expand Up @@ -167,12 +206,25 @@ metadata:
name: {{ peer.name }}
labels:
k8s-app: {{ peer.name }}
type: peer
spec:
{% if creds %}
imagePullSecrets:
- name: regcred
{% endif %}
restartPolicy: OnFailure
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: type
operator: In
values:
- peer
topologyKey: kubernetes.io/hostname
volumes:
- name: varrun
hostPath:
Expand Down Expand Up @@ -264,6 +316,7 @@ metadata:
name: {{ orderer.name }}
labels:
k8s-app: {{ orderer.name }}
type: orderer
spec:
{% if creds %}
imagePullSecrets:
Expand All @@ -274,6 +327,18 @@ spec:
- name: task-pv-storage
persistentVolumeClaim:
claimName: fabriccerts
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: type
operator: In
values:
- orderer
topologyKey: kubernetes.io/hostname
containers:
- name: {{ orderer.name }}
image: {{ fabric.repo.url }}fabric-orderer:{{ fabric.baseimage_tag }}
Expand Down

0 comments on commit 47a8f57

Please sign in to comment.