@@ -86,7 +86,23 @@ func (s *StatefulSet) ArePodsRemoved(ctx context.Context) bool {
8686 return true
8787}
8888
89- func (s * StatefulSet ) ArePodsReady (ctx context.Context , instanceCount int , minReadyInstanceCount * int ) bool {
89+ func checkReadinessByContainers (pod corev1.Pod , byContainerNames []string ) bool {
90+ found := 0
91+ for _ , containerNameToCheck := range byContainerNames {
92+ for _ , containerStatus := range pod .Status .ContainerStatuses {
93+ if containerStatus .Name != containerNameToCheck {
94+ continue
95+ }
96+ if ! containerStatus .Ready {
97+ return false
98+ }
99+ found ++
100+ }
101+ }
102+ return found == len (byContainerNames )
103+ }
104+
105+ func (s * StatefulSet ) ArePodsReady (ctx context.Context , instanceCount int , minReadyInstanceCount * int , byContainerNames []string ) bool {
90106 logger := log .FromContext (ctx )
91107 podList := s .getPods (ctx )
92108 if podList == nil {
@@ -100,7 +116,13 @@ func (s *StatefulSet) ArePodsReady(ctx context.Context, instanceCount int, minRe
100116
101117 readyInstanceCount := 0
102118 for _ , pod := range podList .Items {
103- if pod .Status .Phase != corev1 .PodRunning {
119+ var ready bool
120+ if len (byContainerNames ) > 0 {
121+ ready = checkReadinessByContainers (pod , byContainerNames )
122+ } else {
123+ ready = pod .Status .Phase == corev1 .PodRunning
124+ }
125+ if ! ready {
104126 logger .Info ("pod is not yet running" , "podName" , pod .Name , "phase" , pod .Status .Phase )
105127 } else {
106128 readyInstanceCount += 1
0 commit comments