diff --git a/pkg/k8sclient/k8sclient.go b/pkg/k8sclient/k8sclient.go index 006d5a48a..5d5b4e154 100644 --- a/pkg/k8sclient/k8sclient.go +++ b/pkg/k8sclient/k8sclient.go @@ -292,6 +292,11 @@ func getKubernetesDelegate(client *ClientInfo, net *types.NetworkSelectionElemen } } + // acquire lock to access file + if types.ChrootMutex != nil { + types.ChrootMutex.Lock() + defer types.ChrootMutex.Unlock() + } configBytes, err := netutils.GetCNIConfig(customResource, confdir) if err != nil { return nil, resourceMap, err