diff --git a/controllers/apps/components/internal/component_base_stateful.go b/controllers/apps/components/internal/component_base_stateful.go index 093c4b32a33..211cc508f34 100644 --- a/controllers/apps/components/internal/component_base_stateful.go +++ b/controllers/apps/components/internal/component_base_stateful.go @@ -20,7 +20,6 @@ along with this program. If not, see . package internal import ( - "encoding/json" "fmt" "reflect" "strconv" @@ -732,19 +731,3 @@ func (c *StatefulComponentBase) getRunningVolumes(reqCtx intctrlutil.RequestCtx, } return matchedPVCs, nil } - -// getClusterBackupSourceMap gets the backup source map from cluster.annotations -func (c *StatefulComponentBase) getClusterBackupSourceMap(cluster *appsv1alpha1.Cluster) (map[string]string, error) { - compBackupMapString := cluster.Annotations[constant.RestoreFromBackUpAnnotationKey] - if len(compBackupMapString) == 0 { - return nil, nil - } - compBackupMap := map[string]string{} - err := json.Unmarshal([]byte(compBackupMapString), &compBackupMap) - for k := range compBackupMap { - if cluster.Spec.GetComponentByName(k) == nil { - return nil, intctrlutil.NewErrorf(intctrlutil.ErrorTypeNotFound, "restore: not found componentSpecs[*].name %s", k) - } - } - return compBackupMap, err -} diff --git a/internal/cli/cmd/cluster/dataprotection.go b/internal/cli/cmd/cluster/dataprotection.go index 3827926e3f3..8e00dbbbb4f 100644 --- a/internal/cli/cmd/cluster/dataprotection.go +++ b/internal/cli/cmd/cluster/dataprotection.go @@ -245,19 +245,6 @@ func NewCreateBackupCmd(f cmdutil.Factory, streams genericclioptions.IOStreams) return cmd } -// getClusterNameMap get cluster list by namespace and convert to map. -func getClusterNameMap(dClient dynamic.Interface, o *list.ListOptions) (map[string]struct{}, error) { - clusterList, err := dClient.Resource(types.ClusterGVR()).Namespace(o.Namespace).List(context.TODO(), metav1.ListOptions{}) - if err != nil { - return nil, err - } - clusterMap := make(map[string]struct{}) - for _, v := range clusterList.Items { - clusterMap[v.GetName()] = struct{}{} - } - return clusterMap, nil -} - func printBackupList(o ListBackupOptions) error { // if format is JSON or YAML, use default printer to output the result. if o.Format == printer.JSON || o.Format == printer.YAML { diff --git a/internal/controller/model/transform_utils_test.go b/internal/controller/model/transform_utils_test.go index 413fa527767..0e468b1bcfd 100644 --- a/internal/controller/model/transform_utils_test.go +++ b/internal/controller/model/transform_utils_test.go @@ -26,7 +26,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - roclient "github.com/apecloud/kubeblocks/internal/controller/client" "github.com/go-logr/logr" "github.com/golang/mock/gomock" apps "k8s.io/api/apps/v1" @@ -36,6 +35,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/apecloud/kubeblocks/internal/controller/builder" + roclient "github.com/apecloud/kubeblocks/internal/controller/client" "github.com/apecloud/kubeblocks/internal/controller/graph" testutil "github.com/apecloud/kubeblocks/internal/testutil/k8s" )