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

Use portforwarder instead of kubectl command line #599

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

NavidZ
Copy link
Member

@NavidZ NavidZ commented Jun 8, 2020

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.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 8, 2020

CLA Check
The committers are authorized under a signed CLA.

@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 8, 2020
@tekton-robot
Copy link

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 /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/test-infra repository.

@NavidZ
Copy link
Member Author

NavidZ commented Jun 8, 2020

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.

@dibyom
Copy link
Member

dibyom commented Jun 8, 2020

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 8, 2020

config, err := clientcmd.BuildConfigFromFlags("", knativetest.Flags.Kubeconfig)
if err != nil {
panic(err)
Copy link
Member Author

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.

@NavidZ
Copy link
Member Author

NavidZ commented Jun 12, 2020

/assign wlynch

@NavidZ
Copy link
Member Author

NavidZ commented Jun 12, 2020

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jun 12, 2020
@NavidZ
Copy link
Member Author

NavidZ commented Jun 12, 2020

/kind flake

@tekton-robot tekton-robot added the kind/flake Categorizes issue or PR as related to a flakey test label Jun 12, 2020
}

path := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/portforward", namespace, podName)
hostIP := strings.TrimLeft(config.Host, "htps:/")
Copy link
Member

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:/?

Copy link
Member Author

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.

Copy link
Member

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.

@dibyom
Copy link
Member

dibyom commented Jun 15, 2020

Would you mind squashing up the commits? Thanks!

@NavidZ
Copy link
Member Author

NavidZ commented Jun 15, 2020

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.
So regarding doing this locally, is that alright to always do it? In other words do people in Tekton get upset if the history is lost between the comments in general (i.e. if I always just apply comments with a commit --am and force push it on this PR) or should I keep committing on top right until before merge and do one squash at the end?

}

path := fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/portforward", namespace, podName)
hostIP := strings.TrimLeft(config.Host, "htps:/")
Copy link
Member

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.

// 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)
Copy link
Member

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.
@NavidZ NavidZ force-pushed the improve-eventlistener_test branch from 1b01383 to 2b64df5 Compare June 15, 2020 16:29
@dibyom
Copy link
Member

dibyom commented Jun 15, 2020

So regarding doing this locally, is that alright to always do it? In other words do people in Tekton get upset if the history is lost between the comments in general (i.e. if I always just apply comments with a commit --am and force push it on this PR) or should I keep committing on top right until before merge and do one squash at the end?

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 😄

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 16, 2020
@NavidZ
Copy link
Member Author

NavidZ commented Jun 16, 2020

/assign iancoffey

Copy link
Member

@iancoffey iancoffey left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@tekton-robot
Copy link

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

@dibyom
Copy link
Member

dibyom commented Jun 16, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2020
@tekton-robot tekton-robot merged commit 9dcc13c into tektoncd:master Jun 16, 2020
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/flake Categorizes issue or PR as related to a flakey test lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PortForward in e2e test is brittle
5 participants