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 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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",
"--"
]
}
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" }
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
4 changes: 2 additions & 2 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
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
Loading