This commit is contained in:
Xiang Li 2016-08-25 11:57:32 -07:00 коммит произвёл GitHub
Родитель f5a11c09f1
Коммит e4d4180865
1 изменённых файлов: 9 добавлений и 10 удалений

Просмотреть файл

@ -1,27 +1,26 @@
# Cluster Membership Reconciliation # Cluster Membership Reconciliation
## Recovery ## Reconciliation
Given a desired size S, we have two membership states: Given a desired size S, we have two membership states:
- running pods P in k8s cluster - running pods P in k8s cluster
- membership M in controller knowledge - membership M in controller knowledge
Recovery is the process to make these two states consistent. Assuming “len(M) = S” here. Reconciliation is the process to make these two states consistent with the desired size S.
For each reconciling cycle, we get P from k8s API. Comparing M and P, we have the following steps: For each reconciling cycle, we get P from k8s API. Comparing M and P, we have the following steps:
1. Remove all pods from set P that does not belong to set M 1. Remove all pods from set P that does not belong to set M
2. P consist of remaining pods of P 2. P consist of remaining pods of P
3. If P = M, the current state matches the membership state. END. 3. If P = M, the current state matches the membership state. GOTO Resize.
4. If len(P) < len(M)/2 + 1, quorum lost. Go to recovery process (TODO). 4. If len(P) < len(M)/2 + 1, quorum lost. Go to recovery process (TODO).
5. Add one missing member. END. 5. Remove one member that in M but does not in P's. GOTO Resize.
## Resize ### Resize
Before resizing an etcd cluster, we need to ensure the running Pods set matches the membership knowledge. Or we need to do recovery first.
Given a desired size S and membership size M: Given a desired size S and membership size M:
1. If S = M, then END. 1. If P' != M, then END.
2. If S > M, add one member. END. 2. If S = M, then END.
3. If S < M, remove one member. END 3. If S > M, add one member. END.
4. If S < M, remove one member. END