Skip to content

feat(stackable-versioned): Add conversion tracking #1056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0d78554
chore: Add edition to rustfmt override command
Techassi Jun 13, 2025
c3d48ae
fix(stackable-versioned): Finish error accumulator
Techassi Jun 17, 2025
0f1e0a5
refactor(stackable-versioned): Simplify and improve From code generation
Techassi Jun 17, 2025
a86bf17
refactor(stackable-versioned): Remove standalone and non-K8s specific…
Techassi Jun 26, 2025
9583068
chore: Adjust CRD code to reflect attribute changes
Techassi Jun 26, 2025
4009271
feat!(stackable-versioned): Add conversion tracking
Techassi Jun 26, 2025
19017f2
fix(stackable-versioned): Fix edge-cases uncovered by UI tests
Techassi Jul 4, 2025
26e5565
test(stackable-versioned): Adjust test inputs and UI stderr snapshots
Techassi Jul 4, 2025
e8c0d93
fix(stackable-versioned): Use trait from core, use correct boolean expr
Techassi Jul 4, 2025
36ecc20
fix(stackable-versioned): Remove minor errors in generated code
Techassi Jul 4, 2025
88d9050
test(stackable-version): Review and accept updated snapshots
Techassi Jul 4, 2025
7bfc2bb
test(stackable-versioned): Adjust existing integration tests
Techassi Jul 4, 2025
502e55d
test(stackable-versioned): Add conversion roundtrip integration test
Techassi Jul 4, 2025
0f8ed66
chore(stackable-versioned): Add FIXME comments
Techassi Jul 4, 2025
277c2b1
chore(stackable-operator): Add required Default derive to ListenerStatus
Techassi Jul 4, 2025
045e980
chore(stackable-versioned): Remove unused k8s-version dependency
Techassi Jul 4, 2025
dc46e64
fix(stackable-versioned): Add missing trailing comma in generated code
Techassi Jul 8, 2025
968a52c
test(stackable-versioned): Add additional status field
Techassi Jul 8, 2025
a0e1fcd
fix(stackable-versioned): Only emit tracking_into if opted in
Techassi Jul 8, 2025
13625c9
docs(stackable-versioned): Update doc comments
Techassi Jul 8, 2025
8f26e01
chore(stackable-versioned): Ignore code block in doc comment
Techassi Jul 8, 2025
20427af
feat(stackable-versioned): Use proper JSONPath syntax
Techassi Jul 8, 2025
790bfb5
chore(stackable-versioned): Use BTreeMap instead of HashMap
Techassi Jul 8, 2025
db85e29
chore(stackable-versioned): Use jsonPath instead of fieldName as fiel…
Techassi Jul 8, 2025
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 .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"rust-analyzer.rustfmt.overrideCommand": [
"rustfmt",
"+nightly-2025-05-26",
"--edition",
"2024",
"--"
]
}
1 change: 0 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/stackable-operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ versioned = []

[dependencies]
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] }
stackable-versioned = { path = "../stackable-versioned", features = ["k8s"] }
stackable-operator-derive = { path = "../stackable-operator-derive" }
stackable-versioned = { path = "../stackable-versioned" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Ideally we sort them alphabetical

stackable-shared = { path = "../stackable-shared" }

chrono.workspace = true
Expand Down
16 changes: 9 additions & 7 deletions crates/stackable-operator/src/crd/authentication/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ use crate::versioned::versioned;

mod v1alpha1_impl;

#[versioned(version(name = "v1alpha1"))]
#[versioned(
version(name = "v1alpha1"),
crates(
kube_core = "kube::core",
k8s_openapi = "k8s_openapi",
schemars = "schemars",
)
)]
pub mod versioned {
pub mod v1alpha1 {
// Re-export the v1alpha1-specific error type from the private impl module.
Expand All @@ -26,14 +33,9 @@ pub mod versioned {
///
/// [1]: DOCS_BASE_URL_PLACEHOLDER/concepts/authentication
/// [2]: DOCS_BASE_URL_PLACEHOLDER/tutorials/authentication_with_openldap
#[versioned(k8s(
#[versioned(crd(
group = "authentication.stackable.tech",
plural = "authenticationclasses",
crates(
kube_core = "kube::core",
k8s_openapi = "k8s_openapi",
schemars = "schemars",
)
))]
#[derive(
Clone,
Expand Down
16 changes: 9 additions & 7 deletions crates/stackable-operator/src/crd/authentication/kerberos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ use serde::{Deserialize, Serialize};
use stackable_versioned::versioned;

#[versioned(version(name = "v1alpha1"))]
#[derive(
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
)]
#[serde(rename_all = "camelCase")]
pub struct AuthenticationProvider {
/// Mandatory SecretClass used to obtain keytabs.
pub kerberos_secret_class: String,
pub mod versioned {
#[derive(
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
)]
#[serde(rename_all = "camelCase")]
pub struct AuthenticationProvider {
/// Mandatory SecretClass used to obtain keytabs.
pub kerberos_secret_class: String,
}
}
22 changes: 12 additions & 10 deletions crates/stackable-operator/src/crd/authentication/tls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ use serde::{Deserialize, Serialize};
use stackable_versioned::versioned;

#[versioned(version(name = "v1alpha1"))]
#[derive(
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
)]
#[serde(rename_all = "camelCase")]
pub struct AuthenticationProvider {
/// See [ADR017: TLS authentication](DOCS_BASE_URL_PLACEHOLDER/contributor/adr/adr017-tls_authentication).
/// If `client_cert_secret_class` is not set, the TLS settings may also be used for client authentication.
/// If `client_cert_secret_class` is set, the [SecretClass](DOCS_BASE_URL_PLACEHOLDER/secret-operator/secretclass)
/// will be used to provision client certificates.
pub client_cert_secret_class: Option<String>,
pub mod versioned {
#[derive(
Clone, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize,
)]
#[serde(rename_all = "camelCase")]
pub struct AuthenticationProvider {
/// See [ADR017: TLS authentication](DOCS_BASE_URL_PLACEHOLDER/contributor/adr/adr017-tls_authentication).
/// If `client_cert_secret_class` is not set, the TLS settings may also be used for client authentication.
/// If `client_cert_secret_class` is set, the [SecretClass](DOCS_BASE_URL_PLACEHOLDER/secret-operator/secretclass)
/// will be used to provision client certificates.
pub client_cert_secret_class: Option<String>,
}
}
2 changes: 1 addition & 1 deletion crates/stackable-operator/src/crd/listener/class/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub mod versioned {
/// Defines a policy for how [Listeners](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listener) should be exposed.
/// Read the [ListenerClass documentation](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass)
/// for more information.
#[versioned(k8s(group = "listeners.stackable.tech"))]
#[versioned(crd(group = "listeners.stackable.tech"))]
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ListenerClassSpec {
Expand Down
6 changes: 3 additions & 3 deletions crates/stackable-operator/src/crd/listener/listeners/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub mod versioned {
/// ["sticky" scheduling](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listener#_sticky_scheduling).
///
/// Learn more in the [Listener documentation](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listener).
#[versioned(k8s(
#[versioned(crd(
group = "listeners.stackable.tech",
status = "v1alpha1::ListenerStatus",
namespaced
Expand Down Expand Up @@ -79,7 +79,7 @@ pub mod versioned {
/// This is not expected to be created or modified by users. It will be created by
/// the Stackable Listener Operator when mounting the listener volume, and is always
/// named `pod-{pod.metadata.uid}`.
#[versioned(k8s(
#[versioned(crd(
group = "listeners.stackable.tech",
plural = "podlisteners",
namespaced,
Expand Down Expand Up @@ -112,7 +112,7 @@ pub mod versioned {
}

/// Informs users about how to reach the Listener.
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq, Eq)]
#[derive(Serialize, Deserialize, Clone, Debug, Default, JsonSchema, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ListenerStatus {
/// The backing Kubernetes Service.
Expand Down
16 changes: 9 additions & 7 deletions crates/stackable-operator/src/crd/s3/bucket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@ use crate::{crd::s3::connection::v1alpha1 as conn_v1alpha1, versioned::versioned

mod v1alpha1_impl;

#[versioned(version(name = "v1alpha1"))]
#[versioned(
version(name = "v1alpha1"),
crates(
kube_core = "kube::core",
k8s_openapi = "k8s_openapi",
schemars = "schemars",
)
)]
pub mod versioned {
pub mod v1alpha1 {
pub use v1alpha1_impl::BucketError;
}

/// S3 bucket specification containing the bucket name and an inlined or referenced connection specification.
/// Learn more on the [S3 concept documentation](DOCS_BASE_URL_PLACEHOLDER/concepts/s3).
#[versioned(k8s(
#[versioned(crd(
group = "s3.stackable.tech",
kind = "S3Bucket",
plural = "s3buckets",
crates(
kube_core = "kube::core",
k8s_openapi = "k8s_openapi",
schemars = "schemars",
),
namespaced
))]
#[derive(Clone, CustomResource, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand Down
16 changes: 9 additions & 7 deletions crates/stackable-operator/src/crd/s3/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@ mod v1alpha1_impl;
/// Use this type in you operator!
pub type ResolvedConnection = v1alpha1::ConnectionSpec;

#[versioned(version(name = "v1alpha1"))]
#[versioned(
version(name = "v1alpha1"),
crates(
kube_core = "kube::core",
k8s_openapi = "k8s_openapi",
schemars = "schemars",
)
)]
pub mod versioned {
pub mod v1alpha1 {
pub use v1alpha1_impl::ConnectionError;
}

/// S3 connection definition as a resource.
/// Learn more on the [S3 concept documentation](DOCS_BASE_URL_PLACEHOLDER/concepts/s3).
#[versioned(k8s(
#[versioned(crd(
group = "s3.stackable.tech",
kind = "S3Connection",
plural = "s3connections",
crates(
kube_core = "kube::core",
k8s_openapi = "k8s_openapi",
schemars = "schemars",
),
namespaced
))]
#[derive(CustomResource, Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand Down
10 changes: 3 additions & 7 deletions crates/stackable-versioned-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,22 @@ normal = ["k8s-openapi", "kube"]
[lib]
proc-macro = true

[features]
full = ["k8s"]
k8s = ["dep:kube", "dep:k8s-openapi"]

[dependencies]
k8s-version = { path = "../k8s-version", features = ["darling"] }

convert_case.workspace = true
darling.workspace = true
indoc.workspace = true
itertools.workspace = true
k8s-openapi = { workspace = true, optional = true }
kube = { workspace = true, optional = true }
k8s-openapi.workspace = true
kube.workspace = true
proc-macro2.workspace = true
syn.workspace = true
quote.workspace = true

[dev-dependencies]
# Only needed for doc tests / examples
stackable-versioned = { path = "../stackable-versioned", features = ["k8s"] }
stackable-versioned = { path = "../stackable-versioned" }

insta.workspace = true
prettyplease.workspace = true
Expand Down
127 changes: 0 additions & 127 deletions crates/stackable-versioned-macros/src/attrs/common.rs

This file was deleted.

Loading