Skip to content

editor: PVC with matchExpressions is NOT matching PV with labels that match the expression #878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
adietish opened this issue May 16, 2025 · 0 comments · Fixed by #879
Closed
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@adietish
Copy link
Collaborator

follows up on #642

Steps:

  1. EXEC: paste the following in an editor for a yaml file:
# --------------------------
# PersistentVolume 2 (targeted by PVC with matchExpressions)
# --------------------------
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-expressions
  labels:
    environment: production      # Label for matchExpressions
    region: us-west              # Label for matchExpressions (key existence)
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  storageClassName: manual       # Disables dynamic provisioning
  hostPath:
    path: /mnt/data-expressions
---
# --------------------------
# PVC 2: Uses matchExpressions
# --------------------------
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-expressions
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  selector:
    matchExpressions:
      - key: environment
        operator: In             # Value must be in the list
        values: [production, staging]
      - key: region
        operator: Exists         # Key must exist (value ignored)
  1. EXEC: go to the selector in the PVC and verify that it is matching the PV

Result:
The PVC reports "0 matching" for it's selector even though it's expression

    matchExpressions:
      - key: environment
        operator: In             # Value must be in the list
        values: [production, staging]
      - key: region
        operator: Exists         # Key must exist (value ignored)

is matching the labels in the PV:

  labels:
    environment: production      # Label for matchExpressions
    region: us-west              # Label for matchExpressions (key existence)
@adietish adietish self-assigned this May 16, 2025
@adietish adietish added the kind/bug Something isn't working label May 16, 2025
@adietish adietish added this to the 1.7.0 milestone May 16, 2025
@adietish adietish moved this to 📝 In Progress in IDE Cloudaptors May 16, 2025
adietish added a commit to adietish/intellij-kubernetes that referenced this issue May 16, 2025
@adietish adietish changed the title PVC with matchExpressions is NOT matching PV with labels that match the expression editor: PVC with matchExpressions is NOT matching PV with labels that match the expression May 16, 2025
adietish added a commit that referenced this issue May 19, 2025
@github-project-automation github-project-automation bot moved this from 📝 In Progress to ✅ Done in IDE Cloudaptors May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant