From 54e05ea185968ee7c3382506181af86ff5e28142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8D=95=E5=BD=B1?= Date: Tue, 10 Oct 2023 15:44:25 +0800 Subject: [PATCH] fix crd resource etcd key path --- pkg/yurthub/storage/etcd/key.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/yurthub/storage/etcd/key.go b/pkg/yurthub/storage/etcd/key.go index 0192993eda2..ee51f98fce2 100644 --- a/pkg/yurthub/storage/etcd/key.go +++ b/pkg/yurthub/storage/etcd/key.go @@ -18,6 +18,7 @@ package etcd import ( "errors" + hubmeta "github.com/openyurtio/openyurt/pkg/yurthub/kubernetes/meta" "path/filepath" "k8s.io/apimachinery/pkg/api/validation/path" @@ -72,6 +73,12 @@ func (s *etcdStorage) KeyFunc(info storage.KeyBuildInfo) (storage.Key, error) { path := filepath.Join(s.prefix, resource, info.Namespace, info.Name) + gvr := schema.GroupVersionResource{Group: info.Group, Version: info.Version, Resource: info.Resources} + if isSchema := hubmeta.IsSchemeResource(gvr); !isSchema { + group := info.Group + path = filepath.Join(s.prefix, group, resource, info.Namespace, info.Name) + } + return storageKey{ comp: info.Component, path: path,