use of io.kubernetes.client.util.taints.Taints.TaintsBuilder in project java by kubernetes-client.
the class KubectlTaint method executeInternal.
private V1Node executeInternal() throws KubectlException, ApiException, IOException {
CoreV1Api v1 = new CoreV1Api(apiClient);
V1Node node = v1.readNode(name, null);
TaintsBuilder builder = Taints.taints(node);
for (Map.Entry<String, Pair<String, String>> taint : addingTaints.entrySet()) {
builder.addTaint(taint.getKey(), taint.getValue().getLeft(), makeEffect(taint.getValue().getRight()));
}
for (Map.Entry<String, String> taint : removeTaints.entrySet()) {
if (taint.getValue() == null) {
builder.removeTaint(taint.getKey());
} else {
builder.removeTaint(taint.getKey(), makeEffect(taint.getValue()));
}
}
return v1.replaceNode(name, node, null, null, null, null);
}
Aggregations