Skip to content

Commit

Permalink
Merge pull request #354 from OdedViner/add_ocs_crs
Browse files Browse the repository at this point in the history
maintenance: remove hardcoded crd constants in restoreCrd
  • Loading branch information
travisn authored Feb 17, 2025
2 parents 9287443 + 0774806 commit 0743f00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/commands/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package command

import (
"github.com/rook/kubectl-rook-ceph/pkg/crds"
"github.com/rook/kubectl-rook-ceph/pkg/restore"
"github.com/spf13/cobra"
)
Expand All @@ -31,6 +32,6 @@ var RestoreCmd = &cobra.Command{
verifyOperatorPodIsRunning(cmd.Context(), clientSets)
},
Run: func(cmd *cobra.Command, args []string) {
restore.RestoreCrd(cmd.Context(), clientSets, operatorNamespace, cephClusterNamespace, args)
restore.RestoreCrd(cmd.Context(), clientSets, operatorNamespace, cephClusterNamespace, crds.CephRookIoGroup, crds.CephRookResourcesVersion, args)
},
}
5 changes: 3 additions & 2 deletions pkg/restore/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import (
"k8s.io/apimachinery/pkg/types"
)

func RestoreCrd(ctx context.Context, k8sclientset *k8sutil.Clientsets, operatorNamespace, clusterNamespace string, args []string) {
func RestoreCrd(ctx context.Context, k8sclientset *k8sutil.Clientsets, operatorNamespace, clusterNamespace,
groupName, versionResource string, args []string) {
crd := args[0]

var crName string
Expand All @@ -42,7 +43,7 @@ func RestoreCrd(ctx context.Context, k8sclientset *k8sutil.Clientsets, operatorN
}

logging.Info("Detecting which resources to restore for crd %q", crd)
crdList, err := k8sclientset.ListResourcesDynamically(ctx, crds.CephRookIoGroup, crds.CephRookResourcesVersion, crd, clusterNamespace)
crdList, err := k8sclientset.ListResourcesDynamically(ctx, groupName, versionResource, crd, clusterNamespace)
if err != nil {
logging.Fatal(fmt.Errorf("Failed to list resources for crd %v", err))
}
Expand Down

0 comments on commit 0743f00

Please sign in to comment.