Implements port forwarding for odo dev (#5526)

* First pass of port-forward for odo dev

* Supports forwarding multiple ports/endpoints

* Change message wording

* Port forwarding happens port 40001 onward

* Organize the code

* Integration tests

* Update the CLI help message

* Catch and check err

* Changes for failing unit tests

* Fix test and add newline to a message

* Remote label and use for loop

* Adds TODO to cleanup when port-forwarding fails

* Change messaging printed on the CLI

* Break Start method into multiple methods

* Set debug port while creating push parameters in dev

* Test after making a change to a file in pwd

* Refactoring to put things where they should be

* Notify user to run odo dev again if endpoints change

* Unit tests and rebase mistakes

* Add newline character for clear formatting

* Create business logic for reuse to find endpoints

* Fix unit and integration test failures

* Self review

* Changes based on Philippe's review

* Two more changes based on Philippe's review

* More changes based on PR review

* Changes based on PR feedback and more

- Renames all receivers in kclient package to `c`
- Adds mocks

* Removes unnecessary function

* Make function more generic for reuse

* Rename Options to DevOptions

* Address review comments by Tomas

* Fix failing unit test

* Modify message to restart odo dev

* Use helper.RunDevMode in odo dev tests

* Remove doubly imported log package

* Modifies clientset at CLI and business layer

- No need of KUBERNETES client for `odo dev` business layer.
- Added KUBERNETES client for `odo dev` CLI layer.

* Remove hardcoding of URL in tests

- It uses @feloy's work in PR #5570.

* Uses regexp to find strings.

* Makes FindAllMatchingStrings more generally usable

* Adds constant for localhost regex

* Replace matches with urls and remove unnecessary Sprintf

* Documents what urls is in RunDevMode function.

* Update tests/helper/helper_dev.go

Co-authored-by: Philippe Martin <contact@elol.fr>

* Update tests/helper/helper_dev.go

Co-authored-by: Philippe Martin <contact@elol.fr>

* Update tests/helper/helper_dev.go

Co-authored-by: Philippe Martin <contact@elol.fr>

* Update tests/helper/helper_dev.go

Co-authored-by: Philippe Martin <contact@elol.fr>

Co-authored-by: Philippe Martin <contact@elol.fr>
This commit is contained in:
Dharmit Shah
2022-03-25 19:44:13 +05:30
committed by GitHub
parent 80d7cfde30
commit 0396b435c3
26 changed files with 1442 additions and 148 deletions

View File

@@ -70,3 +70,7 @@ mockgen -source=pkg/watch/interface.go \
mockgen -source=pkg/component/delete/interface.go \
-package delete \
-destination pkg/component/delete/mock.go
mockgen -source=pkg/dev/interface.go \
-package dev \
-destination pkg/dev/mock.go