Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/cmd/kubeblocks/kubeblocks_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package kubeblocks
import (
"context"
"encoding/json"
"fmt"
"strings"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -82,7 +83,9 @@ func getKBObjects(dynamic dynamic.Interface, namespace string, addons []*extensi
ctx := context.TODO()

// get CRDs
crds, err := dynamic.Resource(types.CRDGVR()).List(ctx, metav1.ListOptions{})
crds, err := dynamic.Resource(types.CRDGVR()).List(ctx, metav1.ListOptions{
LabelSelector: fmt.Sprintf("%s=%s", constant.AppNameLabelKey, types.KubeBlocksChartName),
})
appendErr(err)
kbObjs[types.CRDGVR()] = &unstructured.UnstructuredList{}

Expand Down
10 changes: 7 additions & 3 deletions pkg/cmd/kubeblocks/kubeblocks_objects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ func mockName() string {
}

func mockCRD() []runtime.Object {
label := map[string]string{constant.AppNameLabelKey: types.KubeBlocksChartName}
clusterCRD := v1.CustomResourceDefinition{
TypeMeta: metav1.TypeMeta{
Kind: "CustomResourceDefinition",
APIVersion: "apiextensions.k8s.io/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "clusters.apps.kubeblocks.io",
Name: "clusters.apps.kubeblocks.io",
Labels: label,
},
Spec: v1.CustomResourceDefinitionSpec{
Group: types.AppsAPIGroup,
Expand All @@ -174,7 +176,8 @@ func mockCRD() []runtime.Object {
APIVersion: "apiextensions.k8s.io/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "clusterdefinitions.apps.kubeblocks.io",
Name: "clusterdefinitions.apps.kubeblocks.io",
Labels: label,
},
Spec: v1.CustomResourceDefinitionSpec{
Group: types.AppsAPIGroup,
Expand All @@ -188,7 +191,8 @@ func mockCRD() []runtime.Object {
APIVersion: "apiextensions.k8s.io/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "actionsets.dataprotection.kubeblocks.io",
Name: "actionsets.dataprotection.kubeblocks.io",
Labels: label,
},
Spec: v1.CustomResourceDefinitionSpec{
Group: types.DPAPIGroup,
Expand Down