func waitForPartitionedRollingUpdate(c clientset.Interface, set *appsv1.StatefulSet) (*appsv1.StatefulSet, *v1.PodList) {
	var pods *v1.PodList
	if set.Spec.UpdateStrategy.Type != appsv1.RollingUpdateStatefulSetStrategyType {
		framework.Failf("StatefulSet %s/%s attempt to wait for partitioned update with updateStrategy %s",
			set.Namespace,
			set.Name,
			set.Spec.UpdateStrategy.Type)
	}
	if set.Spec.UpdateStrategy.RollingUpdate == nil || set.Spec.UpdateStrategy.RollingUpdate.Partition == nil {
		framework.Failf("StatefulSet %s/%s attempt to wait for partitioned update with nil RollingUpdate or nil Partition",
			set.Namespace,
			set.Name)
	}
	e2estatefulset.WaitForState(c, set, func(set2 *appsv1.StatefulSet, pods2 *v1.PodList) (bool, error) {
		set = set2
		pods = pods2
		partition := int(*set.Spec.UpdateStrategy.RollingUpdate.Partition)
		if len(pods.Items) < int(*set.Spec.Replicas) {
			return false, nil
		}
		if partition <= 0 && set.Status.UpdateRevision != set.Status.CurrentRevision {
			framework.Logf("Waiting for StatefulSet %s/%s to complete update",
				set.Namespace,
				set.Name,
			)
			e2estatefulset.SortStatefulPods(pods)
			for i := range pods.Items {
				if pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel] != set.Status.UpdateRevision {
					framework.Logf("Waiting for Pod %s/%s to have revision %s update revision %s",
						pods.Items[i].Namespace,
						pods.Items[i].Name,
						set.Status.UpdateRevision,
						pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel])
				}
			}
			return false, nil
		}
		for i := int(*set.Spec.Replicas) - 1; i >= partition; i-- {
			if pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel] != set.Status.UpdateRevision {
				framework.Logf("Waiting for Pod %s/%s to have revision %s update revision %s",
					pods.Items[i].Namespace,
					pods.Items[i].Name,
					set.Status.UpdateRevision,
					pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel])
				return false, nil
			}
		}
		return true, nil
	})
	return set, pods
}
// waitForPartitionedRollingUpdate waits for all Pods in set to exist and have the correct revision. set must have
// a RollingUpdateStatefulSetStrategyType with a non-nil RollingUpdate and Partition. All Pods with ordinals less
// than or equal to the Partition are expected to be at set's current revision. All other Pods are expected to be
// at its update revision.
waitForPartitionedRollingUpdate waits for all Pods in set to exist and have the correct revision. set must have
a RollingUpdateStatefulSetStrategyType with a non-nil RollingUpdate and Partition. All Pods with ordinals less
than or equal to the Partition are expected to be at set's current revision. All other Pods are expected to be
at its update revision.
// waitForPartitionedRollingUpdate waits for all Pods in set to exist and have the correct revision . set must have // a RollingUpdateStatefulSetStrategyType with a non - nil RollingUpdate and Partition . All Pods with ordinals less // than or equal to the Partition are expected to be at set ' s current revision . All other Pods are expected to be // at its update revision .
func waitForPartitionedRollingUpdate(c clientset.Interface, set *appsv1.StatefulSet) (*appsv1.StatefulSet, *v1.PodList) {
	var pods *v1.PodList
	if set.Spec.UpdateStrategy.Type != appsv1.RollingUpdateStatefulSetStrategyType {
		framework.Failf("StatefulSet %s/%s attempt to wait for partitioned update with updateStrategy %s",
			set.Namespace,
			set.Name,
			set.Spec.UpdateStrategy.Type)
	}
	if set.Spec.UpdateStrategy.RollingUpdate == nil || set.Spec.UpdateStrategy.RollingUpdate.Partition == nil {
		framework.Failf("StatefulSet %s/%s attempt to wait for partitioned update with nil RollingUpdate or nil Partition",
			set.Namespace,
			set.Name)
	}
	e2estatefulset.WaitForState(c, set, func(set2 *appsv1.StatefulSet, pods2 *v1.PodList) (bool, error) {
		set = set2
		pods = pods2
		partition := int(*set.Spec.UpdateStrategy.RollingUpdate.Partition)
		if len(pods.Items) < int(*set.Spec.Replicas) {
			return false, nil
		}
		if partition <= 0 && set.Status.UpdateRevision != set.Status.CurrentRevision {
			framework.Logf("Waiting for StatefulSet %s/%s to complete update",
				set.Namespace,
				set.Name,
			)
			e2estatefulset.SortStatefulPods(pods)
			for i := range pods.Items {
				if pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel] != set.Status.UpdateRevision {
					framework.Logf("Waiting for Pod %s/%s to have revision %s update revision %s",
						pods.Items[i].Namespace,
						pods.Items[i].Name,
						set.Status.UpdateRevision,
						pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel])
				}
			}
			return false, nil
		}
		for i := int(*set.Spec.Replicas) - 1; i >= partition; i-- {
			if pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel] != set.Status.UpdateRevision {
				framework.Logf("Waiting for Pod %s/%s to have revision %s update revision %s",
					pods.Items[i].Namespace,
					pods.Items[i].Name,
					set.Status.UpdateRevision,
					pods.Items[i].Labels[appsv1.StatefulSetRevisionLabel])
				return false, nil
			}
		}
		return true, nil
	})
	return set, pods
}
func waitForPartitionedRollingUpdate ( c clientset . Interface , set * appsv1 . StatefulSet ) ( * appsv1 . StatefulSet , * v1 . PodList ) { var pods * v1 . PodList if set . Spec . UpdateStrategy . Type != appsv1 . RollingUpdateStatefulSetStrategyType { framework . Failf ( " " , set . Namespace , set . Name , set . Spec . UpdateStrategy . Type ) } if set . Spec . UpdateStrategy . RollingUpdate == nil || set . Spec . UpdateStrategy . RollingUpdate . Partition == nil { framework . Failf ( " " , set . Namespace , set . Name ) } e2estatefulset . WaitForState ( c , set , func ( set2 * appsv1 . StatefulSet , pods2 * v1 . PodList ) ( bool , error ) { set = set2 pods = pods2 partition := int ( * set . Spec . UpdateStrategy . RollingUpdate . Partition ) if len ( pods . Items ) < int ( * set . Spec . Replicas ) { return false , nil } if partition <= 0 && set . Status . UpdateRevision != set . Status . CurrentRevision { framework . Logf ( " " , set . Namespace , set . Name , ) e2estatefulset . SortStatefulPods ( pods ) for i := range pods . Items { if pods . Items [ i ] . Labels [ appsv1 . StatefulSetRevisionLabel ] != set . Status . UpdateRevision { framework . Logf ( " " , pods . Items [ i ] . Namespace , pods . Items [ i ] . Name , set . Status . UpdateRevision , pods . Items [ i ] . Labels [ appsv1 . StatefulSetRevisionLabel ] ) } } return false , nil } for i := int ( * set . Spec . Replicas ) - 1 ; i >= partition ; i -- { if pods . Items [ i ] . Labels [ appsv1 . StatefulSetRevisionLabel ] != set . Status . UpdateRevision { framework . Logf ( " " , pods . Items [ i ] . Namespace , pods . Items [ i ] . Name , set . Status . UpdateRevision , pods . Items [ i ] . Labels [ appsv1 . StatefulSetRevisionLabel ] ) return false , nil } } return true , nil } ) return set , pods }
waitForPartitionedRollingUpdate waits for all Pods in set to exist and have the correct revision.
waitForPartitionedRollingUpdate waits for all Pods in set to exist and have the correct revision .