-
Notifications
You must be signed in to change notification settings - Fork 13
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
Annotate PVs #66
Comments
Can you provide an example of what the PVC would look like and the resulting PV would look like? I'd like to make sure I understand what you are requesting properly. Thanks! |
Hello, Thanks a lot for your project and your fast answer. I guess you faced the same issue as us with the CSI current design which does not forward the metadata to CreateVolume request. I was writing the same operator (in Java) until I found yours! Concerning my idea. Your question maked me think about what could be done (to be discussed). Let's take as input apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: touge-test
namespace: touge
labels:
TeamID: "Frontend"
annotations:
CostCenter: "1234"
k8s-pvc-tagger/tags: |
{"Owner": "{{ .Labels.TeamID }}-{{ .Annotations.CostCenter }}"} Solution 1: copy only the computed tag in the annotationapiVersion: v1
kind: PersistentVolume
metadata:
name: mypv
annotations:
Owner: Frontend-1234
spec:
capacity:
storage: <Size> Solution 2: Copy all labels + annotation (except kube internal one)apiVersion: v1
kind: PersistentVolume
metadata:
name: mypv
labels:
TeamID: "Frontend"
annotations:
CostCenter: "1234"
spec:
capacity:
storage: <Size> Solution 3: Copy all labels + annotation + computed tagsapiVersion: v1
kind: PersistentVolume
metadata:
name: mypv
labels:
TeamID: "Frontend"
annotations:
CostCenter: "1234"
k8s-pvc-tagger/tag/Owner: Frontend-1234
spec:
capacity:
storage: <Size> Solution 4: Add filter in the PVC of the labels annotation which can be addedapiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: touge-test
namespace: touge
labels:
TeamID: "Frontend"
annotations:
CostCenter: "1234"
k8s-pvc-tagger/tags: |
{"Owner": "{{ .Labels.TeamID }}-{{ .Annotations.CostCenter }}"}
k8s-pvc-tagger/annotation: |
{"my.annotation/Owner": "{{ .Labels.TeamID }}-{{ .Annotations.CostCenter }}"}
k8s-pvc-tagger/labels: |
{"my.label/team": "{{ .Labels.TeamID }}-suffix"} apiVersion: v1
kind: PersistentVolume
metadata:
name: mypv
labels:
my.annotation/Owner: "Frontend-1234"
annotations:
my.annotation/team: "Frontend-suffix"
spec:
capacity:
storage: <Size> |
I like option 3. Would that meet your needs? |
According to me solution 3 is the best one. How to do you want to proceed ? |
If you want to do a PR, that'd be awesome, if not, I'll try and tackle it in the next few weeks (I'm traveling for work next week so I'll be busy). |
I can try to work on a PR. I will take a look and let you know. |
Is your feature request related to a problem? Please describe.
It could be nice to have a way to tag PV with the tags provided
Describe the solution you'd like
--annotate-pv
--annotate-p
is enabled, pv will be annotated with the Tagspatch
PersitentVolume
https://github.com/mtougeron/k8s-pvc-tagger/blob/main/charts/k8s-pvc-tagger/templates/rbac.yaml#L73-L76
Describe alternatives you've considered
N/A
Additional context
N/A
I can work on an PR if needed
The text was updated successfully, but these errors were encountered: