-
Notifications
You must be signed in to change notification settings - Fork 40k
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
aws: Support for ELB tagging by users #45932
Conversation
Hi @lpabon. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/sig aws |
/assign @justinsb |
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.
Seems reasonable, particularly since there's already tags being included by this cloud provider plugin.
@@ -130,6 +130,11 @@ const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-lo | |||
// a HTTP listener is used. | |||
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol" | |||
|
|||
// ServiceAnnotationLoadBalancerAdditionalTagsi is the annotation used on the service | |||
// to specify a comma-separated list of key-value pairs which will be recorded as |
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.
Can you document an example of the key value pairs? e.g. key1=foo,key2=bar
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.
looks like we have this (now?) on line 136
|
||
// Break up "Key=Val" | ||
for _, tagSet := range tagList { | ||
tag := strings.Split(strings.TrimSpace(tagSet), "=") |
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.
nit: What about values with "=" in them or keys with zero length? Maybe:
i := strings.Index(tagSet, "=")
if i <= 0 || i+1 >= len(tagSet) {
continue
}
additionalTags[tagSet[:i]] = tagSet[i+1:]
Will check if there's already something to implement this parsing.
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 adjusted the unit tests to check for these types of keys and added the fix. Thanks for the note
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.
Some suggestions around value-less tags but then will look good to me
@@ -130,6 +130,12 @@ const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-lo | |||
// a HTTP listener is used. | |||
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol" | |||
|
|||
// ServiceAnnotationLoadBalancerAdditionalTagsi is the annotation used on the service |
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.
Nit: typo (extra i)
tag := strings.Split(strings.TrimSpace(tagSet), "=") | ||
if len(tag) >= 2 && len(tag[0]) != 0 && len(tag[1]) != 0 { | ||
// There is a key and a value, so save it | ||
additionalTags[tag[0]] = tag[1] |
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.
We can have an empty Value, and I think we should support that. Either Key=
or Key
syntax (or both) would work for me
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 realized someone wrote a pretty cool one for kops - we can just use that if you want:
https://github.com/kubernetes/kops/blob/master/cmd/kops/create_cluster.go#L969-L994
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.
Good point, I'll make the change.
This PR provides support for tagging AWS ELBs using information in an annotation and provided as a list of comma separated key-value pairs. Closes kubernetes/community#404
@k8s-bot ok to test /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb, lpabon
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 45518, 46127, 46146, 45932, 45003) |
This PR provides support for tagging AWS ELBs using information in an
annotation and provided as a list of comma separated key-value pairs.
Closes kubernetes/community#404