Skip to content

Commit

Permalink
add node selector
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelawilkins committed Apr 12, 2021
1 parent d222980 commit e9f254a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/controller/sparkapplication/driver_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ func (spm *realClientModeSubmissionPodManager) createClientDriverPod(app *v1beta
}
}

nodeSelectors := make(map[string]string)
for key, value := range app.Spec.SparkConf {
if strings.HasPrefix(key, "spark.kubernetes.node.selector.") {
nodeSelector := strings.ReplaceAll(key, "spark.kubernetes.node.selector.", "")
nodeSelectors[nodeSelector] = value
}
}

//append all volumes
var volumes []corev1.Volume
var volumeMounts []corev1.VolumeMount
Expand Down Expand Up @@ -183,6 +191,7 @@ func (spm *realClientModeSubmissionPodManager) createClientDriverPod(app *v1beta
Spec: corev1.PodSpec{
ImagePullSecrets: imagePullSecrets,
Volumes: volumes,
NodeSelector: nodeSelectors,
Containers: []corev1.Container{
{
Name: "spark-kubernetes-driver",
Expand Down

0 comments on commit e9f254a

Please sign in to comment.