Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tpu-provisioner: Add support for Spot Node Pools #588

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tpu-provisioner/internal/cloud/gke.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,19 @@ func (g *GKE) nodePoolForPod(name string, p *corev1.Pod) (*containerv1beta1.Node
}
}

var taints []*containerv1beta1.NodeTaint

spot := p.Spec.NodeSelector["cloud.google.com/gke-spot"] == "true"
if spot {
// Add the taint that NAP would add.
// https://cloud.google.com/kubernetes-engine/docs/concepts/spot-vms#spotvms-nap
taints = append(taints, &containerv1beta1.NodeTaint{
Key: "cloud.google.com/gke-spot",
Value: "true",
Effect: "NO_SCHEDULE",
})
}

var secondaryDisks []containerv1beta1.SecondaryBootDisk
if g.ClusterContext.NodeSecondaryDisk != "" {
secondaryDisks = []containerv1beta1.SecondaryBootDisk{
Expand All @@ -288,6 +301,8 @@ func (g *GKE) nodePoolForPod(name string, p *corev1.Pod) (*containerv1beta1.Node
MachineType: machineType,
ReservationAffinity: reservation,
Labels: labels,
Spot: spot,
Taints: taints,
},
InitialNodeCount: int64(nodeCount),
Locations: []string{g.ClusterContext.NodeZone},
Expand Down