-
Notifications
You must be signed in to change notification settings - Fork 807
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
Add tags that the in-tree volume plugin uses #530
Conversation
To keep compatibility with in-tree volume plugin, provisioned volumes should have these tags: kubernetes.io/cluster/<cluster-id>: owned Name: : <cluster-id>-dynamic-<PV name> In order to get the cluster-id to the driver, a new --cluster-id parameter is added to controller command line.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Pull Request Test Coverage Report for Build 1134
💛 - Coveralls |
cc @wongma7 @leakingtapan @bertinatto - PTAL |
cmd/options/controller_options.go
Outdated
} | ||
|
||
func (s *ControllerOptions) AddFlags(fs *flag.FlagSet) { | ||
fs.Var(cliflag.NewMapStringString(&s.ExtraVolumeTags), "extra-volume-tags", "Extra volume tags to attach to each dynamically provisioned volume. It is a comma separated list of key value pairs like '<key1>=<value1>,<key2>=<value2>'") | ||
fs.StringVar(&s.ClusterID, "cluster-id", "", "ID of the Kubernetes cluster (optional).") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid --cluster-id
alone doesn't represent what this flag is really doing (adding labels with cluster ID to the volumes).
Also, I'd make the flag explicitly mention k8s (in addition to the help message already mentioning it). Something like k8s-cluster-id-volume-tags
. It's similar to the flag above, plus it emphasizes it's k8s-specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to --k8s-tag-cluster-id=
with description "ID of the Kubernetes cluster used for tagging provisioned EBS volumes (optional)"
// with in-tree volume plugin. Value of the tag is PV name. It is applied only when | ||
// the external provisioner sidecar is started with --extra-create-metadata=true and | ||
// thus provides such metadata to the CSI driver. | ||
PVNameTag = "kubernetes.io/created-for/pv/name" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: in the future we should consider moving CO-specific constants to their own packages/files.
4bafe43
to
7d85a3c
Compare
Add following tags to provisioned volumes: kubernetes.io/created-for/pv/name: pvc-447cc711-bb65-4b4d-836d-a822e4e77e43 kubernetes.io/created-for/pvc/name: myclaim kubernetes.io/created-for/pvc/namespace: default This is for beckward compatibility with in-tree aws-ebs volume plugin, that introduced these tags. The tags are added to volumes only when the external-provisioner sidecar is running with --extra-create-metadata=true option.
44be879
to
a4fc74a
Compare
/test pull-aws-ebs-csi-driver-e2e-single-az |
did I break it? |
/assign @wongma7 @leakingtapan |
/lgtm |
/retest |
/test pull-aws-ebs-csi-driver-e2e-single-az |
1 similar comment
/test pull-aws-ebs-csi-driver-e2e-single-az |
/retest |
1 similar comment
/retest |
Is this a bug fix or adding new feature?
Bugfix, to reach 100% compatibility with the in-tree volume plugin, the CSI driver should create also the same tags on dynamically provisioned volumes.
What is this PR about? / Why do we need it?
CreateVolumeRequest.Parameters
, use those to tag volumes (i.e. the provisioner must run with--extra-create-metadata=true
).--k8s-tag-cluster-id
was provided on cmdline, use those to tag the provisioned volumes as owned by the cluster.Both set of tags are optional.
Fixes: #529
What testing is done?