@@ -20,7 +20,8 @@ use snafu::{OptionExt, ResultExt, Snafu};
20
20
use tracing:: trace;
21
21
22
22
use crate :: {
23
- cli:: ProductOperatorRun , kvp:: LabelSelectorExt , utils:: cluster_info:: KubernetesClusterInfo ,
23
+ commons:: networking:: DomainName , kvp:: LabelSelectorExt ,
24
+ utils:: cluster_info:: KubernetesClusterInfo ,
24
25
} ;
25
26
26
27
pub type Result < T , E = Error > = std:: result:: Result < T , E > ;
@@ -517,18 +518,15 @@ impl Client {
517
518
///
518
519
/// ```no_run
519
520
/// use std::time::Duration;
520
- /// use clap::Parser;
521
521
/// use tokio::time::error::Elapsed;
522
522
/// use kube::runtime::watcher;
523
523
/// use k8s_openapi::api::core::v1::Pod;
524
- /// use stackable_operator::{cli::ProductOperatorRun, client::{Client, initialize_operator} };
524
+ /// use stackable_operator::client::{Client, initialize_operator};
525
525
///
526
526
/// #[tokio::main]
527
527
/// async fn main(){
528
528
///
529
- /// // Parse CLI arguments with Opts::parse() instead
530
- /// let cli_opts = ProductOperatorRun::parse_from(["run"]);
531
- /// let client: Client = initialize_operator(&cli_opts, None).await.expect("Unable to construct client.");
529
+ /// let client: Client = initialize_operator(&None, None).await.expect("Unable to construct client.");
532
530
/// let watcher_config: watcher::Config =
533
531
/// watcher::Config::default().fields(&format!("metadata.name=nonexistent-pod"));
534
532
///
@@ -636,7 +634,7 @@ where
636
634
}
637
635
638
636
pub async fn initialize_operator (
639
- cli_opts : & ProductOperatorRun ,
637
+ cli_kubernetes_cluster_domain : & Option < DomainName > ,
640
638
field_manager : Option < String > ,
641
639
) -> Result < Client > {
642
640
let kubeconfig: Config = kube:: Config :: infer ( )
@@ -645,7 +643,7 @@ pub async fn initialize_operator(
645
643
. context ( InferKubeConfigSnafu ) ?;
646
644
let default_namespace = kubeconfig. default_namespace . clone ( ) ;
647
645
let client = kube:: Client :: try_from ( kubeconfig) . context ( CreateKubeClientSnafu ) ?;
648
- let cluster_info = KubernetesClusterInfo :: new ( cli_opts ) ;
646
+ let cluster_info = KubernetesClusterInfo :: new ( cli_kubernetes_cluster_domain ) ;
649
647
650
648
Ok ( Client :: new (
651
649
client,
@@ -659,7 +657,6 @@ pub async fn initialize_operator(
659
657
mod tests {
660
658
use std:: { collections:: BTreeMap , time:: Duration } ;
661
659
662
- use clap:: Parser ;
663
660
use futures:: StreamExt ;
664
661
use k8s_openapi:: {
665
662
api:: core:: v1:: { Container , Pod , PodSpec } ,
@@ -671,13 +668,10 @@ mod tests {
671
668
} ;
672
669
use tokio:: time:: error:: Elapsed ;
673
670
674
- use crate :: cli:: ProductOperatorRun ;
675
-
676
671
#[ tokio:: test]
677
672
#[ ignore = "Tests depending on Kubernetes are not ran by default" ]
678
673
async fn k8s_test_wait_created ( ) {
679
- let cli_opts = ProductOperatorRun :: parse_from ( [ "run" ] ) ;
680
- let client = super :: initialize_operator ( & cli_opts, None )
674
+ let client = super :: initialize_operator ( & None , None )
681
675
. await
682
676
. expect ( "KUBECONFIG variable must be configured." ) ;
683
677
@@ -755,8 +749,7 @@ mod tests {
755
749
#[ tokio:: test]
756
750
#[ ignore = "Tests depending on Kubernetes are not ran by default" ]
757
751
async fn k8s_test_wait_created_timeout ( ) {
758
- let cli_opts = ProductOperatorRun :: parse_from ( [ "run" ] ) ;
759
- let client = super :: initialize_operator ( & cli_opts, None )
752
+ let client = super :: initialize_operator ( & None , None )
760
753
. await
761
754
. expect ( "KUBECONFIG variable must be configured." ) ;
762
755
@@ -776,8 +769,7 @@ mod tests {
776
769
#[ tokio:: test]
777
770
#[ ignore = "Tests depending on Kubernetes are not ran by default" ]
778
771
async fn k8s_test_list_with_label_selector ( ) {
779
- let cli_opts = ProductOperatorRun :: parse_from ( [ "run" ] ) ;
780
- let client = super :: initialize_operator ( & cli_opts, None )
772
+ let client = super :: initialize_operator ( & None , None )
781
773
. await
782
774
. expect ( "KUBECONFIG variable must be configured." ) ;
783
775
0 commit comments