Skip to content

Commit 454e8cf

Browse files
committed
refactor!: remove openlineage.enabled field
1 parent 4335b15 commit 454e8cf

6 files changed

Lines changed: 36 additions & 87 deletions

File tree

docs/modules/spark-k8s/pages/usage-guide/openlineage.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
https://openlineage.io/[OpenLineage] is an open standard for data lineage collection.
44
The Spark operator can automatically emit lineage events for a `SparkApplication` to an OpenLineage-compatible backend such as https://marquezproject.github.io/marquez/[Marquez], without any manual `sparkConf` wiring.
55

6-
When enabled, the operator injects everything required to make the https://openlineage.io/docs/integrations/spark/[OpenLineage Spark listener] work:
6+
When configured, the operator injects everything required to make the https://openlineage.io/docs/integrations/spark/[OpenLineage Spark listener] work:
77

88
* the OpenLineage Spark listener (appended to `spark.extraListeners`, so any listener you configure yourself is preserved),
99
* the OpenLineage jar baked into the Spark image, referenced via `spark.jars` so it shares the same classloader as connectors pulled in through xref:usage-guide/job-dependencies.adoc[`deps.packages`] (for example Apache Iceberg),
@@ -23,14 +23,13 @@ kind: SparkApplication
2323
metadata:
2424
name: orders-by-nation
2525
spec:
26-
openLineage:
27-
enabled: true # <1>
26+
openLineage: # <1>
2827
configMapName: marquez-discovery # <2>
2928
# namespace: orders-lineage # <3>
3029
# appName: orders-by-nation # <4>
3130
...
3231
----
33-
<1> Enable OpenLineage event emission. Defaults to `false`, in which case the operator emits nothing OpenLineage-related and behaviour is unchanged.
32+
<1> Adding the `openLineage` block enables OpenLineage event emission. Omit it entirely to leave OpenLineage off (the default), in which case the operator emits nothing OpenLineage-related and behaviour is unchanged.
3433
<2> Name of a discovery ConfigMap holding the backend endpoint (see below).
3534
Must be in the same namespace as the `SparkApplication`.
3635
<3> Optional. The OpenLineage namespace events are reported under.
@@ -52,7 +51,7 @@ data:
5251
<1> Base URL of the OpenLineage backend, for example the Marquez API service.
5352

5453
Alternatively, you can set the endpoint directly through `sparkConf` (`spark.openlineage.transport.url`).
55-
If `enabled: true` and no endpoint can be resolved from either the discovery ConfigMap or `sparkConf`, reconciliation fails with a clear error rather than emitting a config that silently drops events.
54+
If the `openLineage` block is present and no endpoint can be resolved from either the discovery ConfigMap or `sparkConf`, reconciliation fails with a clear error rather than emitting a config that silently drops events.
5655

5756
[#job-name]
5857
== Job name

extra/crds.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,10 +1982,6 @@ spec:
19821982
nullable: true
19831983
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
19841984
type: string
1985-
enabled:
1986-
default: false
1987-
description: Enable OpenLineage event emission. Defaults to `false` (nothing is injected).
1988-
type: boolean
19891985
namespace:
19901986
description: |-
19911987
The OpenLineage namespace lineage is reported under.
@@ -6624,10 +6620,6 @@ spec:
66246620
nullable: true
66256621
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
66266622
type: string
6627-
enabled:
6628-
default: false
6629-
description: Enable OpenLineage event emission. Defaults to `false` (nothing is injected).
6630-
type: boolean
66316623
namespace:
66326624
description: |-
66336625
The OpenLineage namespace lineage is reported under.

rust/operator-binary/src/config/jvm.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ pub fn construct_extra_java_options(
3939
// OpenLineage on Spark 4.x needs `java.base/java.security` opened to the unnamed module,
4040
// otherwise the driver throws a non-fatal `InaccessibleObjectException` and silently degrades
4141
// extension-interface lineage (MVP §7). Added to both driver and executor.
42-
if spark_application
43-
.spec
44-
.open_lineage
45-
.as_ref()
46-
.is_some_and(|open_lineage| open_lineage.enabled)
47-
{
42+
if spark_application.spec.open_lineage.is_some() {
4843
jvm_args.push(OPENLINEAGE_ADD_OPENS.to_string());
4944
}
5045

@@ -157,8 +152,7 @@ mod tests {
157152
mainApplicationFile: test.py
158153
sparkImage:
159154
productVersion: 1.2.3
160-
openLineage:
161-
enabled: true
155+
openLineage: {}
162156
"#;
163157

164158
let deserializer = serde_yaml::Deserializer::from_str(input);

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

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,7 @@ impl v1alpha1::SparkApplication {
753753
// `sparkConf` (so it goes in BEFORE the merge below). The two append-merge keys
754754
// (`spark.jars`, `spark.extraListeners`) are handled AFTER the merge so a user value is
755755
// combined with — not clobbered by — ours. See the OpenLineage usage guide.
756-
if let Some(open_lineage) = &self.spec.open_lineage
757-
&& open_lineage.enabled
758-
{
756+
if let Some(open_lineage) = &self.spec.open_lineage {
759757
// Fail fast rather than emit a transport that silently drops every event.
760758
let has_url_override = self
761759
.spec
@@ -795,12 +793,7 @@ impl v1alpha1::SparkApplication {
795793

796794
// OpenLineage append-merge keys: combine our values with any user-provided ones (already
797795
// merged into `submit_conf` above) so neither clobbers the other.
798-
if self
799-
.spec
800-
.open_lineage
801-
.as_ref()
802-
.is_some_and(|open_lineage| open_lineage.enabled)
803-
{
796+
if self.spec.open_lineage.is_some() {
804797
append_conf_csv(
805798
&mut submit_conf,
806799
"spark.extraListeners",
@@ -1670,8 +1663,7 @@ spec:
16701663
mainApplicationFile: test.py
16711664
sparkImage:
16721665
productVersion: 1.2.3
1673-
openLineage:
1674-
enabled: true
1666+
openLineage: {}
16751667
"#};
16761668

16771669
#[test]
@@ -1701,36 +1693,22 @@ spec:
17011693
);
17021694
}
17031695

1704-
#[rstest]
1705-
#[case::absent(indoc! {r#"
1706-
---
1707-
apiVersion: spark.stackable.tech/v1alpha1
1708-
kind: SparkApplication
1709-
metadata:
1710-
name: spark-examples
1711-
namespace: default
1712-
spec:
1713-
mode: cluster
1714-
mainApplicationFile: test.py
1715-
sparkImage:
1716-
productVersion: 1.2.3
1717-
"#})]
1718-
#[case::disabled(indoc! {r#"
1719-
---
1720-
apiVersion: spark.stackable.tech/v1alpha1
1721-
kind: SparkApplication
1722-
metadata:
1723-
name: spark-examples
1724-
namespace: default
1725-
spec:
1726-
mode: cluster
1727-
mainApplicationFile: test.py
1728-
sparkImage:
1729-
productVersion: 1.2.3
1730-
openLineage:
1731-
enabled: false
1732-
"#})]
1733-
fn test_openlineage_injects_nothing_when_absent_or_disabled(#[case] yaml: &str) {
1696+
#[test]
1697+
fn test_openlineage_injects_nothing_when_absent() {
1698+
// No `openLineage` block → OpenLineage is off (its absence is the disable switch).
1699+
let yaml = indoc! {r#"
1700+
---
1701+
apiVersion: spark.stackable.tech/v1alpha1
1702+
kind: SparkApplication
1703+
metadata:
1704+
name: spark-examples
1705+
namespace: default
1706+
spec:
1707+
mode: cluster
1708+
mainApplicationFile: test.py
1709+
sparkImage:
1710+
productVersion: 1.2.3
1711+
"#};
17341712
// Endpoint is supplied to prove it is ignored, not that it is simply missing.
17351713
let command = build_command_with_openlineage(yaml, Some("http://marquez:5000"));
17361714

@@ -1754,8 +1732,7 @@ spec:
17541732
mainApplicationFile: test.py
17551733
sparkImage:
17561734
productVersion: 1.2.3
1757-
openLineage:
1758-
enabled: true
1735+
openLineage: {}
17591736
sparkConf:
17601737
spark.extraListeners: com.example.CustomListener
17611738
"#};
@@ -1780,8 +1757,7 @@ spec:
17801757
mainApplicationFile: test.py
17811758
sparkImage:
17821759
productVersion: 1.2.3
1783-
openLineage:
1784-
enabled: true
1760+
openLineage: {}
17851761
sparkConf:
17861762
spark.openlineage.transport.url: http://custom:1234
17871763
spark.openlineage.namespace: custom-ns
@@ -1818,8 +1794,7 @@ spec:
18181794
mainApplicationFile: test.py
18191795
sparkImage:
18201796
productVersion: 1.2.3
1821-
openLineage:
1822-
enabled: true
1797+
openLineage: {}
18231798
sparkConf:
18241799
spark.openlineage.transport.url: http://custom:1234
18251800
"#};
@@ -1843,7 +1818,6 @@ spec:
18431818
sparkImage:
18441819
productVersion: 1.2.3
18451820
openLineage:
1846-
enabled: true
18471821
appName: explicit-name
18481822
sparkConf:
18491823
spark.app.name: spark-conf-name
@@ -1864,8 +1838,7 @@ spec:
18641838
mainApplicationFile: test.py
18651839
sparkImage:
18661840
productVersion: 1.2.3
1867-
openLineage:
1868-
enabled: true
1841+
openLineage: {}
18691842
sparkConf:
18701843
spark.app.name: spark-conf-name
18711844
"#},
@@ -1885,8 +1858,7 @@ spec:
18851858
mainApplicationFile: test.py
18861859
sparkImage:
18871860
productVersion: 1.2.3
1888-
openLineage:
1889-
enabled: true
1861+
openLineage: {}
18901862
"#},
18911863
"metadata-name",
18921864
true

rust/operator-binary/src/openlineage.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,15 @@ use crate::crd::{Error, ObjectHasNoNameSnafu, v1alpha1};
1515

1616
/// OpenLineage lineage emission for a [`SparkApplication`].
1717
///
18-
/// When enabled, the operator injects the OpenLineage Spark listener, points its HTTP transport
19-
/// at the backend resolved from the discovery ConfigMap, and sets a stable job name. All injected
20-
/// values are defaults: they can be overridden via `sparkConf`.
18+
/// Adding this block enables OpenLineage: the operator injects the OpenLineage Spark listener,
19+
/// points its HTTP transport at the backend resolved from the discovery ConfigMap, and sets a
20+
/// stable job name. Omit the block to leave OpenLineage off. All injected values are defaults:
21+
/// they can be overridden via `sparkConf`.
2122
///
2223
/// [`SparkApplication`]: crate::crd::v1alpha1::SparkApplication
2324
#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)]
2425
#[serde(rename_all = "camelCase")]
2526
pub struct OpenLineageSpec {
26-
/// Enable OpenLineage event emission. Defaults to `false` (nothing is injected).
27-
#[serde(default)]
28-
pub enabled: bool,
29-
3027
/// The OpenLineage namespace lineage is reported under.
3128
/// Defaults to the application's Kubernetes namespace (`metadata.namespace`).
3229
#[serde(default, skip_serializing_if = "Option::is_none")]

rust/operator-binary/src/spark_k8s_controller.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,7 @@ pub async fn reconcile(
243243
// warn if the job name falls back to `metadata.name` — both only matter when OpenLineage is
244244
// enabled.
245245
let openlineage_endpoint = resolve_openlineage_endpoint(client, spark_application).await?;
246-
if spark_application
247-
.spec
248-
.open_lineage
249-
.as_ref()
250-
.is_some_and(|open_lineage| open_lineage.enabled)
246+
if spark_application.spec.open_lineage.is_some()
251247
&& spark_application
252248
.resolved_openlineage_app_name()
253249
.context(BuildCommandSnafu)?
@@ -341,8 +337,7 @@ async fn resolve_openlineage_endpoint(
341337
let Some(open_lineage) = &spark_application.spec.open_lineage else {
342338
return Ok(None);
343339
};
344-
let (true, Some(config_map_name)) = (open_lineage.enabled, &open_lineage.config_map_name)
345-
else {
340+
let Some(config_map_name) = &open_lineage.config_map_name else {
346341
return Ok(None);
347342
};
348343

0 commit comments

Comments
 (0)