-
Notifications
You must be signed in to change notification settings - Fork 414
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
Use portforwarder instead of kubectl command line #599
Use portforwarder instead of kubectl command line #599
Conversation
|
Hi @NavidZ. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
I wasn't sure whether I should have included changes beyond the changes in eventlistener_test.go file. All those are the result of vendor update that this change needs to get newer version of k8s.io/client-go. |
/ok-to-test |
test/eventlistener_test.go
Outdated
|
||
config, err := clientcmd.BuildConfigFromFlags("", knativetest.Flags.Kubeconfig) | ||
if err != nil { | ||
panic(err) |
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 just realized these "panic"s slipped through. I'll update them in the next patch.
/assign wlynch |
/kind cleanup |
/kind flake |
test/eventlistener_test.go
Outdated
} | ||
|
||
path := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/portforward", namespace, podName) | ||
hostIP := strings.TrimLeft(config.Host, "htps:/") |
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.
is the htps:/
supposed to be https:/
?
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.
It seem TrimLeft just gets a set of characters and remove all the ones from the beginning of the string. I can use the other function that only removes the exact keyword if you prefer.
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.
yeah, I would use strings.TrimPrefix
instead, or call url.Parse
and then set the path afterwards.
Would you mind squashing up the commits? Thanks! |
I had a question here. I also noticed this in other reviews. GitHub already has a squash button before merging when doing a manual merge but I guess since the bot merges these after an lgtm command it doesn't do it automatically. |
test/eventlistener_test.go
Outdated
} | ||
|
||
path := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/portforward", namespace, podName) | ||
hostIP := strings.TrimLeft(config.Host, "htps:/") |
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.
yeah, I would use strings.TrimPrefix
instead, or call url.Parse
and then set the path afterwards.
test/eventlistener_test.go
Outdated
// Wait for port forward to take effect | ||
time.Sleep(5 * time.Second) | ||
go func(stopChan chan struct{}, errChan chan error) { | ||
readyChan := make(chan struct{}, 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.
nit: move this below so that it's closer to where it's being used.
Make use of the portforward object instead of calling into kubectl via command line exec. This will remove the need for random sleep amount after running the kubectl until port forwarding is ready and make it more reliable.
1b01383
to
2b64df5
Compare
We don't have a clear rule on this. For larger PRs, I do one squash at the end, for smaller ones I just keep ammending and pushing. I don't think anyone would be upset either way 😄 |
/assign iancoffey |
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.
lgtm 👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom, iancoffey 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 |
/lgtm |
Changes
Make use of the portforward object instead of calling
into kubectl via command line exec.
This will remove the need for random sleep amount after
running the kubectl until port forwarding is ready and
make it more reliable.
Fixes #496
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.