Skip to content

Commit

Permalink
csi: add rbd ls option
Browse files Browse the repository at this point in the history
This commit adds the ability to list RBD images.

Signed-off-by: Oded Viner <[email protected]>
  • Loading branch information
OdedViner committed Nov 11, 2024
1 parent 3ab36b9 commit bb7e341
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 47 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/go-test-config/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ runs:
tests/github-action-helper.sh create_stale_subvolume
subVol=$(kubectl rook-ceph ${NS_OPT} subvolume ls --stale | awk '{print $2}' | grep csi-vol)
kubectl rook_ceph ${NS_OPT} subvolume delete myfs $subVol
- name: Get rbd list
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ex
kubectl rook-ceph ${NS_OPT} rbd ls
- name: Get mon endpoints
shell: bash --noprofile --norc -eo pipefail -x {0}
Expand Down
15 changes: 15 additions & 0 deletions cmd/commands/rbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package command

import (
rbd "github.com/rook/kubectl-rook-ceph/pkg/rbd"

"github.com/rook/kubectl-rook-ceph/pkg/exec"
"github.com/rook/kubectl-rook-ceph/pkg/logging"
"github.com/spf13/cobra"
Expand All @@ -38,3 +40,16 @@ var RbdCmd = &cobra.Command{
}
},
}

var listCmdRbd = &cobra.Command{
Use: "ls",
Short: "Print the list of rbd volumes.",
Run: func(cmd *cobra.Command, args []string) {
ctx := cmd.Context()
rbd.ListRbdVolumes(ctx, clientSets, operatorNamespace, cephClusterNamespace)
},
}

func init() {
RbdCmd.AddCommand(listCmdRbd)
}
56 changes: 28 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module github.com/rook/kubectl-rook-ceph

go 1.22.5
go 1.23

toolchain go1.22.7
toolchain go1.23.2

require (
github.com/fatih/color v1.18.0
github.com/golang/mock v1.6.0
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0
github.com/pkg/errors v0.9.1
github.com/rook/rook v1.15.5
github.com/rook/rook/pkg/apis v0.0.0-20231204200402-5287527732f7
github.com/rook/rook/pkg/apis v0.0.0-20241111083453-66e2d53c0673
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -20,13 +20,13 @@ require (
)

require (
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/containernetworking/cni v1.2.0-rc1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/containernetworking/cni v1.2.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
Expand All @@ -37,58 +37,58 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
github.com/hashicorp/vault/api v1.14.0 // indirect
github.com/hashicorp/vault/api/auth/approle v0.6.0 // indirect
github.com/hashicorp/vault/api/auth/kubernetes v0.6.0 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
github.com/hashicorp/hcl v1.0.1-vault-7 // indirect
github.com/hashicorp/vault/api v1.15.0 // indirect
github.com/hashicorp/vault/api/auth/approle v0.8.0 // indirect
github.com/hashicorp/vault/api/auth/kubernetes v0.8.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.7.0 // indirect
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.7.5 // indirect
github.com/kube-object-storage/lib-bucket-provisioner v0.0.0-20221122204822-d1a8c34382f1 // indirect
github.com/libopenstorage/secrets v0.0.0-20240416031220-a17cf7f72c6c // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/moby/spdystream v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999 // indirect
github.com/openshift/api v0.0.0-20241109205306-a2817b89f7e0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.8.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

Expand Down
Loading

0 comments on commit bb7e341

Please sign in to comment.