15 Commits

Author SHA1 Message Date
Philippe Martin
67272fd81d Remove localconfigLocalConfigProvider abstraction (#6285)
* Remove localconfigLocalConfigProvider abstraction

* Remove LocalConfigProvider interface

* Move LocalStorage to pkg/storage (with ListStorage)
2022-11-16 12:33:29 +00:00
Philippe Martin
0a83f1d899 Do not use env.yaml file anymore (#6057)
* Remove GetApplication from LocalConfigProvider interface and all related stuff

* Remove GetName from LocalConfigProvider interface and all related stuff

* Remove GetContainers from LocalConfigProvider interface

* Remove Exists method from LocalConfigProvider interface and stop odo dev writing env.yaml file

* Remove GetDebugort method from LocalConfigProvider interface + fix #6056

* Remove unnecessary fields from EnvInfo structure

* Remove all references to env.yaml file

* Review

* Test for #6056
2022-08-29 09:25:09 -04:00
Philippe Martin
1ef9f5c09f Do not get project from env.yaml file (#6025)
* Do not read env.yaml file to get project

* Integration tests

* Remove GetNamespace() from interface to be sure to never call it

* Do not set project in env.yaml file for odo deploy

* Do not set project in dev.yaml file for odo deploy and dont expect it for delete component and build-images commands

* Remove project from env.yaml on dev cleanup

* - Message previously returned when no env.yaml file is now returned by NoDevfileError
- Return NoDevfileError when odo dev/deploy is started from empty directory

* Remove unnecessary params

* Add tests to test env.yaml with a non current project

* Fix noDevfileError when command does not specify componentContext

* Update messages and doc for `odo set namespace`

* Reverts part of c384f547cf
2022-08-22 09:05:27 +00:00
Armel Soro
2132cb516f [#5561] Remove odo url (#5571)
* Remove `odo url` from CLI layer

* Adapt tests

* Adapt test from deleted `cmd_devfile_delete_test.go`

This test still makes sense, as it tests the removal
of URL-related resources, like Services and Ingresses.

* Remove call to `odo project set ...` in test, as suggested in review

This command will get removed in the near future.

* Remove places where URL manipulation could modify  Devfiles

Also remove dead code

* Remove unused `updateURL` field from EnvInfo struct

* Adapt test by mimicking some behavior that `odo url create` used to perform

`odo url` used to modify the `env.yaml` file,
and `odo dev` currently creates Kubernetes/OCP resources related to URLs.

We may remove this test later on if `odo dev`
no longer needs to create such Ingresses and Routes.

* Remove all places where URLs, Ingresses and Routes are manipulated

* Port test in cmd_dev_test instead and make sure no Ingress/Route is created

* Remove no-longer `test-cmd-devfile-url` target from Makefile

The corresponding test file has been deleted.

* Remove `create url` command reference from V3 docs, as suggested in review

* Use existing `devfile-with-multiple-endpoints.yaml` Devfile  in test, as suggested in review
2022-03-28 16:39:53 +02:00
Philippe Martin
e4a65e81ed Cleanup more functions not used after removing old v2 commands (#5447)
* Remove service.FindDevfileServiceBinding

* Remove IsOperatorServiceNameValid

* Remove MapFromParameters

* Remove OperatorSvcExists

* Remove AddKubernetesComponentToDevfile

* Remove AddKubernetesComponent

* Remove DeleteKubernetesComponentFromDevfile

* Remove from kclient/operators.go

* Remove unused functions from pkg/service

* Remove Storage methods from LocalConfigProvider

* Remove unused from pkg/envinfo

* Cleanup util packages

* Remove unused code with the help of staticcheck --unused.whole-program=true -- ./...
2022-02-10 12:10:00 -05:00
Philippe Martin
47f66a5c9e Handle ephemeral field on Volumes (#5279)
* Handle ephemeral field on Volumes

* Ephemeral flag

* Fix completion handler

* Add unit tests

* Refactor GetVolumeInfos

* Set size of emptyDir volume

* Adds some documentation

* Integration tests

* Fix typo

* Complete unit test

* Review
2021-12-20 12:06:27 +01:00
Philippe Martin
4947ec6fa7 Refactor genericclioptions.Context (#5198)
* Make context.project immutable

* Make context.application immutable

* Make context.outputFlag immutable

* Make context.ComponentContext immutable + dont store command

* Doc + kclient/occlient

* Refactor New*

* More refactoring

* Remove DevfilePath parameter

* genericclioptions.NewCreateParameters

* private consts

* Refactor use of context

* Make CreateParameters exported

* Refactor build-images

* Remove SetComponentcontext

* resolveProjectAndNamespace

* temp fix

* Rename RequireRouteAvailability
2021-11-17 10:51:37 +01:00
Philippe Martin
99484663b7 Use interface for kclient (#5065)
* Use interface for kclient

* Fix + add mocks

* Add mockgen script

* remove unused param + add unit test

* fix rebase
2021-09-27 03:51:12 -04:00
Mohammed Ahmed
62a3350314 Adding container based filtering for get ports (#4732)
* Adding container based filtering for get ports

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding Unit tests

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Addressing comments by @feloy

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing missed changes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding some function comments

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating package name in comment

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Going for older impl with slight updates

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Update containerExists setter outside endpoint loop

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding back sort

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Readjusting related test based on sort

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing debug stmt

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* iMoving portMap to just before it is used

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing typo

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing error message

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing error msg to match test

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Making match more generic instead of exact string

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding a portOf variable to make err dynamic

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving to specifying function

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating as per comments from @mrdas

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixed container name

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
2021-05-24 14:13:26 +02:00
Mohammed Ahmed
2a0cb0dafd Adding container flag for storage and fixing code to work with it (#4595)
* Adding container flag for storage and fixing code to work with it

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving the patherror check to after the for loop

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing gofmt errors

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding devfile with multiple containers

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding test for --container command

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing --context flag in test

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Ensuring that volume mount to specific container is actually happening

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding missing arg to odo push

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding docs for storage with contaner

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing code after rebase

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing gofmt errors

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding mount sources to multi container devfile

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding check for specified container exists in storage create

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding `this storage to comment`

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing usage of container flag

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing spelling of storage in doc

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Return error if volume already exists

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing `GetStorageMountPath`

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding storage delete check

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing nodejs devfile with multiple containers

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating test to use springboot devfile

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing volume spelling

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unneeded logic as per comments

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Check if a container exists, only if container is specified

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Gramatical fixup

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Simplifying logic for validate storage

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing delete for storage on containers other than 1st one

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving test to previous suite

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
2021-04-20 22:03:54 -04:00
Dharmit Shah
1f49f7c7fd Removes docker related code (#4634)
* Removes docker related code

* Remove pushtarget tests from unit tests

* Makes `go vet` happy

* Makes `wwhrd check -q` happy

* Removes docker url code

* Removes docker tests
2021-04-19 01:51:50 -04:00
Mrinal Das
dd2713915f Updates the library to the latest version (#4446)
* Updates the library to the latest version

* Updates example devfile for integration tests

* Removes tests using ExecMultipleDefaultsWithFlags()
2021-02-22 14:51:41 -05:00
Mrinal Das
88fb37203d Refactors storage List() to use Storage Client. It also adds ListFromCluster() to get storage from the cluster. (#4395) 2021-02-03 04:25:23 -05:00
Mrinal Das
741f1dd9b3 Refactors storage code for localConfigProvider. (#4344)
* Refactors storage code for localConfigProvider.

* Fixes and improves storage create CLI code
2021-01-27 14:43:00 +01:00
Mrinal Das
526ce0af8c Refactors URL for localConfigProvider. (#4311)
* Refactors URL for localConfigProvider. The CLI layer code for url create and delete are refactored to use the new changes.

It also moves the localConfigProvider to a new package.

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Fixes Complete() and Validate() code in envinfo.go and also adds comments.

* Renames URLCreateOptions and URLDeleteOptions to CreateOptions and DeleteOptions.

Also simplifies the logic during context creation and fixes the comment for the LocalConfigProvider interface.
2021-01-04 10:25:42 +01:00