Skip to content

Commit

Permalink
fix pvc deleted abnormally
Browse files Browse the repository at this point in the history
Signed-off-by: Shelley-BaoYue <baoyue2@huawei.com>
  • Loading branch information
Shelley-BaoYue committed Sep 25, 2024
1 parent 7ecc15a commit e3ebe63
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ type PersistentVolumesBridge struct {

// Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any.
func (c *PersistentVolumesBridge) Get(_ context.Context, name string, options metav1.GetOptions) (result *corev1.PersistentVolume, err error) {
return c.MetaClient.PersistentVolumes(metav1.NamespaceDefault).Get(name, options)
return c.MetaClient.PersistentVolumes().Get(name, options)
}
4 changes: 2 additions & 2 deletions edge/pkg/metamanager/client/metaclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func (m *metaClient) PodStatus(namespace string) PodStatusInterface {
}

// New PersistentVolumes metaClient
func (m *metaClient) PersistentVolumes(namespace string) PersistentVolumesInterface {
return newPersistentVolumes(namespace, m.send)
func (m *metaClient) PersistentVolumes() PersistentVolumesInterface {
return newPersistentVolumes(m.send)
}

// New PersistentVolumeClaims metaClient
Expand Down
13 changes: 6 additions & 7 deletions edge/pkg/metamanager/client/persistentvolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"github.com/kubeedge/beehive/pkg/core/model"
"github.com/kubeedge/kubeedge/edge/pkg/common/message"
"github.com/kubeedge/kubeedge/edge/pkg/common/modules"
v2 "github.com/kubeedge/kubeedge/edge/pkg/metamanager/dao/v2"
)

// PersistentVolumesGetter is interface to get client PersistentVolumes
type PersistentVolumesGetter interface {
PersistentVolumes(namespace string) PersistentVolumesInterface
PersistentVolumes() PersistentVolumesInterface
}

// PersistentVolumesInterface is interface for client PersistentVolumes
Expand All @@ -26,14 +27,12 @@ type PersistentVolumesInterface interface {
}

type persistentvolumes struct {
namespace string
send SendInterface
send SendInterface
}

func newPersistentVolumes(n string, s SendInterface) *persistentvolumes {
func newPersistentVolumes(s SendInterface) *persistentvolumes {
return &persistentvolumes{
namespace: n,
send: s,
send: s,
}
}

Expand All @@ -50,7 +49,7 @@ func (c *persistentvolumes) Delete(string) error {
}

func (c *persistentvolumes) Get(name string, _ metav1.GetOptions) (*api.PersistentVolume, error) {
resource := fmt.Sprintf("%s/%s/%s", c.namespace, "persistentvolume", name)
resource := fmt.Sprintf("%s/%s/%s", v2.NullNamespace, "persistentvolume", name)
pvMsg := message.BuildMsg(modules.MetaGroup, "", modules.EdgedModuleName, resource, model.QueryOperation, nil)
msg, err := c.send.SendSync(pvMsg)
if err != nil {
Expand Down

0 comments on commit e3ebe63

Please sign in to comment.