Verify evicted pods managed by petset controller will be recreated
Spawn pet set with single replica and simple pod. They will have conflicting hostPort definitions, and spawned on the same node. As the result pet set pod, it will be created after simple pod, will be in Failed state. Pet set controller will try to re-create it. After verifying that pet set pod failed and was recreated atleast once, we will remove pod with conflicting hostPort and wait until pet set pod will be in running state. Change-Id: I5903f5881f8606c696bd390df58b06ece33be88a
This commit is contained in:
@@ -96,8 +96,8 @@ func (p *petSyncer) Sync(pet *pcb) error {
|
||||
if err := p.SyncPVCs(pet); err != nil {
|
||||
return err
|
||||
}
|
||||
// if pet was evicted - we need to remove old one because of consistent naming
|
||||
if exists && isEvicted(realPet.pod) {
|
||||
// if pet failed - we need to remove old one because of consistent naming
|
||||
if exists && realPet.pod.Status.Phase == api.PodFailed {
|
||||
glog.V(4).Infof("Delete evicted pod %v", realPet.pod.Name)
|
||||
if err := p.petClient.Delete(realPet); err != nil {
|
||||
return err
|
||||
@@ -317,7 +317,3 @@ func (d *defaultPetHealthChecker) isHealthy(pod *api.Pod) bool {
|
||||
func (d *defaultPetHealthChecker) isDying(pod *api.Pod) bool {
|
||||
return pod != nil && pod.DeletionTimestamp != nil
|
||||
}
|
||||
|
||||
func isEvicted(pod *api.Pod) bool {
|
||||
return pod != nil && pod.Status.Phase == api.PodFailed && pod.Status.Reason == "Evicted"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user