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

aws: Support for ELB tagging by users #45932

Merged
merged 1 commit into from
May 25, 2017

Conversation

lpabon
Copy link
Contributor

@lpabon lpabon commented May 17, 2017

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-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 17, 2017
@k8s-ci-robot
Copy link
Contributor

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 @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 17, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels May 17, 2017
@cblecker
Copy link
Member

/sig aws

@lpabon
Copy link
Contributor Author

lpabon commented May 17, 2017

/assign @justinsb

Copy link
Contributor

@ericchiang ericchiang left a 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
Copy link
Contributor

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

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), "=")
Copy link
Contributor

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.

Copy link
Contributor Author

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

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 18, 2017
Copy link
Member

@justinsb justinsb left a 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
Copy link
Member

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]
Copy link
Member

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

Copy link
Member

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

Copy link
Contributor Author

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
@lpabon
Copy link
Contributor Author

lpabon commented May 23, 2017

Hi, @justinsb @zmerlynn Any other comments or reviews needed?

@justinsb
Copy link
Member

@k8s-bot ok to test

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 24, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. labels May 24, 2017
@justinsb justinsb added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. labels May 24, 2017
@lpabon
Copy link
Contributor Author

lpabon commented May 24, 2017

@k8s-bot unit test this issue: #46374

@lpabon
Copy link
Contributor Author

lpabon commented May 24, 2017

@k8s-bot e2e test this issue: #43520

@lpabon
Copy link
Contributor Author

lpabon commented May 25, 2017

@k8s-bot unit test this issue: #46365
@k8s-bot unit test this issue: #46383

@justinsb
Copy link
Member

@k8s-bot pull-kubernetes-federation-e2e-gce test this
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 45518, 46127, 46146, 45932, 45003)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants