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

Allow passing tags to volumes using the storage class #133

Merged
merged 4 commits into from
Nov 22, 2023

Conversation

tchinmai7
Copy link
Contributor

@tchinmai7 tchinmai7 commented Nov 8, 2023

General:

  • Have you removed all sensitive information, including but not limited to access keys and passwords?
  • Have you checked to ensure there aren't other open or closed Pull Requests for the same bug/feature/question?

Adds a new feature to pass tags to linode volumes created by the CSI driver. It is currently not possible to set an annotation on the PVC and get the csi-driver to read the annotation due to kubernetes-csi/external-provisioner#86

Choosing to take the approach of passing tags via StorageClass parameters instead.

This closes #132

Pull Request Guidelines:

  1. Does your submission pass tests?
  2. Have you added tests?
  3. Are you addressing a single feature in this PR?
  4. Are your commits atomic, addressing one change per commit?
  5. Are you following the conventions of the language?
  6. Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. Have you explained your rationale for why this feature is needed?
  8. Have you linked your PR to an open issue

@luthermonson
Copy link
Contributor

add to the howto in the readme how to do this without the helm chart?

@tchinmai7
Copy link
Contributor Author

Tested by installing the helm chart with allowTags set to awjv0d0

allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
  creationTimestamp: "2023-11-09T01:47:47Z"
  name: linode-block-storage-retain
  resourceVersion: "4756"
  uid: a68363b3-68d6-49d8-b748-0d08dff099ba
parameters:
  linodebs.csi.linode.com/volumeTags: awjv0d0
provisioner: linodebs.csi.linode.com
reclaimPolicy: Retain
volumeBindingMode: Immediate

I've got a teleport pv created

❯ k get pv pvc-322d8f57747c4922  -n kube-system

NAME                   CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                             STORAGECLASS                  REASON   AGE
pvc-322d8f57747c4922   10Gi       RWO            Retain           Bound    kube-system/teleport-in-cluster   linode-block-storage-retain            7m13s

Querying the Linode API for volumes - you can see that the volume has a tag on it

{
    "id": 1959917,
    "status": "active",
    "label": "pvc322d8f57747c4922",
    "created": "2023-11-09T01:50:10",
    "updated": "2023-11-09T01:50:35",
    "filesystem_path": "/dev/disk/by-id/scsi-0Linode_Volume_pvc322d8f57747c4922",
    "size": 10,
    "linode_id": 51795491,
    "linode_label": "rags-worker-0",
    "region": "us-east",
    "tags": [
      "awjv0d0"
    ],
    "hardware_type": "nvme"
  },

@tchinmai7
Copy link
Contributor Author

add to the howto in the readme how to do this without the helm chart?

Yes - added

pkg/linode-bs/controllerserver.go Show resolved Hide resolved
@@ -7,5 +7,9 @@ metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- if .Values.addTags }}
parameters:
linodebs.csi.linode.com/volumeTags: "{{ .Values.addTags }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this simply be "{{ .Values.volumeTags }}" instead of "addTags" , to match the parameter name?

pkg/linode-bs/controllerserver.go Show resolved Hide resolved
helm-chart/csi-driver/values.yaml Outdated Show resolved Hide resolved
@luthermonson luthermonson merged commit 258a04f into linode:master Nov 22, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Tag Support for Volumes
3 participants