Skip to content

Commit 3790332

Browse files
feat(stackable-versioned)!: Pass through arguments to the kube attribute (#914)
* feat(stackable-versioned): Add status field to pass through to `#[kube]` * feat(stackable-versioned): Add shortname field to pass through to `#[kube]` * feat(stackable-versioned): Add crates field to pass through to `#[kube]` * refactor(stackable-versioned): Remove CustomResource derive and rename function/variable * docs(stackable-versioned): Update macro docs * chore(stackable-versioned): Allow overriding the k8s_openapi crate * chore(stackable-versioned): Allow overriding the kube::core usages * chore(stackable-versioned): Update changelog * test(stackable-versioned): Add CustomResource derive to test inputs * chore(stackable-versioned): Fix broken comment * chore(stackable-versioned): Rename misleading variables --------- Co-authored-by: Techassi <git@techassi.dev>
1 parent af57d34 commit 3790332

13 files changed

+370
-71
lines changed

crates/stackable-versioned-macros/fixtures/inputs/k8s/basic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
)
1111
)]
1212
// ---
13-
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, schemars::JsonSchema)]
13+
#[derive(
14+
Clone, Debug, serde::Deserialize, serde::Serialize, schemars::JsonSchema, kube::CustomResource,
15+
)]
1416
pub struct FooSpec {
1517
#[versioned(
1618
added(since = "v1beta1"),

crates/stackable-versioned-macros/fixtures/inputs/k8s/module.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ pub(crate) mod versioned {
1212
}
1313

1414
#[versioned(k8s(group = "foo.example.org", plural = "foos", namespaced))]
15+
#[derive(
16+
Clone,
17+
Debug,
18+
serde::Deserialize,
19+
serde::Serialize,
20+
schemars::JsonSchema,
21+
kube::CustomResource,
22+
)]
1523
pub struct FooSpec {
1624
bar: usize,
1725

@@ -23,6 +31,14 @@ pub(crate) mod versioned {
2331
}
2432

2533
#[versioned(k8s(group = "bar.example.org", plural = "bars"))]
34+
#[derive(
35+
Clone,
36+
Debug,
37+
serde::Deserialize,
38+
serde::Serialize,
39+
schemars::JsonSchema,
40+
kube::CustomResource,
41+
)]
2642
pub struct BarSpec {
2743
baz: String,
2844
}

crates/stackable-versioned-macros/fixtures/inputs/k8s/module_preserve.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ pub(crate) mod versioned {
1313
}
1414

1515
#[versioned(k8s(group = "foo.example.org", plural = "foos", namespaced))]
16+
#[derive(
17+
Clone,
18+
Debug,
19+
serde::Deserialize,
20+
serde::Serialize,
21+
schemars::JsonSchema,
22+
kube::CustomResource,
23+
)]
1624
pub struct FooSpec {
1725
bar: usize,
1826

@@ -24,6 +32,14 @@ pub(crate) mod versioned {
2432
}
2533

2634
#[versioned(k8s(group = "bar.example.org", plural = "bars"))]
35+
#[derive(
36+
Clone,
37+
Debug,
38+
serde::Deserialize,
39+
serde::Serialize,
40+
schemars::JsonSchema,
41+
kube::CustomResource,
42+
)]
2743
pub struct BarSpec {
2844
baz: String,
2945
}

crates/stackable-versioned-macros/fixtures/inputs/k8s/skip.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
)
1212
)]
1313
// ---
14-
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, schemars::JsonSchema)]
14+
#[derive(
15+
Clone, Debug, serde::Deserialize, serde::Serialize, schemars::JsonSchema, kube::CustomResource,
16+
)]
1517
pub struct FooSpec {
1618
#[versioned(
1719
added(since = "v1beta1"),

crates/stackable-versioned-macros/fixtures/snapshots/stackable_versioned_macros__test__k8s_snapshots@basic.rs.snap

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

crates/stackable-versioned-macros/fixtures/snapshots/stackable_versioned_macros__test__k8s_snapshots@module.rs.snap

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

crates/stackable-versioned-macros/fixtures/snapshots/stackable_versioned_macros__test__k8s_snapshots@module_preserve.rs.snap

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

crates/stackable-versioned-macros/fixtures/snapshots/stackable_versioned_macros__test__k8s_snapshots@skip.rs.snap

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

0 commit comments

Comments
 (0)