Skip to content

Commit

Permalink
Update logic for detecting taint updates to include taint effect
Browse files Browse the repository at this point in the history
  • Loading branch information
tloisel1 committed Jul 19, 2024
1 parent 5c4ecaf commit 32bac8a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/gyro/aws/eks/EksNodegroupResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,15 @@ public void update(
Set<Taint> taintsToRemove = new HashSet<>(currentTaints);
taintsToRemove.removeAll(taints);

// Taint key cannot be in both added and removed, this means it's an update, so remove from remove set.
Set<String> taintKeysToAddOrUpdate = taintsToAddOrUpdate.stream()
.map(Taint::key)
.collect(Collectors.toSet());
// Detect true updates.
// taint key and effect is the same, but the value is different.
Set<Taint> taintsToUpdate = new HashSet<>();
for (Taint taint : taintsToRemove) {
if (taintKeysToAddOrUpdate.contains(taint.key())) {
taintsToUpdate.add(taint);
for (Taint taintToBeRemoved : taintsToRemove) {
for (Taint taintToBeAdded : taintsToAddOrUpdate) {
if (taintToBeRemoved.key().equals(taintToBeAdded.key()) &&
taintToBeRemoved.effect().equals(taintToBeAdded.effect())) {
taintsToUpdate.add(taintToBeRemoved);
}
}
}
taintsToRemove.removeAll(taintsToUpdate);
Expand Down

0 comments on commit 32bac8a

Please sign in to comment.