1
1
use std:: collections:: BTreeMap ;
2
2
3
3
use product_config:: writer:: to_hadoop_xml;
4
+ use snafu:: { ResultExt , Snafu } ;
4
5
use stackable_hbase_crd:: { HbaseCluster , HbaseRole , HBASE_SITE_XML } ;
5
6
use stackable_operator:: {
6
- builder:: { ConfigMapBuilder , ObjectMetaBuilder } ,
7
+ builder:: { ConfigMapBuilder , ObjectMetaBuilder , ObjectMetaBuilderError } ,
7
8
commons:: product_image_selection:: ResolvedProductImage ,
8
- error:: OperatorResult ,
9
9
k8s_openapi:: api:: core:: v1:: ConfigMap ,
10
10
} ;
11
11
12
12
use crate :: {
13
13
hbase_controller:: build_recommended_labels, zookeeper:: ZookeeperConnectionInformation ,
14
14
} ;
15
15
16
+ type Result < T , E = Error > = std:: result:: Result < T , E > ;
17
+
18
+ #[ derive( Snafu , Debug ) ]
19
+ pub enum Error {
20
+ #[ snafu( display( "failed to build ConfigMap" ) ) ]
21
+ BuildConfigMap {
22
+ source : stackable_operator:: error:: Error ,
23
+ } ,
24
+
25
+ #[ snafu( display( "failed to build object meta data" ) ) ]
26
+ ObjectMeta { source : ObjectMetaBuilderError } ,
27
+ }
28
+
16
29
/// Creates a discovery config map containing the `hbase-site.xml` for clients.
17
30
pub fn build_discovery_configmap (
18
31
hbase : & HbaseCluster ,
19
32
zookeeper_connection_information : & ZookeeperConnectionInformation ,
20
33
resolved_product_image : & ResolvedProductImage ,
21
- ) -> OperatorResult < ConfigMap > {
34
+ ) -> Result < ConfigMap > {
22
35
let hbase_site = zookeeper_connection_information. as_hbase_settings ( ) ;
23
36
24
37
ConfigMapBuilder :: new ( )
@@ -32,6 +45,7 @@ pub fn build_discovery_configmap(
32
45
& HbaseRole :: RegionServer . to_string ( ) ,
33
46
"discovery" ,
34
47
) )
48
+ . context ( ObjectMetaSnafu ) ?
35
49
. build ( ) ,
36
50
)
37
51
. add_data (
@@ -45,4 +59,5 @@ pub fn build_discovery_configmap(
45
59
) ,
46
60
)
47
61
. build ( )
62
+ . context ( BuildConfigMapSnafu )
48
63
}
0 commit comments