Skip to content

Commit bbf49f5

Browse files
committed
docs(operator): Add example in doc comment
1 parent 106dd16 commit bbf49f5

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

crates/stackable-operator/src/crd/maintainer.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,45 @@ impl CustomResourceDefinitionMaintainer {
7474
/// - The [`oneshot::Receiver`] which will be used to send out a message once the initial
7575
/// CRD reconciliation ran. This signal can be used to trigger the deployment of custom
7676
/// resources defined by the maintained CRDs.
77+
///
78+
/// ## Example
79+
///
80+
/// ```no_run
81+
/// # use stackable_operator::crd::s3::{S3Connection, S3ConnectionVersion, S3Bucket, S3BucketVersion};
82+
/// # use stackable_webhook::x509_cert::Certificate;
83+
/// # use tokio::sync::mpsc::channel;
84+
/// # use kube::Client;
85+
/// use stackable_operator::crd::maintainer::{
86+
/// CustomResourceDefinitionMaintainerOptions,
87+
/// CustomResourceDefinitionMaintainer,
88+
/// };
89+
///
90+
/// # #[tokio::main]
91+
/// # async fn main() {
92+
/// # let (certificate_tx, certificate_rx) = channel(1);
93+
/// let options = CustomResourceDefinitionMaintainerOptions {
94+
/// operator_service_name: "my-service-name".to_owned(),
95+
/// operator_namespace: "my-namespace".to_owned(),
96+
/// field_manager: "my-operator".to_owned(),
97+
/// webhook_https_port: 8443,
98+
/// disabled: true,
99+
/// };
100+
///
101+
/// let client = Client::try_default().await.unwrap();
102+
///
103+
/// let definitions = vec![
104+
/// S3Connection::merged_crd(S3ConnectionVersion::V1Alpha1).unwrap(),
105+
/// S3Bucket::merged_crd(S3BucketVersion::V1Alpha1).unwrap(),
106+
/// ];
107+
///
108+
/// let (maintainer, initial_reconcile_rx) = CustomResourceDefinitionMaintainer::new(
109+
/// client,
110+
/// certificate_rx,
111+
/// definitions,
112+
/// options,
113+
/// );
114+
/// # }
115+
/// ```
77116
pub fn new(
78117
client: Client,
79118
certificate_rx: mpsc::Receiver<Certificate>,

0 commit comments

Comments
 (0)