Skip to content

Commit 01535bc

Browse files
razvanclaude
andcommitted
refactor(openlineage): replace authenticationClassRef with credentialsSecretName
AuthenticationClass is a server-side identity abstraction and does not fit outbound OpenLineage client->backend authentication, which is a static bearer token. Replace `authentication_class_ref` on OpenLineageConnectionSpec with an optional `credentials_secret_name` (a Secret holding the api key under `apiKey`) and drop `resolve_authentication_class`. See stackabletech/decisions#90 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8b1b821 commit 01535bc

3 files changed

Lines changed: 15 additions & 50 deletions

File tree

crates/stackable-operator/crds/OpenLineageConnection.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ spec:
2424
OpenLineage connection definition as a resource.
2525
Learn more about [OpenLineage](https://openlineage.io/).
2626
properties:
27-
authenticationClassRef:
27+
credentialsSecretName:
2828
description: |-
29-
Name of an [`AuthenticationClass`](https://docs.stackable.tech/home/nightly/concepts/authentication) used
30-
to authenticate against the OpenLineage backend. The `AuthenticationClass` is cluster-scoped
31-
and referenced by name; it is resolved at runtime via
32-
[`OpenLineageConnectionSpec::resolve_authentication_class`]. If not specified, no
29+
Name of a Secret containing the API key used to authenticate against the OpenLineage
30+
backend. The API key must be stored under the key `apiKey`. The Secret must be located in
31+
the same namespace as the workload using this connection. If not specified, no
3332
authentication is used.
3433
nullable: true
3534
type: string

crates/stackable-operator/src/crd/openlineage/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ pub mod versioned {
4747
#[serde(flatten)]
4848
pub tls: TlsClientDetails,
4949

50-
/// Name of an [`AuthenticationClass`](DOCS_BASE_URL_PLACEHOLDER/concepts/authentication) used
51-
/// to authenticate against the OpenLineage backend. The `AuthenticationClass` is cluster-scoped
52-
/// and referenced by name; it is resolved at runtime via
53-
/// [`OpenLineageConnectionSpec::resolve_authentication_class`]. If not specified, no
50+
/// Name of a Secret containing the API key used to authenticate against the OpenLineage
51+
/// backend. The API key must be stored under the key `apiKey`. The Secret must be located in
52+
/// the same namespace as the workload using this connection. If not specified, no
5453
/// authentication is used.
5554
#[serde(default, skip_serializing_if = "Option::is_none")]
56-
pub authentication_class_ref: Option<String>,
55+
pub credentials_secret_name: Option<String>,
5756
}
5857

5958
/// An OpenLineage connection, either inlined or referenced by the name of an
@@ -108,7 +107,7 @@ impl stackable_versioned::test_utils::RoundtripTestData for v1alpha1::OpenLineag
108107
secretClass: openlineage-cert
109108
- host: marquez
110109
port: 5000
111-
authenticationClassRef: openlineage-auth
110+
credentialsSecretName: openlineage-credentials
112111
"})
113112
.expect("Failed to parse OpenLineageConnectionSpec YAML")
114113
}
@@ -129,7 +128,7 @@ mod tests {
129128
host: "marquez".to_string(),
130129
port: 5000,
131130
tls: TlsClientDetails { tls: None },
132-
authentication_class_ref: None,
131+
credentials_secret_name: None,
133132
};
134133

135134
assert_eq!(connection.transport_url(), "http://marquez:5000");
@@ -147,7 +146,7 @@ mod tests {
147146
}),
148147
}),
149148
},
150-
authentication_class_ref: None,
149+
credentials_secret_name: None,
151150
};
152151

153152
assert_eq!(connection.transport_url(), "https://marquez:5000");
@@ -163,7 +162,7 @@ mod tests {
163162
verification: TlsVerification::None {},
164163
}),
165164
},
166-
authentication_class_ref: None,
165+
credentials_secret_name: None,
167166
};
168167

169168
assert_eq!(connection.transport_url(), "http://marquez:5000");

crates/stackable-operator/src/crd/openlineage/v1alpha1_impl.rs

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ use snafu::{ResultExt as _, Snafu};
22

33
use crate::{
44
client::Client,
5-
crd::{
6-
authentication::core::v1alpha1::AuthenticationClass,
7-
openlineage::{
8-
ResolvedOpenLineageConnection,
9-
v1alpha1::{
10-
InlineConnectionOrReference, OpenLineageConnection, OpenLineageConnectionSpec,
11-
},
12-
},
5+
crd::openlineage::{
6+
ResolvedOpenLineageConnection,
7+
v1alpha1::{InlineConnectionOrReference, OpenLineageConnection, OpenLineageConnectionSpec},
138
},
149
};
1510

@@ -21,13 +16,6 @@ pub enum OpenLineageError {
2116
source: Box<crate::client::Error>,
2217
open_lineage_connection: String,
2318
},
24-
25-
#[snafu(display("failed to retrieve AuthenticationClass '{authentication_class}'"))]
26-
RetrieveAuthenticationClass {
27-
#[snafu(source(from(crate::client::Error, Box::new)))]
28-
source: Box<crate::client::Error>,
29-
authentication_class: String,
30-
},
3119
}
3220

3321
impl OpenLineageConnectionSpec {
@@ -48,27 +36,6 @@ impl OpenLineageConnectionSpec {
4836
port = self.port
4937
)
5038
}
51-
52-
/// Resolves the [`AuthenticationClass`] referenced by this connection, if any.
53-
///
54-
/// Returns `Ok(None)` when no `authenticationClassRef` is configured. The `AuthenticationClass`
55-
/// is cluster-scoped, so no namespace is required.
56-
pub async fn resolve_authentication_class(
57-
&self,
58-
client: &Client,
59-
) -> Result<Option<AuthenticationClass>, OpenLineageError> {
60-
let Some(authentication_class_ref) = &self.authentication_class_ref else {
61-
return Ok(None);
62-
};
63-
64-
let resolved = AuthenticationClass::resolve(client, authentication_class_ref)
65-
.await
66-
.context(RetrieveAuthenticationClassSnafu {
67-
authentication_class: authentication_class_ref.clone(),
68-
})?;
69-
70-
Ok(Some(resolved))
71-
}
7239
}
7340

7441
impl InlineConnectionOrReference {

0 commit comments

Comments
 (0)