Skip to content

Commit

Permalink
Merge pull request #275 from perfectsense/feature/make-taints-updatable
Browse files Browse the repository at this point in the history
Make taints updatable
  • Loading branch information
harjain99 authored Oct 7, 2024
2 parents b677660 + 8ca79f7 commit c127c44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/gyro/google/gke/GkeNodeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ public void setWorkloadMetadataConfig(GkeWorkloadMetadataConfig workloadMetadata
*
* @subresource gyro.google.gke.GkeNodeTaint
*/
@Updatable
public Set<GkeNodeTaint> getTaint() {
if (taint == null) {
taint = new HashSet<>();
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/gyro/google/gke/GkeNodePool.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.google.container.v1beta1.GetNodePoolRequest;
import com.google.container.v1beta1.NodeLabels;
import com.google.container.v1beta1.NodePool;
import com.google.container.v1beta1.NodeTaints;
import com.google.container.v1beta1.SetNodePoolAutoscalingRequest;
import com.google.container.v1beta1.SetNodePoolSizeRequest;
import com.google.container.v1beta1.UpdateNodePoolRequest;
Expand Down Expand Up @@ -347,7 +348,7 @@ protected void doUpdate(GyroUI ui, State state, Resource current, Set<String> ch
});
}

if (changedFieldNames.contains("config")) {
if (changedFieldNames.contains("config") && getConfig() != null) {
if (getConfig().getWorkloadMetadataConfig() != null) {
builder.setWorkloadMetadataConfig(getConfig().getWorkloadMetadataConfig()
.toWorkloadMetadataConfig());
Expand All @@ -359,7 +360,16 @@ protected void doUpdate(GyroUI ui, State state, Resource current, Set<String> ch
builder.setLabels(nlBuilder.build());
}

builder.setImageType(getConfig().getImageType());
if (getConfig().getTaint() != null) {
NodeTaints.Builder ntBuilder = NodeTaints.newBuilder();
getConfig().getTaint().stream().map(GkeNodeTaint::toNodeTaint).forEach(ntBuilder::addTaints);
builder.setTaints(ntBuilder.build());
}

if (getConfig().getImageType() != null) {
builder.setImageType(getConfig().getImageType());
}

updateCluster(client, builder);
builder.clear();
}
Expand Down

0 comments on commit c127c44

Please sign in to comment.