Skip to content

Commit

Permalink
Made field serviceAccount available for both driver and executors (#924)
Browse files Browse the repository at this point in the history
Spark 3.0 will support specifying a k8s service account for the executor pods. This CL prepares the operator to support that in the upcoming Spark 3.0.0 release.
  • Loading branch information
liyinan926 authored May 24, 2020
1 parent cd632f1 commit 8c480ac
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
27 changes: 13 additions & 14 deletions docs/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -911,19 +911,6 @@ Maps to <code>spark.kubernetes.driver.request.cores</code> that is available sin
</tr>
<tr>
<td>
<code>serviceAccount</code></br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>ServiceAccount is the name of the Kubernetes service account used by the driver pod
when requesting executor pods from the API server.</p>
</td>
</tr>
<tr>
<td>
<code>javaOptions</code></br>
<em>
string
Expand Down Expand Up @@ -2548,6 +2535,18 @@ int64
<p>Termination grace periond seconds for the pod</p>
</td>
</tr>
<tr>
<td>
<code>serviceAccount</code></br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>ServiceAccount is the name of the custom Kubernetes service account used by the pod.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="sparkoperator.k8s.io/v1beta2.SparkUIConfiguration">SparkUIConfiguration
Expand Down Expand Up @@ -2611,5 +2610,5 @@ map[string]string
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>0e7e97d</code>.
on git commit <code>43fb5e7</code>.
</em></p>
Original file line number Diff line number Diff line change
Expand Up @@ -2838,6 +2838,8 @@ spec:
type: string
type: object
type: object
serviceAccount:
type: string
sidecars:
items:
properties:
Expand Down
2 changes: 2 additions & 0 deletions manifest/crds/sparkoperator.k8s.io_sparkapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2824,6 +2824,8 @@ spec:
type: string
type: object
type: object
serviceAccount:
type: string
sidecars:
items:
properties:
Expand Down
7 changes: 3 additions & 4 deletions pkg/apis/sparkoperator.k8s.io/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ type SparkPodSpec struct {
// Termination grace periond seconds for the pod
// +optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
// ServiceAccount is the name of the custom Kubernetes service account used by the pod.
// +optional
ServiceAccount *string `json:"serviceAccount,omitempty"`
}

// DriverSpec is specification of the driver.
Expand All @@ -496,10 +499,6 @@ type DriverSpec struct {
// Maps to `spark.kubernetes.driver.request.cores` that is available since Spark 3.0.
// +optional
CoreRequest *string `json:"coreRequest,omitempty"`
// ServiceAccount is the name of the Kubernetes service account used by the driver pod
// when requesting executor pods from the API server.
// +optional
ServiceAccount *string `json:"serviceAccount,omitempty"`
// JavaOptions is a string of extra JVM options to pass to the driver. For instance,
// GC settings or other logging.
// +optional
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/sparkapplication/sparkui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func TestCreateSparkUIIngress(t *testing.T) {
"nginx.ingress.kubernetes.io/force-ssl-redirect": "true",
},
IngressTLS: []extensions.IngressTLS{
{[]string{"host1", "host2"}, "secret"},
{Hosts: []string{"host1", "host2"}, SecretName: "secret"},
},
},
},
Expand All @@ -345,7 +345,7 @@ func TestCreateSparkUIIngress(t *testing.T) {
"kubernetes.io/ingress.class": "nginx",
},
IngressTLS: []extensions.IngressTLS{
{[]string{"host1", "host2"}, ""},
{Hosts: []string{"host1", "host2"}, SecretName: ""},
},
},
},
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestCreateSparkUIIngress(t *testing.T) {
"nginx.ingress.kubernetes.io/force-ssl-redirect": "true",
},
ingressTLS: []extensions.IngressTLS{
{[]string{"host1", "host2"}, "secret"},
{Hosts: []string{"host1", "host2"}, SecretName: "secret"},
},
},
expectError: false,
Expand All @@ -406,7 +406,7 @@ func TestCreateSparkUIIngress(t *testing.T) {
"nginx.ingress.kubernetes.io/force-ssl-redirect": "true",
},
ingressTLS: []extensions.IngressTLS{
{[]string{"host1", "host2"}, ""},
{Hosts: []string{"host1", "host2"}, SecretName: ""},
},
},
expectError: true,
Expand Down

0 comments on commit 8c480ac

Please sign in to comment.