Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ All notable changes to this project will be documented in this file.
- Spark applications now correctly handle the case where both the History Server and the S3 connection use the same TLS secret class ([#655]).
Previously, the Spark application pods contained the same TLS volume twice, which could not be applied to the API server.
- The spark-submit job now sets the correct `-Djavax.net.ssl.trustStore` properties ([#655]).
- Spark application jobs can now have pod/node affinities. This was an omission as the application driver and executors already had this field for a long time. ([#664]).

### Changed

Expand Down Expand Up @@ -49,6 +50,7 @@ All notable changes to this project will be documented in this file.
[#656]: https://github.com/stackabletech/spark-k8s-operator/pull/656
[#660]: https://github.com/stackabletech/spark-k8s-operator/pull/660
[#663]: https://github.com/stackabletech/spark-k8s-operator/pull/663
[#664]: https://github.com/stackabletech/spark-k8s-operator/pull/664

## [25.11.0] - 2025-11-07

Expand Down
18 changes: 9 additions & 9 deletions Cargo.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions crate-hashes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,11 +1,64 @@
= Pod Placement
:description: Learn how to configure pod placement for Spark applications and Spark History Server on the Stackable Data Platform.

== Spark Applications

You can configure pod placement of application drivers and executors by adding an `affinity` property to the corresponding configuration section.
You can configure pod placement of the submit job, application driver and executors by adding an `affinity` property to the corresponding configuration section.

Refer to the https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/[Kubernetes documentation] for more information about affinity.

By default, the operator doesn't configure any affinity.

The following example shows how to use the `spec.job.config.affinity` property to configure the pod placement of the submit job.
In a similar way, you can configure the pod placement of the driver and executors by using the `spec.driver.config.affinity` and `spec.executor.config.affinity` properties respectively.

[source,yaml]
----
apiVersion: spark.stackable.tech/v1alpha1
kind: SparkApplication
metadata:
name: examples # <1>
spec:
mode: cluster
mainApplicationFile: app.jar
sparkImage:
productVersion: 4.1.1
job:
config:
affinity: # <2>
nodeSelector: # <3>
affinity-role: job
nodeAffinity: # <4>
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 11
preference:
matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- fictional-zone-job
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- antarctica-east1
- antarctica-west1
podAffinity: # <5>
# ...
podAntiAffinity: # <6>
# ...
----
<1> The name of the SparkApplication.
<2> The affinity configuration for the submit job.
<3> A node selector that matches nodes with the label `affinity-role=job`.
<4> A node affinity with both preferred and required rules.
<5> A pod affinity configuration.
<6> A pod anti-affinity configuration.

Pod placement policies can also be configured in xref:usage-guide/app_templates.adoc[Spark Application Templates].

== Spark History Server

You can configure the Pod placement of Spark History Server pods as described in xref:concepts:operations/pod_placement.adoc[].
Expand Down
64 changes: 64 additions & 0 deletions extra/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,38 @@ spec:
config:
default: {}
properties:
affinity:
default:
nodeAffinity: null
nodeSelector: null
podAffinity: null
podAntiAffinity: null
description: |-
These configuration settings control
[Pod placement](https://docs.stackable.tech/home/nightly/concepts/operations/pod_placement).
properties:
nodeAffinity:
description: Same as the `spec.affinity.nodeAffinity` field on the Pod, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
x-kubernetes-preserve-unknown-fields: true
nodeSelector:
additionalProperties:
type: string
description: Simple key-value pairs forming a nodeSelector, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
podAffinity:
description: Same as the `spec.affinity.podAffinity` field on the Pod, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
x-kubernetes-preserve-unknown-fields: true
podAntiAffinity:
description: Same as the `spec.affinity.podAntiAffinity` field on the Pod, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
requestedSecretLifetime:
description: |-
Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`.
Expand Down Expand Up @@ -5975,6 +6007,38 @@ spec:
config:
default: {}
properties:
affinity:
default:
nodeAffinity: null
nodeSelector: null
podAffinity: null
podAntiAffinity: null
description: |-
These configuration settings control
[Pod placement](https://docs.stackable.tech/home/nightly/concepts/operations/pod_placement).
properties:
nodeAffinity:
description: Same as the `spec.affinity.nodeAffinity` field on the Pod, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
x-kubernetes-preserve-unknown-fields: true
nodeSelector:
additionalProperties:
type: string
description: Simple key-value pairs forming a nodeSelector, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
podAffinity:
description: Same as the `spec.affinity.podAffinity` field on the Pod, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
x-kubernetes-preserve-unknown-fields: true
podAntiAffinity:
description: Same as the `spec.affinity.podAntiAffinity` field on the Pod, see the [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node)
nullable: true
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
requestedSecretLifetime:
description: |-
Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`.
Expand Down
Loading