Skip to content

Commit

Permalink
Restarting pods in an etcd cluster with PVC is safe.
Browse files Browse the repository at this point in the history
This is a simple fix that addresses Case C from
https://github.com/coreos/etcd-operator/blob/master/doc/design/persistent_volumes_etcd_data.md

It makes the etcd cluster with PVC able to recover from full k8s cluster
outage. This fixes coreos#1323 inspired by coreos#1323 (comment)
  • Loading branch information
xiwenc committed Jun 20, 2019
1 parent 8347d27 commit 2e05df6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/util/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ func AddEtcdVolumeToPod(pod *v1.Pod, pvc *v1.PersistentVolumeClaim) {
vol.VolumeSource = v1.VolumeSource{
PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ClaimName: pvc.Name},
}
// When PVC is used, make the pod auto recover in case of failure
pod.Spec.RestartPolicy = v1.RestartPolicyAlways
} else {
vol.VolumeSource = v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}
}
Expand Down

0 comments on commit 2e05df6

Please sign in to comment.