1190 Commits

Author SHA1 Message Date
Philippe Martin
285ddb31a6 Add more tests for odo dev on Podman (1) (#6496)
* WIP - test cases with composite commands

* WIP - refactor GetEnvVars

* wip : Add GetLabels interface method in component_interface

* WIP add GetLabels for cluster implementation

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* WIP add test for podman

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* WIP more test for podman

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* Fix podman tests with Exec (lost change?)

* Update tests/integration/cmd_dev_test.go

Co-authored-by: Parthvi Vala <pvala@redhat.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Co-authored-by: Armel Soro <asoro@redhat.com>
Co-authored-by: anandrkskd <anandrkskd@gmail.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
2023-01-17 16:13:21 -05:00
Philippe Martin
682e5176d2 [podman] show logs when command fails (#6481)
* Implement GetRunningPodFromSelector for podman

* Implement GetPodLogs for podman

* Same message in podman/cluster

* Integration tests

* Return stream of stdout/err
2023-01-16 10:52:07 -05:00
Armel Soro
da9a9efb8f Display a warning that "odo dev" on Podman needs to be restarted if the Devfile is changed (#6477)
* Display a warning that "odo dev" on Podman might need to be restarted when local changes are detected

The initial idea was to display such a warning only
when changes are detected in the Devfile,
which are not yet handled completely at this time.
But to take into account the manual synchronization case (where
there is no file watcher (and therefore no way to determine which
files have actually been modified)), a generic warning is being
displayed whenever the Podman-specific watch handler is called.

* Add integration test case

* fixup! Add integration test case

* amend! Display a warning that "odo dev" on Podman might need to be restarted when local changes are detected

Display a warning that "odo dev" on Podman might need to be restarted when the Devfile is modified

* fixup! Add integration test case

* Assert that no warning is displayed if the Devfile has not changed
2023-01-10 15:42:52 -05:00
Philippe Martin
020009b33c Compatibility with podman v3 (#6474)
* Use podman generate kube instead podman kube generate

* get env from exec -it env (to be continued)

* Fix podman test

* Export function to make validate tests pass

* review

* Check podman tests result

Co-authored-by: Parthvi Vala <pvala@redhat.com>
2023-01-09 08:32:31 -05:00
Philippe Martin
32ef20d894 Get binding information without cluster connection (#6432)
* Do not use restmapper to map resource->kind for application. Juct copy Kind and Resource to json output

* Fix panic when no kubeclient

* Fix panic when odo list binding with --name

* Fix integration tests with new output
2023-01-09 05:49:42 -05:00
Philippe Martin
d982a751d6 Make odo dev work if no endpoint is defined (#6472)
* odo dev works if no endpoint is defined

* Update tests/integration/cmd_dev_test.go

Co-authored-by: Armel Soro <armel@rm3l.org>

* Add log when no port to forward

Co-authored-by: Armel Soro <armel@rm3l.org>
2023-01-06 15:14:22 -05:00
Parthvi Vala
62f5131289 Automate Doc: Quickstart Guides (#6470)
* Automate quickstart guide doc

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* update with phmartin's change to fix pid related ouput and fix test name

Signed-off-by: Parthvi Vala <pvala@redhat.com>

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2023-01-06 11:32:54 -05:00
Anand Kumar Singh
edcd2c7e3d Adding Github Actions for podman testing (#6385)
* add ansible,bash scripts and documentation for podman testing

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* update documentation for automated podman testing

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* Fix: log fetching from vsi

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* add ssh fetch

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* test podman on Github Actions

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* remove podman on ibmcloud files

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* remove podman config check (to test edge case)

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* remove reporter, remove hardcoded component name

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* Update .github/workflows/podman-test.yaml

Co-authored-by: Armel Soro <armel@rm3l.org>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
2023-01-05 17:34:29 -05:00
Parthvi Vala
7c563b5de3 Doc Automation: Command Reference: odo init (#6442)
* Pilot work

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add more tests

* CompareDocOutput returns strings missing from cmdout and file

* Finish automating docs for odo init command reference

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Cleanup

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add make target for doc automation tests; create a separate folder for doc automation tests; add documentation for helper functions

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Attempt at fixing validation test

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix validation failures

* Rename ReplaceTimeInString to ReplaceAllTimeInString

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Replace all time strings with a static value for both cmd and mdx output

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add test suite for command reference tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix failing test and skip empty directory interactive test; add comment
for tests with specific check

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix make target

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* StripSpinner relies on statement to decide if it should strip the line or let it be

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add check for unicode spinner frames just in case it is present; it is flaky

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Make interactive tests work

* Make it pretty

* Update odo version

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2023-01-05 14:03:26 -05:00
Philippe Martin
ce8fdc1d5b Rename generic run-on flag into platform (#6445)
* Rename pkg/odo/commonflags/run_on.go to pkg/odo/commonflags/platform.go and change runOn to platform

* Rename feature

* Rename into pkg/odo/commonflags/context/

* Update comments

* Update doc

* fix comment

* Update integration tests

* Duplicate runningOn field with platform + deprecated runningOn

* Mark RunningOn as Deprecated

* Do not modify blog post

* Fix typo

* Add exception for SA1019

* odo describe component

* Fix integration tests for odo describe component
2023-01-03 13:51:51 -05:00
Armel Soro
6ed95b7e6f Make odo describe component show information about components running on Podman (#6431)
* Allow using the '--run-on' flag with 'odo describe component'

* Add "platform" to the ForwardedPort output

* Move RunningMode* structs to a dedicated file and add (tested) method for merging running modes

* Add RunningOn field to the Component API

* Make component#GetRunningModes able to return all modes for all specified platforms

* Do not display the namespace from NoComponentFoundError if no namespace is set

* Add more validation logic to the 'describe component' CLI

* Update 'odo describe component' logic for Devfile-based component

* Update 'odo describe component' logic for name-based component

This checks for the component with such name on all platforms.
If it finds several components on both platforms, it needs to extract
Devfile information from those resources.
To do so, it checks if the relevant labels (project type and name) are matching.
It errors out if they do not match, because this would imply that we
don't know what to display as Devfile information.

* Conditionally display "running on" information in human-readable output.

This is displayed only if the "run-on" feature is enabled.

* Implement GetAllResourcesFromSelector in the PodmanCli client

* Add more unit tests

* Update integration tests

* fixup! Update integration tests

* fixup! fixup! Update integration tests
2023-01-02 14:12:58 -05:00
Philippe Martin
451d8106da odo delete component on podman with --name (#6437)
* odo delete component with name

* Add unit test

* Add integration tests

* common printDevfileComponents

* fix name

* spinners + newlines

* Update info message with podman and/or cluster
2023-01-02 05:44:42 -05:00
Philippe Martin
4617cfdfff odo delete component deletes components running on podman (#6418)
* Make odo delete component work without kubeconfig

* Make odo delete component work when non auth

* Support run-on flag

* Do not delete cluster resources when running on podman

* No error when deleting component by name without cluster

* Refacto cleanup pod

* Add PodLs and KubeGenerate methods to pkg/podman

* List and delete Podman Pods

* Add integration tests

* Fix msg + when experimental is disabled

* Review (except UT)

* Add unit test

* restrict platforms earlier
2022-12-22 10:57:35 -05:00
Parthvi Vala
0d392ef5bd Allow fetching specific devfile stack version (#6429)
* Ask for stack version in the interactive mode; downloading still doesn't work as expected

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Download the versioned Devfile for interactive mode

* Download the versioned Devfile for flag mode

* Download the versioned Devfile for the alizer mode

* Add support for 'latest' stack

* Update init automation message with devfile-version

* Mark the default version in interactive mode

* Fix interactive tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add integration tests for odo init flag mode

* Fix unit and validation tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add to the documentation

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add information about the default version

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-12-21 09:14:40 -05:00
Armel Soro
46abd92226 Display a generic Experimental mode warning message when this mode is enabled (#6426)
* Display a generic Experimental mode warning message when this mode is enabled

This fixes the issue of having this warning displayed for a specific feature
that might not be used by the user.
Instead, we are now displaying a more generic and feature-agnostic warning
message once.

* Drop useless 'id' field in OdoFeature struct
2022-12-20 07:37:13 -05:00
Philippe Martin
4aad7ed3e9 Add more tests for Podman + write Component abstraction for integration tests (#6427)
* Abstraction for component + ExpectIsNotDeployed

* Change signature of RunDevMode, to support RunOnPodman option

* Add a test with Exec

* More tests with Exec/ GetEnvVars
2022-12-20 05:08:21 -05:00
Philippe Martin
6ed12871f9 Enable use of ImageStreams on OpenShift (#6406)
* Enable use of ImageStreams on OpenShift

* Add annotation in examples
2022-12-15 07:11:05 -05:00
Armel Soro
af911dd576 Fallback to interactive mode if there is no match from Alizer when initializing a component (#6410)
* Add integration tests highlighting the issue and setting the expectations

* Fallback to interactive questions if there is no match from Alizer when initializing a component

This applies to odo init, odo dev and odo deploy
2022-12-15 02:43:04 -05:00
Armel Soro
9f866985c0 Show Devfile Stack versions in "odo registry" output (#6397)
* Make the registry client collect and return all stack versions

* Call the '/v2index' endpoint first and fallback to the index endpoint when listing Stack versions

* Display the Stack versions in the 'odo registry' human-readable output

* For convenience, sort stack versions based on the semantic version

This allows seeing them in a meaningful order in both
human-readable and JSON outputs.

* Enrich unit tests for 'getRegistryStacks'

* Fill the "starterProjects" field for backward compatibility

Similar to the "version" field, this represents
the list of starter projects of the default Stack version.

* Update integration tests

* Update documentation
2022-12-09 11:50:38 -05:00
Anand Kumar Singh
3032ee3b10 creating namespace before to make sure its up before the test starts (#6391)
Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-12-09 09:49:16 -05:00
Philippe Martin
60732d871b Display a warning when connection to cluster fails (#6384)
* Display a warning when connection to cluster fails

* Fix json output

* Move tests with previous LabelNoCluster

* Add test for unauth
2022-12-09 09:23:47 -05:00
Philippe Martin
83cdda6960 Test with OpenShift cluster non authenticated (#6395)
* Test with OpenShift cluster non authenticated

* Add analyze commands

* Add same tests as with NoCluster

* Do not try to cleanup namespaces

* Assert non authenticated

* Change Makefile target name
2022-12-09 06:41:38 -05:00
Armel Soro
9815b60e78 Improve confirmation message for namespace/project deletion (#6383)
* Improve confirmation message for namespace/project deletion

* Update sample output in ´delete namespace/project' command reference

* Use oc binary instead of odo in DeleteNamespaceProject 'helper_oc' implementation

This way, we do not rely on some other odo command (odo delete project command) in unrelated tests

This also makes it more consistent with the implementation in 'helper_kubectl'
2022-12-07 12:10:47 -05:00
Parthvi Vala
a39931388e Add support for parsing multiple k8s definition in a single Devfile K8s component (#6372)
* Rename GetK8sManifestWithVariablesSubstituted to GetK8sManifestsWithVariablesSubstituted

* Add GetK8sComponentAsUnstructuredList; add support for multiple manifests in a single k8s component

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Use GetK8sComponentAsUnstructuredList in binding/remove.go

* Use GetK8sComponentAsUnstructuredList in component/component_test.go

* Use GetK8sComponentAsUnstructuredList in libdevfile/component_kubernetes_utils.go

* Use GetK8sComponentAsUnstructuredList in service/service.go

* Use GetK8sComponentAsUnstructuredList in devfile/adapters/kubernetes/component/adapter.go

* Add documentation for GetK8sComponentAsUnstructuredList and remove GetK8sComponentAsUnstructured

* Fix createOrUpdateServiceForComponent to fetch only the service created for the component

* Add integration test for odo deploy

* Add integration test for odo dev

* Attempt at fixing list/describe binding tests; fixes old mishap

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Check for empty list of binding

Signed-off-by: Parthvi Vala <pvala@redhat.com>

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-12-07 03:24:02 -05:00
Philippe Martin
0c008c6be9 odo list component shows components running on podman (#6366)
* Enable run-on flag

* List all components

* Select specific platform with --run-on flag

* Make podmanClient nil if no podman client is accessible

* integration test

* Delay the display of warnings related to experimental features

* Add logs displaying podman commands executed

* Use None when Running On is empty

* odo list
2022-12-06 11:01:56 -05:00
Anand Kumar Singh
3738ca8d65 updating bindable kind instance (#6363)
* updating bindable kind instance

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* update ansible yaml to use 1.18 for postgres operator

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-12-06 04:56:10 -05:00
Armel Soro
3c87ecdc8f Support Alizer-based automatic port detection with odo init interactive mode (#6365)
* Do not display "Port configuration using flag is currently not supported"

This is confusing to users.

* Display ports detected as part of the Alizer component detection logic

This is because we specifically need to display the ports
at the same moment when the language, project type and Devfile
are displayed to the end user (when source code is present)

* Update the loaded Devfile object with the application ports detected prior to asking for its customization

The case of multi-container components will be handled in [1].
Otherwise, the container component ports (all but the Debug ports) are replaced with the right application ports.

[1] https://github.com/redhat-developer/odo/issues/6264

* Add integration test case

* Add application ports detected to "odo analyze -o json" output

* Update documentation

* Add utility functions for helping handle Debug endpoints

* Make application ports detected appear first in the endpoint list

This allows such ports to be port-forwarded first, before the Debug ones.
2022-12-06 02:50:07 -05:00
Parthvi Vala
d6371a4306 Fix: Panic when running odo list namespaces without an active Kubernetes context (#6367)
* Fix: Panic when running odo list namespaces without an active Kubernetes context

* Add integration test for odo list namespaces

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add a new REMOVE_BINDING dependency to ensure remove binding command works even when cluster is inaccessible

* Revert REMOVE_BINDING change and use an alternate solution

Signed-off-by: Parthvi Vala <pvala@redhat.com>

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-12-05 08:34:04 -05:00
Anand Kumar Singh
843543adbc replacing timeout with time interval (#6369)
* replacing timeout with time interval

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* replacing timeout with time interval

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-12-04 10:28:30 -05:00
Philippe Martin
f8c16b4e02 Replca group by apiVersion in odo list services output (#6358) 2022-11-30 15:41:17 -05:00
Anand Kumar Singh
3e81c10c93 Run Devfile personalization in interactive mode from empty directory (#6351)
* run Devfile personilization from empty directory

run Devfile personilization in interactive mode from empty directory

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* updating e2e tests accordingly

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-11-30 13:22:34 -05:00
Philippe Martin
f079c3cd7a Sync files on Podman (#6348)
* Call WatchAndPush

* NoOpWatcher for Kube-related watchers + Move cleanup to dedicated method

* Set component state

* Call reconcile again when files changed

* Fix prompt message

* Integration test for podman/sync file

* More integration tests

* Move display of forwarded ports after application started
2022-11-30 11:43:07 -05:00
Armel Soro
70c5bd505b Fix flaky behavior with "list namespaces/projects" integration tests (#6355)
For some reason, "odo list namespaces/projects" would contain
the current test namespace, but the subsequent
"odo list namespaces/projects -o json" would no longer
contain this namespace.
2022-11-29 13:11:42 -05:00
Philippe Martin
35e3cc3edb Integration tests: Declare devfile volumes as ephemeral (#6356)
* Declare devfile volumes as ephemeral + run persistent volumes on Openshift only

* Disable e2e test on Kubernetes
2022-11-29 07:49:14 -05:00
Anand Kumar Singh
6172a16fc7 E2e scenario 3 (#6073)
* add e2e test for binding

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* fails on testing binding's

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* update e2e test

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* remove FIt

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* incorporate requested changes

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* incorporate requested changes

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* dont run go sec on example directory

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* fix flaky behaviour

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* fix flaky behaviour

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* nit: cleanup

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* Apply suggestions from code review

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
2022-11-25 12:45:26 -05:00
Anand Kumar Singh
c9875200ed Downloading wrong starter project when using odo init (#6346)
* fix: downloading wrong starter project when using odo init in interactive mode

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* test: odo init downloads correct devfile-starter

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-11-24 10:32:17 -05:00
Philippe Martin
120920f868 Integration tests for odo dev running on podman (#6332)
* Change signature of StartDevMode to use options structure

* Add tests for odo dev on podman

* Uncomment commented code

* Update Makefile

Co-authored-by: Armel Soro <armel@rm3l.org>

Co-authored-by: Armel Soro <armel@rm3l.org>
2022-11-24 08:24:00 -05:00
Philippe Martin
6147d1b1bb Disable test on Windows checking for output (#6341) 2022-11-24 04:29:56 -05:00
Armel Soro
d921a17821 Implement odo delete component --files to delete files generated by odo (#6255)
* Add utility functions allowing to report files generated by odo

The end goal is for 'odo delete component --files' to gather a list of
files that were initially generated by odo, so as to delete only those.
This way, we are less likely to delete the wrong files.

This list is collected in a '.odo/generated' file.

It will then be up to odo commands to call those methods
accordingly. For example, this is called:
- by odo init, odo dev, or odo deploy, when generating a new devfile.yaml
- by odo dev, when there is no .gitignore file and odo generated one

Note that it is quite impossible to cover all scenarios; for example,
if odo generates a new devfile.yaml file, but the user deletes it
manually and recreates it, 'odo delete component --files'
will still list it as a possible candidate for deletion
(because it would be listed in .odo/generated).

* Report files generated by commands like init, dev or deploy

* Implement 'odo delete component --files'

* Add integration tests for 'odo delete component --files'

* Document the `--files` flag

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

* Do not delete the .gitignore file

It is more likely to be modified by the user afterward (for another
usage).

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* fixup! Document the `--files` flag

* fixup! Implement 'odo delete component --files'

* Apply review suggestions on integration tests

Co-authored-by: Parthvi Vala <pvala@redhat.com>

* fixup! fixup! Document the `--files` flag

Co-authored-by: Philippe Martin <contact@elol.fr>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
2022-11-22 00:47:01 -05:00
Anand Kumar Singh
d099b2b6e0 check if bindable-kind instance is up before test (#6310)
Signed-off-by: anandrkskd <anandrkskd@gmail.com>

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-11-21 16:52:36 -05:00
Philippe Martin
4c30c8ef0c More tests without cluster (#6303)
* Run build-images command without cluster

* Test odo remove binding without cluster

* Make odo describe component work without cluster

* Tests: configure cluster depending on nocluster label

* Make odo list component work when --namespace is not used

* Test odo list component before deployment without cluster

* Some Generic tests

* Unset KUBERNETES_SERVICE_HOST to disable in-cluster config

* Set KUBECONFIG to empty file for no-cluster tests

* Run no-cluster tests on Windows

* Fix ListIngresses related changes

* Add warning/error when no cluster connection is available
2022-11-21 11:06:04 -05:00
Dharmit Shah
d1d7ccebbf Remove Dharmit from OWNERS files across the repo (#6320)
* Remove Dharmit from OWNERS files across the repo

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Remove Dharmit and Charlie from OWNERS

* Adds Tomas to owners

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
2022-11-21 06:57:14 -05:00
Parthvi Vala
4c1982a6a5 odo dev deletes remote resources not present in the Devfile (#6189)
* Add integration test

* odo dev deletes remote resources not present in the Devfile

* Delete the servicebinding secret without SBO

* Fix integration tests failure for when SBO is installed

* code Refactor

* Refactor the code

* Fix components_test.go

* add todos to integration tests

* Code review from feloy

* Move secret removal out of UnbindWithLibrary; rename deleteServiceBindingSecrets; add spinner end defer

* Attempt at making resource deletion concurrent

* Temp changes

* temp change

* Use errgroup wg to handle go routines

* Use single spinner for all the resources

* Fix validation failures

* Temp changes

* Optimize the code

* Optimize error messages; remove the unnecessary use of 'Kubernetes'
2022-11-18 15:24:51 -05:00
Parthvi Vala
ec503536b7 List Routes/Ingresses created by odo deploy in odo describe component (#6244)
* List routes/ingresses deployed by odo in the describe output

* Remove ListDyanmicResourcesFromSelector and use ListDyanmicResources instead by add a selector argument to it

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Update pkg/api/component.go

Co-authored-by: Armel Soro <armel@rm3l.org>

* Replace DyanmicClient for ingress with a kubeclient

* Show ing/route name if *.hosts is empty

* Change API format

* Ignore owned ing/routes

* Add devfile with default backend ingress

* Add tests for named describe command

* mock kclient

* Fix integration test failure

* Fix integration test failure with registry

* Add test for ingress with default backend

* Add unit test for ListRoutesAndIngresses

* Add documentation

* Fix circular dependency and test failures

* Update upstream docs

* Fix integration test and add unit test for owner reference

* DRY the unit test code

* Update pkg/component/component.go

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

* Use context to obtain app

* rm3l's review

Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
Co-authored-by: Philippe Martin <contact@elol.fr>
2022-11-18 16:22:06 +00:00
Dharmit Shah
cc4c661a3c Adds ability to list namespaces in JSON format (#6295)
* Adds ability to list namespaces in JSON format

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Tests without Expect

Using `Expect` directly or through something that uses it under the hood
is a problem when using `Eventually`. In normal case, a failure in
matching test condition behaves like `continue` and `Evnetually` keeps
trying again till timeout is reached. But `Expect` changes that
behaviour to be like `break` and doesn't keep testing repeatedly as we
would like it to.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* UI fixes when there's no project on cluster

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Adds an import to fix unit tests

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* More JSON specific checks

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Consistent JSON output for namespaces

JSON output for components, bindings and services when odo can't find
any of these resources is simply a `{}`. This commit makes output of
`odo list namespaces -o json` consistent with that of these commands.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Add doc for namespaces JSON output

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Test if some other namespace is marked as active: false

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
2022-11-17 20:51:38 +00:00
Philippe Martin
712254ae66 Centralize environment configuration (#6293)
* Define central config

* Use envConfig in GenericRun for segment parameters

* Pass the env config into the context passed to CLI methods

* Use PodmanCmd and DockerCmd from context

* Remove tests now that ODO_DISABLE_TELEMETRY is checked for a bool value

* deploy.Deploy: Use values from ctx instead of parameters + use FS from DI

* dev.Start: Use values from ctx instead of parameters

* image.Build*: Use values from ctx instead of parameters

* Use telemetry file from context

* Pass ctx to segment.getTelemetryForDevfileRegistry

* Use ctx in getTelemetryForDevfileRegistry

* Call IsTelemetryEnabled once and use scontext.GetTelemetryStatus after

* Fix unit tests

* Use envConfig in segment.IsTelemetryEnabled

* Define TelemetryCaller constant in test helper

* IsTrackingConsentEnabled: get value from envconfig instead of env

* Use ctx instead of GLOBALODOCONFIG

* Place ODO_EXPERIMENTAL_MODE in configuration

* Use maintained envconfig package

* Define default values when exist

* Document accepted boolean values
2022-11-17 17:57:34 +00:00
Armel Soro
0b7de6631e Sanitize value for 'app.openshift.io/runtime' label (#6284)
* Add test cases highlighting the issue

* Sanitize value for 'app.openshift.io/runtime' label

* Lowercase value of 'app.openshift.io/runtime' label after sanitization

As suggested in review, this is to follow what's done by OpenShift console;
it is always lowercase when added by OpenShift Console.

Co-authored-by: Tomas Kral <tkral@redhat.com>

Co-authored-by: Tomas Kral <tkral@redhat.com>
2022-11-14 18:04:47 +00:00
Armel Soro
a811cc1bd0 Add support for an experimental mode (#6300)
* Add support for an experimental mode at the CLI level

This is backed by an "ODO_EXPERIMENTAL_MODE" environment variable.

* Mark the generic '--run-on' flag as experimental

Besides being hidden, it will error out as invalid flag
if the ODO_EXPERIMENTAL_MODE env var is not set to 'true'.

* Add integration test cases

* Document the experimental mode.

* fixup! Add support for an experimental mode at the CLI level

* fixup! Mark the generic '--run-on' flag as experimental
2022-11-14 12:11:50 +00:00
Dharmit Shah
f062c11a11 Update odo to use go 1.18 (#6166)
* Update odo to use go 1.18

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Update golangci-lint version in Makefile

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Use go 1.18, not go 1.19

Erroneously I had used go 1.19 at various places.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Rearrange imports; fix golangci-lint errors

Fixed a bunch of golangci-lint errors like below:

`File is not `gofmt`-ed with `-s``

using the command: `golangci-lint run --fix`

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Use go install instead of go get

This is because with go 1.18, `go get` behaves as `go get -d` by
default. Which means that it will only download, but not install.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
2022-11-09 05:31:38 -05:00
Dharmit Shah
0d4f5f741c Change expecations to match reality (#6292)
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
2022-11-08 05:50:32 -05:00