Skip to content

Commit

Permalink
chore: fix lint (#4058)
Browse files Browse the repository at this point in the history
  • Loading branch information
dengshaojiang authored Jul 1, 2023
1 parent e304c21 commit 30d3561
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
17 changes: 0 additions & 17 deletions controllers/apps/components/internal/component_base_stateful.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package internal

import (
"encoding/json"
"fmt"
"reflect"
"strconv"
Expand Down Expand Up @@ -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
}
13 changes: 0 additions & 13 deletions internal/cli/cmd/cluster/dataprotection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/model/transform_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
)
Expand Down

0 comments on commit 30d3561

Please sign in to comment.