Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Add root descriptions to all CRDs defined in this crate (`AuthenticationClass`, `Listener`,
`ListenerClass`, `PodListeners`, `S3Bucket`, `S3Connection`, `Scaler`), now that the `versioned`
macro requires a `doc` argument ([#1228]).

[#1228]: https://github.com/stackabletech/operator-rs/pull/1228

## [0.112.0] - 2026-06-22

### Added
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/AuthenticationClass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for AuthenticationClassSpec via `CustomResource`
description: The Stackable Platform uses the AuthenticationClass as a central mechanism to handle user authentication across supported products.
properties:
spec:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/DummyCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for DummyClusterSpec via `CustomResource`
description: A DummyCluster is a test-only resource used by operator-rs to exercise CRD generation. It is not backed by a real operator.
properties:
spec:
properties:
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/Listener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for ListenerSpec via `CustomResource`
description: Exposes a set of pods to the outside world.
Comment thread
lfrancke marked this conversation as resolved.
Outdated
properties:
spec:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/ListenerClass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for ListenerClassSpec via `CustomResource`
description: Defines a policy for how Listeners should be exposed.
properties:
spec:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/PodListeners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for PodListenersSpec via `CustomResource`
description: Informs users about Listeners that are bound by a given Pod.
properties:
spec:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/S3Bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for BucketSpec via `CustomResource`
description: S3 bucket specification containing the bucket name and an inlined or referenced connection specification.
properties:
spec:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/S3Connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for ConnectionSpec via `CustomResource`
description: A reusable definition of a connection to an S3 endpoint.
properties:
spec:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/crds/Scaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for ScalerSpec via `CustomResource`
description: Controls the replica count of a Stackable component, integrating with the Kubernetes scale subresource to enable horizontal autoscaling.
properties:
spec:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub mod versioned {
#[versioned(crd(
group = "authentication.stackable.tech",
plural = "authenticationclasses",
doc = "The Stackable Platform uses the AuthenticationClass as a central mechanism to handle user authentication across supported products.",
))]
#[derive(
Clone,
Expand Down
5 changes: 4 additions & 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,10 @@ 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(crd(group = "listeners.stackable.tech"))]
#[versioned(crd(
group = "listeners.stackable.tech",
doc = "Defines a policy for how Listeners should be exposed.",
))]
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ListenerClassSpec {
Expand Down
2 changes: 2 additions & 0 deletions crates/stackable-operator/src/crd/listener/listeners/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub mod versioned {
#[versioned(crd(
group = "listeners.stackable.tech",
status = "v1alpha1::ListenerStatus",
doc = "Exposes a set of pods to the outside world.",
Comment thread
lfrancke marked this conversation as resolved.
Outdated
namespaced
))]
#[derive(
Expand Down Expand Up @@ -86,6 +87,7 @@ pub mod versioned {
#[versioned(crd(
group = "listeners.stackable.tech",
plural = "podlisteners",
doc = "Informs users about Listeners that are bound by a given Pod.",
namespaced,
))]
#[derive(
Expand Down
1 change: 1 addition & 0 deletions crates/stackable-operator/src/crd/s3/bucket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub mod versioned {
group = "s3.stackable.tech",
kind = "S3Bucket",
plural = "s3buckets",
doc = "S3 bucket specification containing the bucket name and an inlined or referenced connection specification.",
namespaced
))]
#[derive(Clone, CustomResource, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand Down
1 change: 1 addition & 0 deletions crates/stackable-operator/src/crd/s3/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub mod versioned {
group = "s3.stackable.tech",
kind = "S3Connection",
plural = "s3connections",
doc = "A reusable definition of a connection to an S3 endpoint.",
namespaced
))]
#[derive(CustomResource, Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand Down
1 change: 1 addition & 0 deletions crates/stackable-operator/src/crd/scaler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub mod versioned {
status_replicas_path = ".status.replicas",
label_selector_path = ".status.selector"
),
doc = "Controls the replica count of a Stackable component, integrating with the Kubernetes scale subresource to enable horizontal autoscaling.",
namespaced
))]
#[derive(Clone, Debug, PartialEq, Eq, CustomResource, Deserialize, Serialize, JsonSchema)]
Expand Down
5 changes: 4 additions & 1 deletion crates/stackable-versioned-macros/src/attrs/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ pub struct ContainerSkipArguments {
/// - `scale`: Configure the scale subresource for horizontal pod autoscaling integration.
/// - `shortname`: Set a shortname for the CR object. This can be specified multiple
/// times.
/// - `doc`: Set the root description of the generated CRD. This argument is required, so
/// that every CRD has a meaningful description instead of the generic one that kube
/// generates by default.
/// - `skip`: Controls skipping parts of the generation.
#[derive(Clone, Debug, FromMeta)]
pub struct StructCrdArguments {
Expand All @@ -71,7 +74,7 @@ pub struct StructCrdArguments {
pub shortnames: Vec<String>,
// category
// selectable
// doc
pub doc: String,
// annotation
// label
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,14 @@ impl Struct {
.map(|s| quote! { , shortname = #s })
.collect();

let doc = &spec_gen_ctx.kubernetes_arguments.doc;

quote! {
// The end-developer needs to derive CustomResource and JsonSchema.
// This is because we don't know if they want to use a re-exported or renamed import.
#[kube(
// These must be comma separated (except the last) as they always exist:
group = #group, version = #version, kind = #kind
group = #group, version = #version, kind = #kind, doc = #doc
// These fields are optional, and therefore the token stream must prefix each with a comma:
#singular #plural #namespaced #crates #status #scale #shortnames
)]
Expand Down
12 changes: 7 additions & 5 deletions crates/stackable-versioned-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ mod utils;
/// // **Required.** Set the group of the CRD, usually the domain of the
/// // company, like `example.com`.
/// group = "example.com",
/// // **Required.** Set the root description of the generated CRD.
/// doc = "My custom resource.",
/// // Override the kind field of the CRD. This defaults to the struct
/// // name (without the `Spec` suffix). Overriding this value will also
/// // influence the names of other generated items, like the status
Expand Down Expand Up @@ -683,7 +685,7 @@ mod utils;
/// # use serde::{Deserialize, Serialize};
/// #[versioned(version(name = "v1alpha1"), version(name = "v1beta1"))]
/// mod versioned {
/// #[versioned(crd(group = "example.com"))]
/// #[versioned(crd(group = "example.com", doc = "My custom resource."))]
/// #[derive(Clone, Debug, Deserialize, Serialize, CustomResource, JsonSchema)]
/// pub struct FooSpec {
/// #[versioned(added(since = "v1beta1"))]
Expand Down Expand Up @@ -727,7 +729,7 @@ mod utils;
/// mod versioned {
/// #[versioned(skip(merged_crd))] // Skip generation for specific specs
///
/// # #[versioned(crd(group = "example.com"))]
/// # #[versioned(crd(group = "example.com", doc = "My custom resource."))]
/// # #[derive(Clone, Debug, CustomResource, Deserialize, Serialize, JsonSchema)]
/// pub struct FooSpec {}
/// }
Expand All @@ -754,7 +756,7 @@ mod utils;
/// version(name = "v1")
/// )]
/// mod versioned {
/// #[versioned(crd(group = "example.com"))]
/// #[versioned(crd(group = "example.com", doc = "My custom resource."))]
/// #[derive(Clone, Debug, Deserialize, Serialize, CustomResource, JsonSchema)]
/// pub struct FooSpec {
/// #[versioned(added(since = "v1beta1"))]
Expand Down Expand Up @@ -787,7 +789,7 @@ mod utils;
/// mod versioned {
/// #[versioned(skip(try_convert))] // Skip generation for specific specs
///
/// # #[versioned(crd(group = "example.com"))]
/// # #[versioned(crd(group = "example.com", doc = "My custom resource."))]
/// # #[derive(Clone, Debug, CustomResource, Deserialize, Serialize, JsonSchema)]
/// pub struct FooSpec {}
/// }
Expand Down Expand Up @@ -889,7 +891,7 @@ mod utils;
/// options(k8s(experimental_conversion_tracking))
/// )]
/// mod versioned {
/// #[versioned(crd(group = "example.com"))]
/// #[versioned(crd(group = "example.com", doc = "My custom resource."))]
/// #[derive(Clone, Debug, Deserialize, Serialize, CustomResource, JsonSchema)]
/// struct FooSpec {
/// bar: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use stackable_versioned_macros::versioned;
)]
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
mod versioned {
#[versioned(crd(group = "stackable.tech"))]
#[versioned(crd(group = "stackable.tech", doc = "Test"))]
pub struct Foo {
#[versioned(
added(since = "v1beta1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use stackable_versioned::versioned;
pub(crate) mod versioned {
#[versioned(crd(
group = "stackable.tech",
doc = "Test",
singular = "foo",
plural = "foos",
status = FooStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub(crate) mod versioned {
#[versioned(crd(
group = "stackable.tech",
status = FooStatus,
doc = "Test",
))]
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, CustomResource)]
pub(crate) struct FooSpec {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use stackable_versioned::versioned;
)]
// ---
pub mod versioned {
#[versioned(crd(group = "foo.example.org"))]
#[versioned(crd(group = "foo.example.org", doc = "Test"))]
#[derive(
Clone,
Debug,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use stackable_versioned::versioned;
)]
// ---
pub mod versioned {
#[versioned(crd(group = "foo.example.org"))]
#[versioned(crd(group = "foo.example.org", doc = "Test"))]
#[derive(
Clone,
Debug,
Expand Down
21 changes: 21 additions & 0 deletions crates/stackable-versioned-macros/tests/inputs/pass/crd_doc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use stackable_versioned::versioned;
// ---
#[versioned(version(name = "v1alpha1"))]
// ---
pub(crate) mod versioned {
#[versioned(crd(
group = "stackable.tech",
doc = "A FooCluster, deployed and managed by the example operator."
))]
#[derive(
Clone,
Debug,
serde::Deserialize,
serde::Serialize,
schemars::JsonSchema,
kube::CustomResource,
)]
pub(crate) struct FooSpec {}
}
// ---
fn main() {}
4 changes: 2 additions & 2 deletions crates/stackable-versioned-macros/tests/inputs/pass/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub(crate) mod versioned {
boom: Option<u16>,
}

#[versioned(crd(group = "foo.example.org", plural = "foos", namespaced))]
#[versioned(crd(group = "foo.example.org", plural = "foos", doc = "Test", namespaced))]
#[derive(
Clone,
Debug,
Expand All @@ -32,7 +32,7 @@ pub(crate) mod versioned {
deprecated_foo: String,
}

#[versioned(crd(group = "bar.example.org", plural = "bars"))]
#[versioned(crd(group = "bar.example.org", plural = "bars", doc = "Test"))]
#[derive(
Clone,
Debug,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) mod versioned {
boom: Option<u16>,
}

#[versioned(crd(group = "foo.example.org", plural = "foos", namespaced))]
#[versioned(crd(group = "foo.example.org", plural = "foos", doc = "Test", namespaced))]
#[derive(
Clone,
Debug,
Expand All @@ -33,7 +33,7 @@ pub(crate) mod versioned {
deprecated_foo: String,
}

#[versioned(crd(group = "bar.example.org", plural = "bars"))]
#[versioned(crd(group = "bar.example.org", plural = "bars", doc = "Test"))]
#[derive(
Clone,
Debug,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use stackable_versioned::versioned;
)]
// ---
pub mod versioned {
#[versioned(crd(group = "stackable.tech", kind = "FooBar", namespaced))]
#[versioned(crd(group = "stackable.tech", kind = "FooBar", doc = "Test", namespaced))]
#[derive(
Clone,
Debug,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use stackable_versioned::versioned;
pub(crate) mod versioned {
#[versioned(crd(
group = "stackable.tech",
doc = "Test",
scale(
spec_replicas_path = ".spec.replicas",
status_replicas_path = ".status.replicas",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use stackable_versioned::versioned;
#[versioned(version(name = "v1alpha1"))]
// ---
pub(crate) mod versioned {
#[versioned(crd(group = "stackable.tech", shortname = "f", shortname = "fo"))]
#[versioned(crd(group = "stackable.tech", shortname = "f", shortname = "fo", doc = "Test"))]
#[derive(
Clone,
Debug,
Expand Down

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

Loading
Loading