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

remove --aws-vpc-tag-key flag, use values from --aws-vpc-tags to specify the tag key #3954

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jeswinkoshyninan
Copy link
Contributor

@jeswinkoshyninan jeswinkoshyninan commented Nov 26, 2024

Issue

This will fix #3889

Description

This will going to avoid using flag --aws-vpc-tag-key which will fix #3889 mentioned.

Manual Tests Details

Dev Build

1. When single tag is passed

➜  development  kubectl get deploy aws-load-balancer-controller  -n aws-lb-controller -o=jsonpath="{.spec.template.spec.containers[0].args}" 
["--cluster-name=jkn6982","--aws-vpc-tags=Name=jkn6982","--ingress-class=alb"]

Current Build

➜  development kubectl logs aws-load-balancer-controller-786f7c4bd6-c99gv -n aws-lb-controller -f                                            
{"level":"info","ts":"2024-11-26T12:09:18Z","msg":"version","GitVersion":"10ece68-dirty","GitCommit":"10ece689c51ada7902bb52ec05fa7832e1c9305b","BuildDate":"2024-11-26T12:02:06+0000"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"setup","msg":"adding health check for controller"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"setup","msg":"adding readiness check for webhook"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/mutate-v1-pod"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/mutate-v1-service"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/validate-elbv2-k8s-aws-v1beta1-ingressclassparams"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/mutate-elbv2-k8s-aws-v1beta1-targetgroupbinding"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/validate-elbv2-k8s-aws-v1beta1-targetgroupbinding"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/validate-networking-v1-ingress"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"setup","msg":"starting podInfo repo"}
{"level":"info","ts":"2024-11-26T12:09:18Z","logger":"setup","msg":"starting deferred tgb reconciler"}
{"level":"info","ts":"2024-11-26T12:09:20Z","logger":"controller-runtime.metrics","msg":"Starting metrics server"}
{"level":"info","ts":"2024-11-26T12:09:20Z","msg":"starting server","name":"health probe","addr":"0.0.0.0:61779"}
{"level":"info","ts":"2024-11-26T12:09:20Z","logger":"controller-runtime.metrics","msg":"Serving metrics server","bindAddress":":8080","secure":false}
{"level":"info","ts":"2024-11-26T12:09:20Z","logger":"controller-runtime.webhook","msg":"Starting webhook server"}
{"level":"info","ts":"2024-11-26T12:09:20Z","logger":"controller-runtime.certwatcher","msg":"Updated current TLS certificate"}
{"level":"info","ts":"2024-11-26T12:09:20Z","logger":"controller-runtime.certwatcher","msg":"Starting certificate watcher"}
{"level":"info","ts":"2024-11-26T12:09:20Z","logger":"controller-runtime.webhook","msg":"Serving webhook server","host":"","port":9443}
{"level":"info","ts":"2024-11-26T12:09:20Z","msg":"attempting to acquire leader lease aws-lb-controller/aws-load-balancer-controller-leader..."}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"successfully acquired lease aws-lb-controller/aws-load-balancer-controller-leader"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0004d13b0"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1beta1.TargetGroupBinding"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"service","source":"kind source: *v1.Service"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1.Service"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting Controller","controller":"service"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0004d15e0"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1.Ingress"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1.Service"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1.Endpoints"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0004d1650"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1.Node"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0004d1880"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting Controller","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1beta1.IngressClassParams"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1.IngressClass"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting Controller","controller":"ingress"}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting workers","controller":"ingress","worker count":3}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting workers","controller":"service","worker count":3}
{"level":"info","ts":"2024-11-26T12:10:30Z","msg":"Starting workers","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","worker count":3}
{"level":"info","ts":"2024-11-26T12:10:31Z","msg":"Successful reconcile","tgb":{"}
{"level":"info","ts":"2024-11-26T12:10:31Z","logger":"controllers.service","msg":"successfully built model","model":"


2. When multiple tags passed 

➜  ~   kubectl get deploy aws-load-balancer-controller  -n aws-lb-controller -o=jsonpath="{.spec.template.spec.containers[0].args}" 
["--cluster-name=jkn6982","--aws-vpc-tags=Name=jkn6982,Environment=dev","--ingress-class=alb"]%                                                                                                                                               ➜  ~ 

➜  ~ kubectl logs aws-load-balancer-controller-6b696bbcc9-jrz5c -n aws-lb-controller -f 
{"level":"info","ts":"2024-11-26T12:27:21Z","msg":"version","GitVersion":"10ece68-dirty","GitCommit":"10ece689c51ada7902bb52ec05fa7832e1c9305b","BuildDate":"2024-11-26T12:02:06+0000"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"setup","msg":"adding health check for controller"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"setup","msg":"adding readiness check for webhook"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/mutate-v1-pod"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/mutate-v1-service"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/validate-elbv2-k8s-aws-v1beta1-ingressclassparams"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/mutate-elbv2-k8s-aws-v1beta1-targetgroupbinding"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/validate-elbv2-k8s-aws-v1beta1-targetgroupbinding"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"controller-runtime.webhook","msg":"Registering webhook","path":"/validate-networking-v1-ingress"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"setup","msg":"starting podInfo repo"}
{"level":"info","ts":"2024-11-26T12:27:21Z","logger":"setup","msg":"starting deferred tgb reconciler"}
{"level":"info","ts":"2024-11-26T12:27:23Z","logger":"controller-runtime.metrics","msg":"Starting metrics server"}
{"level":"info","ts":"2024-11-26T12:27:23Z","msg":"starting server","name":"health probe","addr":"0.0.0.0:61779"}
{"level":"info","ts":"2024-11-26T12:27:23Z","logger":"controller-runtime.webhook","msg":"Starting webhook server"}
{"level":"info","ts":"2024-11-26T12:27:23Z","logger":"controller-runtime.metrics","msg":"Serving metrics server","bindAddress":":8080","secure":false}
{"level":"info","ts":"2024-11-26T12:27:23Z","logger":"controller-runtime.certwatcher","msg":"Updated current TLS certificate"}
{"level":"info","ts":"2024-11-26T12:27:23Z","logger":"controller-runtime.certwatcher","msg":"Starting certificate watcher"}
{"level":"info","ts":"2024-11-26T12:27:23Z","logger":"controller-runtime.webhook","msg":"Serving webhook server","host":"","port":9443}
{"level":"info","ts":"2024-11-26T12:27:23Z","msg":"attempting to acquire leader lease aws-lb-controller/aws-load-balancer-controller-leader..."}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"successfully acquired lease aws-lb-controller/aws-load-balancer-controller-leader"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0005b02a0"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"service","source":"kind source: *v1.Service"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1beta1.TargetGroupBinding"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting Controller","controller":"service"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0005b0310"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1.Service"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1.Endpoints"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1.Ingress"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","source":"kind source: *v1.Node"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting Controller","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1.Service"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0005b0380"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"channel source: 0xc0005b0690"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1beta1.IngressClassParams"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting EventSource","controller":"ingress","source":"kind source: *v1.IngressClass"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting Controller","controller":"ingress"}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting workers","controller":"service","worker count":3}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting workers","controller":"targetGroupBinding","controllerGroup":"elbv2.k8s.aws","controllerKind":"TargetGroupBinding","worker count":3}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Starting workers","controller":"ingress","worker count":3}
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Skipping targetgroupbinding reconcile","tgb":
{"level":"info","ts":"2024-11-26T12:27:52Z","msg":"Skipping targetgroupbinding reconcile","tgb"
{"level":"info","ts":"2024-11-26T12:27:53Z","logger":"controllers.service","msg":"successfully built model","model":"


Added log for testing and identifying whether it fetched the correct vpc-id 

 kubectl logs aws-load-balancer-controller-554bc6d4f6-4tc4j -n aws-lb-controller -f 
{"level":"info","ts":"2024-11-26T16:03:23Z","msg":"version","GitVersion":"10ece68-dirty","GitCommit":"10ece689c51ada7902bb52ec05fa7832e1c9305b","BuildDate":"2024-11-26T12:37:11+0000"}
Added for testing VPC ID:  vpc-xxxxxxxxxxxxxxxxxx
{"level":"info","ts":"2024-11-26T16:03:23Z","logger":"setup","msg":"adding health check for controller"}
{"level":"info","ts":"2024-11-26T16:03:23Z","logger":"setup","msg":"adding readiness check for webhook"}

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jeswinkoshyninan
Once this PR has been reviewed and has the lgtm label, please assign oliviassss for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 26, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @jeswinkoshyninan. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /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.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 26, 2024
pkg/aws/cloud.go Outdated Show resolved Hide resolved
Copy link

@pinkavaj pinkavaj left a comment

Choose a reason for hiding this comment

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

Looks good, mey-be squash the 2 commits to one and possibly change the MR/commit title (it will not be obvious for me, when reading changelog, what this change does). My suggestion is to go with something like: "remove --aws-vpc-tag-key flag, use values from --aws-vpc-tags to specify the tag key"

@jeswinkoshyninan jeswinkoshyninan changed the title avoid using flag --aws-vpc-tag-key remove --aws-vpc-tag-key flag, use values from --aws-vpc-tags to specify the tag key Nov 26, 2024
@jeswinkoshyninan
Copy link
Contributor Author

Looks good, mey-be squash the 2 commits to one and possibly change the MR/commit title (it will not be obvious for me, when reading changelog, what this change does). My suggestion is to go with something like: "remove --aws-vpc-tag-key flag, use values from --aws-vpc-tags to specify the tag key"

Updated the title, I think commit will be squashed before merging to master. I am not able to see the option seems due to permission, but definitely the default option will be the squash commits + merge ?

@pinkavaj
Copy link

Looks good, mey-be squash the 2 commits to one and possibly change the MR/commit title (it will not be obvious for me, when reading changelog, what this change does). My suggestion is to go with something like: "remove --aws-vpc-tag-key flag, use values from --aws-vpc-tags to specify the tag key"

Updated the title, I think commit will be squashed before merging to master. I am not able to see the option seems due to permission, but definitely the default option will be the squash commits + merge ?

Thx for update.

Not sure if they get squashed (I would kind of expect to be manual step, and it is up to the author to keep the git history clean, but not sure what are the exact rules here).

Btw there are some checkboxes in the MR description not checked, not sure how serious are the maintainers here, but it might help to get this throught (as I'm really looking forward to it!)

@jeswinkoshyninan
Copy link
Contributor Author

jeswinkoshyninan commented Nov 26, 2024

@pinkavaj my last PR had 10 commits, so I assume this should be fine.

@sarevalo2002
Copy link
Contributor

Hi @jeswinkoshyninan, thanks for the contribution! I've verified that the aws-vpc-tags flag accepts both single and multiple input values, as well as handles error cases (no vpc with specified tag exists, multiple vpcs with specified tag exists) properly. I'll loop in @shraddhabang for ok-to-test and lgtm labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usage of --aws-vpc-tags with --aws-vpc-tag-key is unclear
5 participants