Skip to content

Commit

Permalink
fix(kubernetes): Fix daemonset stability condition (#3863)
Browse files Browse the repository at this point in the history
Currently we'll consider a daemonset stable if it has the correct
number of replicas, even if they are of the wrong generation. Fix
this by adding a check for the generation, just as we do for replica
sets.

Also, fix a bug in the replica set implementation where we are
comparing Integers using == instead of using .equals.
  • Loading branch information
ezimanyi authored and maggieneterval committed Jul 11, 2019
1 parent ac3b5ef commit 5c5939c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ private Status status(V1beta2DaemonSet daemonSet) {
return result;
}

Long observedGeneration = status.getObservedGeneration();
if (observedGeneration != null
&& !observedGeneration.equals(daemonSet.getMetadata().getGeneration())) {
return result.unstable("Waiting for daemonset spec update to be observed");
}

int desiredReplicas = status.getDesiredNumberScheduled();
Integer existing = status.getCurrentNumberScheduled();
if (existing == null || desiredReplicas > existing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private Status status(V1beta2ReplicaSet replicaSet) {

Long observedGeneration = status.getObservedGeneration();
if (observedGeneration != null
&& observedGeneration != replicaSet.getMetadata().getGeneration()) {
&& !observedGeneration.equals(replicaSet.getMetadata().getGeneration())) {
result.unstable("Waiting for replicaset spec update to be observed");
}

Expand Down

0 comments on commit 5c5939c

Please sign in to comment.