Skip to content

Commit 997308f

Browse files
committed
refactor: deprecate application spec.mode
1 parent a93e949 commit 997308f

5 files changed

Lines changed: 40 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ All notable changes to this project will be documented in this file.
3333
### Deprecated
3434

3535
- `SparkApplication`/`SparkApplicationTemplate` `spec.job` is deprecated and ignored since `v1alpha2` (renamed to `deprecatedJob` in that version). The driver `Job` is now built from `spec.driver` ([#711]).
36-
- `SparkApplication`/`SparkApplicationTemplate` `spec.mode` is deprecated and ignored: the operator always runs the driver in client mode internally ([#711]).
36+
- `SparkApplication`/`SparkApplicationTemplate` `spec.mode` is deprecated and ignored (renamed to `deprecatedMode` in `v1alpha2`): the operator always runs the driver in client mode internally. `mode` is now optional in `v1alpha1` as well ([#711]).
3737

3838
[#674]: https://github.com/stackabletech/spark-k8s-operator/pull/674
3939
[#679]: https://github.com/stackabletech/spark-k8s-operator/pull/679

extra/crds.yaml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,19 @@ spec:
241241
type: object
242242
x-kubernetes-preserve-unknown-fields: true
243243
type: object
244+
deprecatedMode:
245+
default: cluster
246+
description: |-
247+
Deprecated and ignored.
248+
249+
Since v1alpha2 the operator no longer runs a separate `spark-submit` process. The driver
250+
is launched directly as a Kubernetes Job running in client mode, so the deploy mode is
251+
always client internally. This field is kept for backwards compatibility but has no
252+
effect.
253+
enum:
254+
- cluster
255+
- client
256+
type: string
244257
deps:
245258
default:
246259
excludePackages: []
@@ -1977,18 +1990,6 @@ spec:
19771990
description: The main class - i.e. entry point - for JVM artifacts.
19781991
nullable: true
19791992
type: string
1980-
mode:
1981-
description: |-
1982-
Deprecated and ignored.
1983-
1984-
Since v1alpha2 the operator no longer runs a separate `spark-submit` process. The driver
1985-
is launched directly as a Kubernetes Job running in client mode, so the deploy mode is
1986-
always client internally. This field is kept for backwards compatibility but has no
1987-
effect.
1988-
enum:
1989-
- cluster
1990-
- client
1991-
type: string
19921993
s3connection:
19931994
description: |-
19941995
Configure an S3 connection that the SparkApplication has access to.
@@ -2226,7 +2227,6 @@ spec:
22262227
type: array
22272228
required:
22282229
- mainApplicationFile
2229-
- mode
22302230
- sparkImage
22312231
type: object
22322232
status:
@@ -4233,6 +4233,7 @@ spec:
42334233
nullable: true
42344234
type: string
42354235
mode:
4236+
default: cluster
42364237
description: |-
42374238
Deprecated and ignored.
42384239

@@ -4481,7 +4482,6 @@ spec:
44814482
type: array
44824483
required:
44834484
- mainApplicationFile
4484-
- mode
44854485
- sparkImage
44864486
type: object
44874487
status:
@@ -7140,6 +7140,19 @@ spec:
71407140
type: object
71417141
x-kubernetes-preserve-unknown-fields: true
71427142
type: object
7143+
deprecatedMode:
7144+
default: cluster
7145+
description: |-
7146+
Deprecated and ignored.
7147+
7148+
Since v1alpha2 the operator no longer runs a separate `spark-submit` process. The driver
7149+
is launched directly as a Kubernetes Job running in client mode, so the deploy mode is
7150+
always client internally. This field is kept for backwards compatibility but has no
7151+
effect.
7152+
enum:
7153+
- cluster
7154+
- client
7155+
type: string
71437156
deps:
71447157
default:
71457158
excludePackages: []
@@ -8876,18 +8889,6 @@ spec:
88768889
description: The main class - i.e. entry point - for JVM artifacts.
88778890
nullable: true
88788891
type: string
8879-
mode:
8880-
description: |-
8881-
Deprecated and ignored.
8882-
8883-
Since v1alpha2 the operator no longer runs a separate `spark-submit` process. The driver
8884-
is launched directly as a Kubernetes Job running in client mode, so the deploy mode is
8885-
always client internally. This field is kept for backwards compatibility but has no
8886-
effect.
8887-
enum:
8888-
- cluster
8889-
- client
8890-
type: string
88918892
s3connection:
88928893
description: |-
88938894
Configure an S3 connection that the SparkApplication has access to.
@@ -9125,7 +9126,6 @@ spec:
91259126
type: array
91269127
required:
91279128
- mainApplicationFile
9128-
- mode
91299129
- sparkImage
91309130
type: object
91319131
required:
@@ -11096,6 +11096,7 @@ spec:
1109611096
nullable: true
1109711097
type: string
1109811098
mode:
11099+
default: cluster
1109911100
description: |-
1110011101
Deprecated and ignored.
1110111102

@@ -11344,7 +11345,6 @@ spec:
1134411345
type: array
1134511346
required:
1134611347
- mainApplicationFile
11347-
- mode
1134811348
- sparkImage
1134911349
type: object
1135011350
required:

rust/operator-binary/src/crd/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,12 @@ pub mod versioned {
222222
/// is launched directly as a Kubernetes Job running in client mode, so the deploy mode is
223223
/// always client internally. This field is kept for backwards compatibility but has no
224224
/// effect.
225-
pub mode: SparkMode,
225+
#[versioned(deprecated(
226+
since = "v1alpha2",
227+
note = "the operator always runs the driver in client mode; this field is ignored"
228+
))]
229+
#[serde(default)]
230+
pub deprecated_mode: SparkMode,
226231

227232
/// The main class - i.e. entry point - for JVM artifacts.
228233
#[serde(default, skip_serializing_if = "Option::is_none")]

rust/operator-binary/src/crd/roles.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,13 @@ pub enum SparkContainer {
8888
Vector,
8989
Tls,
9090
}
91-
#[derive(Clone, Debug, Deserialize, Display, JsonSchema, PartialEq, Serialize)]
91+
#[derive(Clone, Debug, Default, Deserialize, Display, JsonSchema, PartialEq, Serialize)]
9292
#[serde(rename_all = "lowercase")]
9393
#[strum(serialize_all = "lowercase")]
9494
pub enum SparkMode {
95+
// Deprecated and ignored: the operator always runs the driver in client mode. The default only
96+
// exists so the deprecated `mode` field can be optional.
97+
#[default]
9598
Cluster,
9699
Client,
97100
}

rust/operator-binary/src/crd/template_merger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn deep_merge(base: &SparkApplication, overlay: &SparkApplication) -> SparkA
3737
// Merge spec fields
3838
let spec = super::v1alpha2::SparkApplicationSpec {
3939
// Scalar fields: overlay takes precedence
40-
mode: overlay.spec.mode.clone(),
40+
deprecated_mode: overlay.spec.deprecated_mode.clone(),
4141
main_application_file: overlay.spec.main_application_file.clone(),
4242

4343
// Option fields: overlay if Some, otherwise base

0 commit comments

Comments
 (0)