@@ -3,7 +3,7 @@ use super::Error;
33use super :: client:: SyncK8sClient ;
44use super :: labels:: Labels ;
55use crate :: agent_control:: agent_id:: AgentID ;
6- use crate :: agent_control:: defaults:: { CM_NAME_LOCAL_DATA_PREFIX , CM_NAME_OPAMP_DATA_PREFIX } ;
6+ use crate :: agent_control:: defaults:: { cm_name_local_data_prefix , cm_name_opamp_data_prefix } ;
77use std:: sync:: { Arc , RwLock } ;
88
99/// The key used to identify the data in the Store.
@@ -33,7 +33,7 @@ impl K8sStore {
3333 where
3434 T : serde:: de:: DeserializeOwned ,
3535 {
36- self . get ( agent_id, & CM_NAME_OPAMP_DATA_PREFIX , key)
36+ self . get ( agent_id, cm_name_opamp_data_prefix ( ) , key)
3737 }
3838
3939 /// get_local_data is used to get data from CMs storing local configurations. I.e. all the CMs
@@ -42,7 +42,7 @@ impl K8sStore {
4242 where
4343 T : serde:: de:: DeserializeOwned ,
4444 {
45- self . get ( agent_id, & CM_NAME_LOCAL_DATA_PREFIX , key)
45+ self . get ( agent_id, cm_name_local_data_prefix ( ) , key)
4646 }
4747
4848 /// Retrieves data from an Agent store.
@@ -80,7 +80,7 @@ impl K8sStore {
8080 let _write_guard = self . rw_lock . write ( ) . unwrap ( ) ;
8181
8282 let data_as_string = serde_yaml:: to_string ( data) ?;
83- let configmap_name = K8sStore :: build_cm_name ( agent_id, & CM_NAME_OPAMP_DATA_PREFIX ) ;
83+ let configmap_name = K8sStore :: build_cm_name ( agent_id, cm_name_opamp_data_prefix ( ) ) ;
8484 self . k8s_client . set_configmap_key (
8585 & configmap_name,
8686 self . namespace . as_str ( ) ,
@@ -95,7 +95,7 @@ impl K8sStore {
9595 #[ allow( clippy:: readonly_write_lock) ]
9696 let _write_guard = self . rw_lock . write ( ) . unwrap ( ) ;
9797
98- let configmap_name = K8sStore :: build_cm_name ( agent_id, & CM_NAME_OPAMP_DATA_PREFIX ) ;
98+ let configmap_name = K8sStore :: build_cm_name ( agent_id, cm_name_opamp_data_prefix ( ) ) ;
9999 self . k8s_client
100100 . delete_configmap_key ( & configmap_name, self . namespace . as_str ( ) , key)
101101 }
@@ -107,9 +107,9 @@ impl K8sStore {
107107
108108#[ cfg( test) ]
109109pub mod tests {
110- use super :: { CM_NAME_LOCAL_DATA_PREFIX , CM_NAME_OPAMP_DATA_PREFIX } ;
111110 use super :: { K8sStore , StoreKey } ;
112111 use crate :: agent_control:: agent_id:: AgentID ;
112+ use crate :: agent_control:: defaults:: { cm_name_local_data_prefix, cm_name_opamp_data_prefix} ;
113113 use crate :: k8s:: client:: MockSyncK8sClient ;
114114 use crate :: k8s:: error:: K8sError ;
115115 use crate :: k8s:: labels:: Labels ;
@@ -141,7 +141,7 @@ pub mod tests {
141141 . with (
142142 predicate:: eq ( K8sStore :: build_cm_name (
143143 & agent_id,
144- & CM_NAME_OPAMP_DATA_PREFIX ,
144+ cm_name_opamp_data_prefix ( ) ,
145145 ) ) ,
146146 predicate:: eq ( TEST_NAMESPACE ) ,
147147 predicate:: eq ( Labels :: new ( & AgentID :: try_from ( AGENT_NAME ) . unwrap ( ) ) . get ( ) ) ,
@@ -155,7 +155,7 @@ pub mod tests {
155155 . with (
156156 predicate:: eq ( K8sStore :: build_cm_name (
157157 & agent_id,
158- & CM_NAME_OPAMP_DATA_PREFIX ,
158+ cm_name_opamp_data_prefix ( ) ,
159159 ) ) ,
160160 predicate:: eq ( TEST_NAMESPACE ) ,
161161 predicate:: eq ( STORE_KEY_TEST ) ,
@@ -186,7 +186,7 @@ pub mod tests {
186186 . with (
187187 predicate:: eq ( K8sStore :: build_cm_name (
188188 agent_id,
189- & CM_NAME_OPAMP_DATA_PREFIX ,
189+ cm_name_opamp_data_prefix ( ) ,
190190 ) ) ,
191191 predicate:: eq ( TEST_NAMESPACE ) ,
192192 predicate:: eq ( STORE_KEY_TEST ) ,
@@ -203,7 +203,7 @@ pub mod tests {
203203 . with (
204204 predicate:: eq ( K8sStore :: build_cm_name (
205205 agent_id,
206- & CM_NAME_LOCAL_DATA_PREFIX ,
206+ cm_name_local_data_prefix ( ) ,
207207 ) ) ,
208208 predicate:: eq ( TEST_NAMESPACE ) ,
209209 predicate:: always ( ) ,
0 commit comments