@@ -139,9 +139,11 @@ public VerificationResult verify(KubectlWrapper kubectl, Manifests.ManifestObjec
139139 * available replicas (status.availableReplicas).
140140 */
141141 private static class DeploymentVerifier implements Verifier {
142- private static final String AVAILABLE_REPLICAS = "availableReplicas" ;
143- private static final String MINIMUM_REPLICAS_JSONPATH = "spec.replicas" ;
144142 private static final String STATUS_JSONPATH = "status" ;
143+ private static final String AVAILABLE_REPLICAS = "availableReplicas" ;
144+ private static final String UPDATED_REPLICAS = "updatedReplicas" ;
145+ private static final String REPLICAS = "replicas" ;
146+ private static final String DESIRED_REPLICAS_JSONPATH = "spec.replicas" ;
145147
146148 /**
147149 * Verifies that the deployment was applied to the GKE cluster.
@@ -164,19 +166,25 @@ public VerificationResult verify(KubectlWrapper kubectl, Manifests.ManifestObjec
164166 return errorResult (e , object );
165167 }
166168
167- Integer minReplicas = JsonPath .read (json , MINIMUM_REPLICAS_JSONPATH );
169+ Integer desiredReplicas = JsonPath .read (json , DESIRED_REPLICAS_JSONPATH );
168170 Map <String , Object > status = JsonPath .read (json , STATUS_JSONPATH );
169171 Integer availableReplicas = (Integer ) status .getOrDefault (AVAILABLE_REPLICAS , 0 );
172+ Integer updatedReplicas = (Integer ) status .getOrDefault (UPDATED_REPLICAS , 0 );
173+ Integer replicas = (Integer ) status .getOrDefault (REPLICAS , 0 );
170174 boolean verified =
171- minReplicas != null
172- && availableReplicas != null
173- && minReplicas .intValue () <= availableReplicas .intValue ();
175+ desiredReplicas != null
176+ && updatedReplicas .intValue () >= desiredReplicas .intValue ()
177+ && replicas .intValue () <= updatedReplicas .intValue ()
178+ && availableReplicas .intValue () == updatedReplicas .intValue ();
174179
175180 log .append ("AvailableReplicas = " )
176181 .append (availableReplicas )
177182 .append ("," )
178- .append (" MinimumReplicas = " )
179- .append (minReplicas )
183+ .append (" UpdatedReplicas = " )
184+ .append (updatedReplicas )
185+ .append ("," )
186+ .append (" DesiredReplicas = " )
187+ .append (desiredReplicas )
180188 .append ("\n " );
181189
182190 return new VerificationResult (log .toString (), verified , object );
0 commit comments