@@ -113,6 +113,7 @@ func NewAnonymizer(clusterBaseDomain string, networks []string, secretsClient co
113
113
func NewAnonymizerFromConfigClient (
114
114
ctx context.Context ,
115
115
kubeClient kubernetes.Interface ,
116
+ gatherKubeClient kubernetes.Interface ,
116
117
configClient configv1client.ConfigV1Interface ,
117
118
networkClient networkv1client.NetworkV1Interface ,
118
119
) (* Anonymizer , error ) {
@@ -135,7 +136,7 @@ func NewAnonymizerFromConfigClient(
135
136
networks = append (networks , networksConfig .Spec .ExternalIP .Policy .AllowedCIDRs ... )
136
137
networks = append (networks , networksConfig .Spec .ExternalIP .Policy .RejectedCIDRs ... )
137
138
138
- clusterConfigV1 , err := kubeClient .CoreV1 ().ConfigMaps ("kube-system" ).Get (ctx , "cluster-config-v1" , metav1.GetOptions {})
139
+ clusterConfigV1 , err := gatherKubeClient .CoreV1 ().ConfigMaps ("kube-system" ).Get (ctx , "cluster-config-v1" , metav1.GetOptions {})
139
140
if err != nil {
140
141
return nil , err
141
142
}
@@ -183,24 +184,29 @@ func NewAnonymizerFromConfigClient(
183
184
184
185
// NewAnonymizerFromConfig creates a new instance of anonymizer with a provided kubeconfig
185
186
func NewAnonymizerFromConfig (
186
- ctx context.Context , kubeConfig * rest.Config , protoKubeConfig * rest.Config ,
187
+ ctx context.Context , gatherKubeConfig * rest. Config , gatherProtoKubeConfig * rest.Config , protoKubeConfig * rest.Config ,
187
188
) (* Anonymizer , error ) {
188
189
kubeClient , err := kubernetes .NewForConfig (protoKubeConfig )
189
190
if err != nil {
190
191
return nil , err
191
192
}
192
193
193
- configClient , err := configv1client .NewForConfig (kubeConfig )
194
+ gatherKubeClient , err := kubernetes .NewForConfig (gatherProtoKubeConfig )
194
195
if err != nil {
195
196
return nil , err
196
197
}
197
198
198
- networkClient , err := networkv1client .NewForConfig (kubeConfig )
199
+ configClient , err := configv1client .NewForConfig (gatherKubeConfig )
199
200
if err != nil {
200
201
return nil , err
201
202
}
202
203
203
- return NewAnonymizerFromConfigClient (ctx , kubeClient , configClient , networkClient )
204
+ networkClient , err := networkv1client .NewForConfig (gatherKubeConfig )
205
+ if err != nil {
206
+ return nil , err
207
+ }
208
+
209
+ return NewAnonymizerFromConfigClient (ctx , kubeClient , gatherKubeClient , configClient , networkClient )
204
210
}
205
211
206
212
// AnonymizeMemoryRecord takes record.MemoryRecord, removes the sensitive data from it and returns the same object
0 commit comments