Skip to content

Commit a6e1273

Browse files
committed
chore(crd-preview): Fix macro, add re-exports
1 parent 51162b9 commit a6e1273

File tree

7 files changed

+39
-22
lines changed

7 files changed

+39
-22
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ opentelemetry-appender-tracing = "0.29.1"
4242
opentelemetry-otlp = "0.29.0"
4343
# opentelemetry-semantic-conventions = "0.28.0"
4444
p256 = { version = "0.13.2", features = ["ecdsa"] }
45+
paste = "1.0.15"
4546
pin-project = "1.1.5"
4647
prettyplease = "0.2.22"
4748
proc-macro2 = "1.0.86"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ mod class;
1313
mod core;
1414
mod listeners;
1515

16-
pub use class::ListenerClass;
17-
pub use listeners::{Listener, PodListeners};
16+
pub use class::{ListenerClass, ListenerClassVersion};
17+
pub use listeners::{Listener, ListenerVersion, PodListeners, PodListenersVersion};
1818

1919
// Group all v1alpha1 items in one module.
2020
pub mod v1alpha1 {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
mod bucket;
22
mod connection;
33

4-
pub use bucket::S3Bucket;
5-
pub use connection::S3Connection;
4+
pub use bucket::{S3Bucket, S3BucketVersion};
5+
pub use connection::{S3Connection, S3ConnectionVersion};
66

77
// Group all v1alpha1 items in one module.
88
pub mod v1alpha1 {

crates/xtask/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ publish = false
77
stackable-operator = { path = "../stackable-operator" }
88

99
clap.workspace = true
10+
paste.workspace = true
1011
serde.workspace = true
1112
serde_json.workspace = true
1213
snafu.workspace = true

crates/xtask/src/crd/dummy.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ pub mod versioned {
1818
namespaced,
1919
crates(
2020
kube_core = "stackable_operator::kube::core",
21+
kube_client = "stackable_operator::kube::client",
2122
k8s_openapi = "stackable_operator::k8s_openapi",
22-
schemars = "stackable_operator::schemars"
23+
schemars = "stackable_operator::schemars",
24+
versioned = "stackable_operator::versioned"
2325
)
2426
))]
2527
#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]

crates/xtask/src/crd/mod.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
use std::path::PathBuf;
22

3+
use paste::paste;
34
use snafu::{OptionExt, ResultExt, Snafu};
45
use stackable_operator::{
56
crd::{
6-
authentication::core::AuthenticationClass,
7-
listener::{Listener, ListenerClass, PodListeners},
8-
s3::{S3Bucket, S3Connection},
7+
authentication::core::{AuthenticationClass, AuthenticationClassVersion},
8+
listener::{
9+
Listener, ListenerClass, ListenerClassVersion, ListenerVersion, PodListeners,
10+
PodListenersVersion,
11+
},
12+
s3::{S3Bucket, S3BucketVersion, S3Connection, S3ConnectionVersion},
913
},
1014
kube::core::crd::MergeError,
1115
};
1216

13-
use crate::crd::dummy::DummyCluster;
17+
use crate::crd::dummy::{DummyCluster, DummyClusterVersion};
1418

1519
mod dummy;
1620

@@ -37,21 +41,23 @@ pub enum Error {
3741

3842
macro_rules! write_crd {
3943
($base_path:expr, $crd_name:ident, $stored_crd_version:ident) => {
40-
let merged = $crd_name::merged_crd($crd_name::$stored_crd_version)
41-
.context(MergeCrdSnafu { crd_name: stringify!($crd_name) })?;
44+
paste! {
45+
let merged = $crd_name::merged_crd([<$crd_name Version>]::$stored_crd_version)
46+
.context(MergeCrdSnafu { crd_name: stringify!($crd_name) })?;
4247

43-
let mut path = $base_path.join(stringify!($crd_name));
44-
path.set_extension("yaml");
48+
let mut path = $base_path.join(stringify!($crd_name));
49+
path.set_extension("yaml");
4550

46-
<stackable_operator::k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition
47-
as stackable_operator::YamlSchema>
48-
::write_yaml_schema(
49-
&merged,
50-
&path,
51-
"0.0.0-dev",
52-
stackable_operator::shared::yaml::SerializeOptions::default(),
53-
)
54-
.with_context(|_| WriteCrdSnafu { path: path.clone() })?;
51+
<stackable_operator::k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition
52+
as stackable_operator::YamlSchema>
53+
::write_yaml_schema(
54+
&merged,
55+
&path,
56+
"0.0.0-dev",
57+
stackable_operator::shared::yaml::SerializeOptions::default(),
58+
)
59+
.with_context(|_| WriteCrdSnafu { path: path.clone() })?;
60+
}
5561
};
5662
}
5763

0 commit comments

Comments
 (0)