@@ -95,11 +95,12 @@ impl ConversionWebhookServer {
9595 /// # Example
9696 ///
9797 /// ```no_run
98+ /// use clap::Parser;
9899 /// use stackable_webhook::{
99100 /// servers::{ConversionReview, ConversionWebhookServer},
100101 /// Options
101102 /// };
102- /// use stackable_operator::cli::OperatorEnvironmentOpts ;
103+ /// use stackable_operator::cli::OperatorEnvironmentOptions ;
103104 /// use stackable_operator::kube::Client;
104105 /// use stackable_operator::crd::s3::{S3Connection, S3ConnectionVersion};
105106 ///
@@ -114,12 +115,7 @@ impl ConversionWebhookServer {
114115 ///
115116 /// const OPERATOR_NAME: &str = "PRODUCT_OPERATOR";
116117 /// let client = Client::try_default().await.expect("failed to create Kubernetes client");
117- /// // Normally you would get this from the CLI arguments in
118- /// // `ProductOperatorRun::operator_environment`
119- /// let operator_environment = OperatorEnvironmentOpts {
120- /// operator_namespace: "stackable-operator".to_string(),
121- /// operator_service_name: "product-operator".to_string(),
122- /// };
118+ /// let operator_environment = OperatorEnvironmentOptions::parse();
123119 ///
124120 /// // Construct the conversion webhook server
125121 /// let conversion_webhook = ConversionWebhookServer::new(
@@ -141,7 +137,7 @@ impl ConversionWebhookServer {
141137 ) ]
142138 pub async fn new < H > (
143139 crds_and_handlers : impl IntoIterator < Item = ( CustomResourceDefinition , H ) > ,
144- options : Options ,
140+ mut options : Options ,
145141 client : Client ,
146142 field_manager : impl Into < String > + Debug ,
147143 operator_environment : OperatorEnvironmentOptions ,
@@ -167,13 +163,14 @@ impl ConversionWebhookServer {
167163
168164 // This is how Kubernetes calls us, so it decides about the naming.
169165 // AFAIK we can not influence this, so this is the only SAN entry needed.
170- let sans = vec ! [ format!(
166+ let subject_alterative_dns_name = format ! (
171167 "{service_name}.{operator_namespace}.svc" ,
172168 service_name = operator_environment. operator_service_name,
173169 operator_namespace = operator_environment. operator_namespace,
174- ) ] ;
170+ ) ;
171+ options. subject_alterative_dns_names . push ( subject_alterative_dns_name) ;
175172
176- let ( server, mut cert_rx) = WebhookServer :: new ( router, options, sans )
173+ let ( server, mut cert_rx) = WebhookServer :: new ( router, options)
177174 . await
178175 . context ( CreateWebhookServerSnafu ) ?;
179176
0 commit comments