@@ -52,7 +52,6 @@ type KubernetesClient struct {
52
52
53
53
var staleVolLog = logf .Log .WithName ("recoverstalevolume_controller" )
54
54
var reconcileTime = 2 * time .Minute
55
- var csiOperatorNamespace = "ibm-object-csi-operator-system"
56
55
var csiNodePodPrefix = "ibm-object-csi-node"
57
56
var transportEndpointError = "transport endpoint is not connected"
58
57
var kubeClient = createK8sClient
@@ -204,8 +203,8 @@ func (r *RecoverStaleVolumeReconciler) Reconcile(ctx context.Context, req ctrl.R
204
203
}
205
204
reqLogger .Info ("node-names maped with volumes and deployment pods" , "nodeVolumeMap" , nodeVolumePodMapping )
206
205
207
- // Get Pods in csiOperatorNamespace ns
208
- var listOptions2 = & client.ListOptions {Namespace : csiOperatorNamespace }
206
+ // Get Pods in operator ns
207
+ var listOptions2 = & client.ListOptions {Namespace : req . Namespace }
209
208
csiPodsList := & corev1.PodList {}
210
209
err = r .List (ctx , csiPodsList , listOptions2 )
211
210
if err != nil {
@@ -230,7 +229,7 @@ func (r *RecoverStaleVolumeReconciler) Reconcile(ctx context.Context, req ctrl.R
230
229
231
230
for nodeName , volumesData := range nodeVolumePodMapping {
232
231
// Fetch volume stats from Logs of the Node Server Pod
233
- getVolStatsFromLogs , err := fetchVolumeStatsFromNodeServerLogs (ctx , csiNodeServerPods [nodeName ], logTailLines , r .IsTest )
232
+ getVolStatsFromLogs , err := fetchVolumeStatsFromNodeServerLogs (ctx , csiNodeServerPods [nodeName ], req . Namespace , logTailLines , r .IsTest )
234
233
if err != nil {
235
234
return ctrl.Result {}, err
236
235
}
@@ -305,7 +304,7 @@ func createK8sClient() (*KubernetesClient, error) {
305
304
}, nil
306
305
}
307
306
308
- func fetchVolumeStatsFromNodeServerLogs (ctx context.Context , nodeServerPod string , logTailLines int64 , isTest bool ) (map [string ]string , error ) {
307
+ func fetchVolumeStatsFromNodeServerLogs (ctx context.Context , nodeServerPod , ns string , logTailLines int64 , isTest bool ) (map [string ]string , error ) {
309
308
podLogOpts := & corev1.PodLogOptions {
310
309
Container : csiNodePodPrefix ,
311
310
TailLines : & logTailLines ,
@@ -315,7 +314,7 @@ func fetchVolumeStatsFromNodeServerLogs(ctx context.Context, nodeServerPod strin
315
314
if err != nil {
316
315
return nil , err
317
316
}
318
- request := k8sClient .Clientset .CoreV1 ().Pods (csiOperatorNamespace ).GetLogs (nodeServerPod , podLogOpts )
317
+ request := k8sClient .Clientset .CoreV1 ().Pods (ns ).GetLogs (nodeServerPod , podLogOpts )
319
318
320
319
nodePodLogs , err := request .Stream (ctx )
321
320
if err != nil {
0 commit comments