Skip to content

Commit

Permalink
k8sutil: Restarting pods in an etcd cluster with PVC is safe
Browse files Browse the repository at this point in the history
When PVC is used, make the pod auto recover in case of failure.

Source: coreos#2097
  • Loading branch information
laurelnaiad committed Jan 21, 2020
1 parent f7a9166 commit 887eaf9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/util/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ func AddEtcdVolumeToPod(pod *v1.Pod, pvc *v1.PersistentVolumeClaim, tmpfs bool)
vol.VolumeSource = v1.VolumeSource{
PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ClaimName: pvc.Name},
}
// https://github.com/coreos/etcd-operator/pull/2097
// 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{}}
if tmpfs {
Expand Down

0 comments on commit 887eaf9

Please sign in to comment.