diff --git a/pkg/controllers/resources/configmaps/syncer.go b/pkg/controllers/resources/configmaps/syncer.go index 07f7af383..d8dfbcf5a 100644 --- a/pkg/controllers/resources/configmaps/syncer.go +++ b/pkg/controllers/resources/configmaps/syncer.go @@ -58,6 +58,9 @@ func (s *configMapSyncer) HostToVirtual(ctx context.Context, req types.Namespace Name: "kube-root-ca.crt", Namespace: s.NamespacedTranslator.HostToVirtual(ctx, req, pObj).Namespace, } + } else if s.multiNamespaceMode && req.Name == "kube-root-ca.crt" { + // ignore kube-root-ca.crt from host + return types.NamespacedName{} } return s.NamespacedTranslator.HostToVirtual(ctx, req, pObj) diff --git a/pkg/controllers/syncer/syncer.go b/pkg/controllers/syncer/syncer.go index f115a2a24..899c12905 100644 --- a/pkg/controllers/syncer/syncer.go +++ b/pkg/controllers/syncer/syncer.go @@ -267,7 +267,7 @@ func (r *SyncController) excludePhysical(ctx context.Context, pObj, vObj client. return false, fmt.Errorf("failed to check if physical object is managed: %w", err) } else if !isManaged { if vObj != nil { - msg := "conflict: cannot sync virtual object as unmanaged physical object exists with desired name" + msg := fmt.Sprintf("conflict: cannot sync virtual object %s/%s as unmanaged physical object %s/%s exists with desired name", vObj.GetNamespace(), vObj.GetName(), pObj.GetNamespace(), pObj.GetName()) r.vEventRecorder.Eventf(vObj, "Warning", "SyncError", msg) return false, fmt.Errorf(msg) } diff --git a/pkg/controllers/syncer/syncer_test.go b/pkg/controllers/syncer/syncer_test.go index e6fd65072..660e5447d 100644 --- a/pkg/controllers/syncer/syncer_test.go +++ b/pkg/controllers/syncer/syncer_test.go @@ -233,7 +233,7 @@ func TestReconcile(t *testing.T) { }, shouldErr: true, - errMsg: "conflict: cannot sync virtual object as unmanaged physical object exists with desired name", + errMsg: "conflict: cannot sync virtual object default/a as unmanaged physical object test/a-x-default-x-suffix exists with desired name", }, } sort.SliceStable(testCases, func(i, j int) bool { diff --git a/pkg/plugin/v2/plugin.go b/pkg/plugin/v2/plugin.go index 861b7f1b2..13c2ae4f4 100644 --- a/pkg/plugin/v2/plugin.go +++ b/pkg/plugin/v2/plugin.go @@ -826,7 +826,7 @@ func (m *Manager) WithInterceptors(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { info, ok := request.RequestInfoFrom(r.Context()) if !ok { - klog.V(1).Info("could not determine the infos from the request, serving next handler") + klog.V(1).Infof("could not determine the infos from the request %s, serving next handler", r.URL.Path) next.ServeHTTP(w, r) return } diff --git a/pkg/util/translate/multi_namespace.go b/pkg/util/translate/multi_namespace.go index b2a8ae64f..e36d19596 100644 --- a/pkg/util/translate/multi_namespace.go +++ b/pkg/util/translate/multi_namespace.go @@ -66,7 +66,7 @@ func (s *multiNamespace) IsManaged(obj runtime.Object) bool { // If obj is not in the synced namespace OR // If object-name annotation is not set OR // If object-name annotation is different from actual name - if !s.IsTargetedNamespace(metaAccessor.GetNamespace()) || metaAccessor.GetAnnotations() == nil || metaAccessor.GetAnnotations()[NameAnnotation] == "" || metaAccessor.GetAnnotations()[NameAnnotation] != metaAccessor.GetName() { + if !s.IsTargetedNamespace(metaAccessor.GetNamespace()) || metaAccessor.GetAnnotations() == nil || metaAccessor.GetAnnotations()[NameAnnotation] == "" { return false }