Skip to content
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

volume-requested-topology annotation should be YAML string for better readability #3109

Open
aruneshpa opened this issue Nov 15, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@aruneshpa
Copy link

Is this a BUG REPORT or FEATURE REQUEST?:
/kind bug

What happened:
The current way to specify the list of zones where a volume would be available is to specify a JSON blob as a value of the volume-requested-topology annotation. While this works, this quickly becomes unreadable for any human interaction and consumption. A cleaner way would be to use YAML strings. Here a comparison of both current and the proposed approach:

Consider a scenario where a PVC is being made available in 5 zones (for illustration purpose). The value of the annotation starts to becomes unreadable.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    csi.vsphere.volume-requested-topology: '[{"topology.kubernetes.io/zone":"zone-1"}, {"topology.kubernetes.io/zone":"zone-2"}, {"topology.kubernetes.io/zone":"zone-3"}, {"topology.kubernetes.io/zone":"zone-4"}, {"topology.kubernetes.io/zone":"zone-5"}]'

The same PVC will look like this using the proposed YAML string approach:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    csi.vsphere.volume-requested-topology: |
      - "topology.kubernetes.io/zone":"zone-1"
      - "topology.kubernetes.io/zone":"zone-2"
      - "topology.kubernetes.io/zone":"zone-3"
      - "topology.kubernetes.io/zone":"zone-4"
      - "topology.kubernetes.io/zone":"zone-5"

YAML as a string also has an advantage of being able to identify any mistakes while crafting the object (essential for non automation/machine users).

What you expected to happen:
N/A

How to reproduce it (as minimally and precisely as possible):
Create a multi zone PVC and observe the JSON blob in the annotation.

Anything else we need to know?:
N/A

Skipping the env section since this is present on main.

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 15, 2024
@aruneshpa
Copy link
Author

cc @SandeepPissay , @akutz

@akutz
Copy link
Contributor

akutz commented Nov 15, 2024

Please note the use of the | character after the annotation key. This indicates a multi-line YAML string. I validated this works for annotations by creating a ConfigMap with one. Importantly the info is also returned in this format as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants