Skip to content

oc oadp snapshot-location get --selector flag does not filter VolumeSnapshotLocations by label #259

Description

@PratikMane0112

The --selector (or -l) flag on the oc oadp snapshot-location get command is accepted but has no effect. It returns all VolumeSnapshotLocations (VSLs) regardless of the label selector provided. The equivalent native OpenShift command (oc get vsl --selector) works correctly.

OADP Version

$ oc get csv -n openshift-adp
NAME                   DISPLAY         VERSION   RELEASE   REPLACES               PHASE
oadp-operator.v1.6.1   OADP Operator   1.6.1               oadp-operator.v1.6.0   Succeeded

Downloaded OADP CLI from cluster

$ make download-oadp-cli-from-cluster                              
========================================
Installing kubectl-oadp from cluster OADP CLI server...
========================================
[1/7] Checking prerequisites...
  ✓ oc and curl found
[2/7] Resolving OADP CLI server route...
  Auto-discovering route oadp-cli-server-route in namespace openshift-adp...
  ✓ Discovered route: https://oadp-cli-server-route-openshift-adp.apps.oadp-1234.qe.gcp.devcluster.openshift.com/
[3/7] Fetching download index from server...
  URL: https://oadp-cli-server-route-openshift-adp.apps.oadp-1234.qe.gcp.devcluster.openshift.com/
  ✓ Index fetched successfully
[4/7] Looking for binary: kubectl-oadp_linux_arm64
  ✓ Found binary: kubectl-oadp_linux_arm64
[5/7] Creating directory ./tools/oadp-cli...
  ✓ Directory ready
[6/7] Downloading binary...
  URL: https://oadp-cli-server-route-openshift-adp.apps.oadp-1234.qe.gcp.devcluster.openshift.com/download/kubectl-oadp_linux_arm64
  ✓ Downloaded successfully
[7/7] Making binary executable...
  ✓ Binary is executable
========================================
✓ kubectl-oadp installed successfully!
  Location: ./tools/oadp-cli/kubectl-oadp

Steps to Reproduce

1. Create a DataProtectionApplication (DPA)

apiVersion: oadp.openshift.io/v1alpha1
kind: DataProtectionApplication
metadata:
  name: ts-dpa
  namespace: openshift-adp
spec:
  backupLocations:
  - velero:
      credential:
        key: cloud
        name: cloud-credentials
      default: true
      objectStorage:
        bucket: oadp1234abcd
        prefix: velero
      provider: gcp
  configuration:
    nodeAgent:
      enable: true
      uploaderType: kopia
    velero:
      defaultPlugins:
      - csi
      - gcp
      - openshift
status:
  conditions:
  - lastTransitionTime: "2026-08-26T16:51:21Z"
    message: Reconcile complete
    reason: Complete
    status: "True"
    type: Reconciled

$ oc get bsl
NAME       PHASE       LAST VALIDATED   AGE    DEFAULT
ts-dpa-1   Available   28s              110m   true

$ oc get pods
NAME                                                READY   STATUS    RESTARTS   AGE
node-agent-87qqx                                    1/1     Running   0          110m
node-agent-cds5d                                    1/1     Running   0          110m
node-agent-k5fdd                                    1/1     Running   0          110m
openshift-adp-controller-manager-59b5cd476d-6bjnj   1/1     Running   0          7h12m
openshift-adp-oadp-cli-server-744fc95585-xcbgq      1/1     Running   0          10h
openshift-adp-oadp-vmdp-server-78f964bf8-7fxzb      1/1     Running   0          10h
velero-6cb847d5f9-bnfwb                             1/1     Running   0          110m

2. Create VSLs with different labels

# VSL with no labels
$ oc oadp snapshot-location create test-cli-vsl \
  --provider gcp \
  --config project=openshift-qe,snapshotLocation=us-central1

Snapshot volume location "test-cli-vsl" configured successfully.

# VSL with labels env=test,team=oadp
$ oc oadp snapshot-location create test-cli-vsl-labeled1 \
  --provider gcp \
  --config project=openshift-qe,snapshotLocation=us-central1 \
  --credential cloud-credentials=cloud \
  --labels env=test,team=oadp

Snapshot volume location "test-cli-vsl-labeled1" configured successfully.

# VSL with label env=test only
$ oc oadp snapshot-location create test-cli-vsl-labeled2 \
  --provider gcp \
  --config project=openshift-qe,snapshotLocation=us-central1 \
  --credential cloud-credentials=cloud \
  --labels env=test

Snapshot volume location "test-cli-vsl-labeled2" configured successfully.

3. Verify labels are set correctly

$ oc oadp snapshot-location get --show-labels
NAME                    PROVIDER   LABELS
test-cli-vsl            gcp        <none>
test-cli-vsl-labeled1   gcp        env=test,team=oadp
test-cli-vsl-labeled2   gcp        env=test

4. Filter with --selector team=oadp using both commands

$ oc oadp snapshot-location get --selector team=oadp
NAME                    PROVIDER
test-cli-vsl            gcp
test-cli-vsl-labeled1   gcp
test-cli-vsl-labeled2   gcp

# corresponding oc command
$ oc get vsl --selector team=oadp
NAME                    AGE
test-cli-vsl-labeled1   4m59s

5. Filter with --selector env=test using both commands

$ oc oadp snapshot-location get --selector env=test
NAME                    PROVIDER
test-cli-vsl            gcp
test-cli-vsl-labeled1   gcp
test-cli-vsl-labeled2   gcp

# corresponding oc command
$ oc get vsl --selector env=test
NAME                    AGE
test-cli-vsl-labeled1   12m
test-cli-vsl-labeled2   11m

Expected Results

  • oc oadp snapshot-location get --selector team=oadp should return only test-cli-vsl-labeled1 (matching oc get vsl --selector team=oadp).
  • oc oadp snapshot-location get --selector env=test should return only test-cli-vsl-labeled1 and test-cli-vsl-labeled2 (matching oc get vsl --selector env=test).

Actual Results

oc oadp snapshot-location get --selector returns all VSLs regardless of the selector value. The flag is silently ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions