Skip to content

Commit 4ca1c0d

Browse files
Techassisbernauer
andauthored
feat(stackable-versioned)!: Add conversion tracking (#1056)
* chore: Add edition to rustfmt override command * fix(stackable-versioned): Finish error accumulator This uses correct error handling by letting the error accumulator handle the fallible function. Previously, this panicked, because the accumulator was dropped without being finished. * refactor(stackable-versioned): Simplify and improve From code generation * refactor(stackable-versioned): Remove standalone and non-K8s specific code * chore: Adjust CRD code to reflect attribute changes * feat!(stackable-versioned): Add conversion tracking * fix(stackable-versioned): Fix edge-cases uncovered by UI tests * test(stackable-versioned): Adjust test inputs and UI stderr snapshots * fix(stackable-versioned): Use trait from core, use correct boolean expr * fix(stackable-versioned): Remove minor errors in generated code * test(stackable-version): Review and accept updated snapshots * test(stackable-versioned): Adjust existing integration tests * test(stackable-versioned): Add conversion roundtrip integration test * chore(stackable-versioned): Add FIXME comments * chore(stackable-operator): Add required Default derive to ListenerStatus * chore(stackable-versioned): Remove unused k8s-version dependency * fix(stackable-versioned): Add missing trailing comma in generated code * test(stackable-versioned): Add additional status field This also removes various unused derives to simplify the integration test. * fix(stackable-versioned): Only emit tracking_into if opted in * docs(stackable-versioned): Update doc comments * chore(stackable-versioned): Ignore code block in doc comment * feat(stackable-versioned): Use proper JSONPath syntax * chore(stackable-versioned): Use BTreeMap instead of HashMap * chore(stackable-versioned): Use jsonPath instead of fieldName as field name * test(stackable-versioned): Update person name * chore(stackable-operator): Sort deps alphabetically * chore(stackable-versioned): Remove udeps ignores * chore(stackable-versioned): Replace matches! with match * chore(stackable-versioned): Re-add some udeps ignores * chore(stackable-versioned): Move some deps back * test(stackable-versioned): Simplify gender defaulting * fix(stackable-versioned): Pass JSONPath variable by reference Co-authored-by: Sebastian Bernauer <[email protected]> * chore(stackable-versioned): Error if nested is used without experimental flag * test(stackable-versioned): Fix doc test * chore(stackable-versioned): Update changelog --------- Co-authored-by: Sebastian Bernauer <[email protected]>
1 parent c0ebd1e commit 4ca1c0d

File tree

128 files changed

+4664
-5103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+4664
-5103
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"rust-analyzer.rustfmt.overrideCommand": [
55
"rustfmt",
66
"+nightly-2025-05-26",
7+
"--edition",
8+
"2024",
79
"--"
810
]
911
}

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-operator/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ telemetry = []
1515
versioned = []
1616

1717
[dependencies]
18-
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] }
19-
stackable-versioned = { path = "../stackable-versioned", features = ["k8s"] }
2018
stackable-operator-derive = { path = "../stackable-operator-derive" }
2119
stackable-shared = { path = "../stackable-shared" }
20+
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] }
21+
stackable-versioned = { path = "../stackable-versioned" }
2222

2323
chrono.workspace = true
2424
clap.workspace = true

crates/stackable-operator/src/crd/authentication/core/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ use crate::versioned::versioned;
66

77
mod v1alpha1_impl;
88

9-
#[versioned(version(name = "v1alpha1"))]
9+
#[versioned(
10+
version(name = "v1alpha1"),
11+
crates(
12+
kube_core = "kube::core",
13+
k8s_openapi = "k8s_openapi",
14+
schemars = "schemars",
15+
)
16+
)]
1017
pub mod versioned {
1118
pub mod v1alpha1 {
1219
// Re-export the v1alpha1-specific error type from the private impl module.
@@ -26,14 +33,9 @@ pub mod versioned {
2633
///
2734
/// [1]: DOCS_BASE_URL_PLACEHOLDER/concepts/authentication
2835
/// [2]: DOCS_BASE_URL_PLACEHOLDER/tutorials/authentication_with_openldap
29-
#[versioned(k8s(
36+
#[versioned(crd(
3037
group = "authentication.stackable.tech",
3138
plural = "authenticationclasses",
32-
crates(
33-
kube_core = "kube::core",
34-
k8s_openapi = "k8s_openapi",
35-
schemars = "schemars",
36-
)
3739
))]
3840
#[derive(
3941
Clone,

crates/stackable-operator/src/crd/authentication/kerberos/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ use serde::{Deserialize, Serialize};
33
use stackable_versioned::versioned;
44

55
#[versioned(version(name = "v1alpha1"))]
6-
#[derive(
7-
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
8-
)]
9-
#[serde(rename_all = "camelCase")]
10-
pub struct AuthenticationProvider {
11-
/// Mandatory SecretClass used to obtain keytabs.
12-
pub kerberos_secret_class: String,
6+
pub mod versioned {
7+
#[derive(
8+
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
9+
)]
10+
#[serde(rename_all = "camelCase")]
11+
pub struct AuthenticationProvider {
12+
/// Mandatory SecretClass used to obtain keytabs.
13+
pub kerberos_secret_class: String,
14+
}
1315
}

crates/stackable-operator/src/crd/authentication/tls/mod.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ use serde::{Deserialize, Serialize};
33
use stackable_versioned::versioned;
44

55
#[versioned(version(name = "v1alpha1"))]
6-
#[derive(
7-
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
8-
)]
9-
#[serde(rename_all = "camelCase")]
10-
pub struct AuthenticationProvider {
11-
/// See [ADR017: TLS authentication](DOCS_BASE_URL_PLACEHOLDER/contributor/adr/adr017-tls_authentication).
12-
/// If `client_cert_secret_class` is not set, the TLS settings may also be used for client authentication.
13-
/// If `client_cert_secret_class` is set, the [SecretClass](DOCS_BASE_URL_PLACEHOLDER/secret-operator/secretclass)
14-
/// will be used to provision client certificates.
15-
pub client_cert_secret_class: Option<String>,
6+
pub mod versioned {
7+
#[derive(
8+
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
9+
)]
10+
#[serde(rename_all = "camelCase")]
11+
pub struct AuthenticationProvider {
12+
/// See [ADR017: TLS authentication](DOCS_BASE_URL_PLACEHOLDER/contributor/adr/adr017-tls_authentication).
13+
/// If `client_cert_secret_class` is not set, the TLS settings may also be used for client authentication.
14+
/// If `client_cert_secret_class` is set, the [SecretClass](DOCS_BASE_URL_PLACEHOLDER/secret-operator/secretclass)
15+
/// will be used to provision client certificates.
16+
pub client_cert_secret_class: Option<String>,
17+
}
1618
}

crates/stackable-operator/src/crd/listener/class/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod versioned {
2525
/// Defines a policy for how [Listeners](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listener) should be exposed.
2626
/// Read the [ListenerClass documentation](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass)
2727
/// for more information.
28-
#[versioned(k8s(group = "listeners.stackable.tech"))]
28+
#[versioned(crd(group = "listeners.stackable.tech"))]
2929
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq, Eq)]
3030
#[serde(rename_all = "camelCase")]
3131
pub struct ListenerClassSpec {

crates/stackable-operator/src/crd/listener/listeners/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub mod versioned {
4949
/// ["sticky" scheduling](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listener#_sticky_scheduling).
5050
///
5151
/// Learn more in the [Listener documentation](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listener).
52-
#[versioned(k8s(
52+
#[versioned(crd(
5353
group = "listeners.stackable.tech",
5454
status = "v1alpha1::ListenerStatus",
5555
namespaced
@@ -79,7 +79,7 @@ pub mod versioned {
7979
/// This is not expected to be created or modified by users. It will be created by
8080
/// the Stackable Listener Operator when mounting the listener volume, and is always
8181
/// named `pod-{pod.metadata.uid}`.
82-
#[versioned(k8s(
82+
#[versioned(crd(
8383
group = "listeners.stackable.tech",
8484
plural = "podlisteners",
8585
namespaced,
@@ -112,7 +112,7 @@ pub mod versioned {
112112
}
113113

114114
/// Informs users about how to reach the Listener.
115-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq, Eq)]
115+
#[derive(Serialize, Deserialize, Clone, Debug, Default, JsonSchema, PartialEq, Eq)]
116116
#[serde(rename_all = "camelCase")]
117117
pub struct ListenerStatus {
118118
/// The backing Kubernetes Service.

crates/stackable-operator/src/crd/s3/bucket/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@ use crate::{crd::s3::connection::v1alpha1 as conn_v1alpha1, versioned::versioned
66

77
mod v1alpha1_impl;
88

9-
#[versioned(version(name = "v1alpha1"))]
9+
#[versioned(
10+
version(name = "v1alpha1"),
11+
crates(
12+
kube_core = "kube::core",
13+
k8s_openapi = "k8s_openapi",
14+
schemars = "schemars",
15+
)
16+
)]
1017
pub mod versioned {
1118
pub mod v1alpha1 {
1219
pub use v1alpha1_impl::BucketError;
1320
}
1421

1522
/// S3 bucket specification containing the bucket name and an inlined or referenced connection specification.
1623
/// Learn more on the [S3 concept documentation](DOCS_BASE_URL_PLACEHOLDER/concepts/s3).
17-
#[versioned(k8s(
24+
#[versioned(crd(
1825
group = "s3.stackable.tech",
1926
kind = "S3Bucket",
2027
plural = "s3buckets",
21-
crates(
22-
kube_core = "kube::core",
23-
k8s_openapi = "k8s_openapi",
24-
schemars = "schemars",
25-
),
2628
namespaced
2729
))]
2830
#[derive(Clone, CustomResource, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]

crates/stackable-operator/src/crd/s3/connection/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,25 @@ mod v1alpha1_impl;
1616
/// Use this type in you operator!
1717
pub type ResolvedConnection = v1alpha1::ConnectionSpec;
1818

19-
#[versioned(version(name = "v1alpha1"))]
19+
#[versioned(
20+
version(name = "v1alpha1"),
21+
crates(
22+
kube_core = "kube::core",
23+
k8s_openapi = "k8s_openapi",
24+
schemars = "schemars",
25+
)
26+
)]
2027
pub mod versioned {
2128
pub mod v1alpha1 {
2229
pub use v1alpha1_impl::ConnectionError;
2330
}
2431

2532
/// S3 connection definition as a resource.
2633
/// Learn more on the [S3 concept documentation](DOCS_BASE_URL_PLACEHOLDER/concepts/s3).
27-
#[versioned(k8s(
34+
#[versioned(crd(
2835
group = "s3.stackable.tech",
2936
kind = "S3Connection",
3037
plural = "s3connections",
31-
crates(
32-
kube_core = "kube::core",
33-
k8s_openapi = "k8s_openapi",
34-
schemars = "schemars",
35-
),
3638
namespaced
3739
))]
3840
#[derive(CustomResource, Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]

0 commit comments

Comments
 (0)