Skip to content

Commit

Permalink
fix(kubernetes): Fix daemonset stability condition (#3863) (#3865)
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
spinnakerbot authored and ezimanyi committed Jul 11, 2019
1 parent 3d2ef0b commit e26cfc1
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 e26cfc1

Please sign in to comment.