Commit Graph

7 Commits

Author SHA1 Message Date
Armel Soro
5660093167 Use go-cmp instead of reflect.DeepEqual to compare unit test results (#6343) 2022-11-24 07:24:32 -05:00
Philippe Martin
a2345c35c3 Build context as part of GenericRun (#6202)
* Remove non existing --project flag

* do not set the namespace as it is already the set one

* Use ctx to pass namespace

* Remove KClient from old context

* Pass appname through Context

* Remove unnecessary ctx builders

* Remove unused LocalConfigProvider from old context

* Move DevfileObj outside of Context EnvSpecificInfo

* Move DevfilePath outside of Context EnvSpecificInfoD

* Remove unused componentContext from old context

* Remove context flag

* Pre-run Init in a generic way

* Pass working directory in context

* Get Devfile and pass it in ctx, and use it for odo dev

* add binding: use new context

* build-images: use new context

* create namespace: use new context

* list namespace: use new context

* set namespace: use new context

* delete namespace: use new context

* delete component: use new context

* deploy: use new context

* describe binding: use new context

* list binding: use new context

* remove binding: use new context

* describe component: use new context

* list component: use new context

* list: use new context

* list services: use new context

* logout: use new context

* logs: use new context

* Remove old context code

* Some refactoring to avoid passing ctx when building it
to avoid complex dependency management during this building

* More doc on context.Get* functions
2022-10-19 05:38:18 -04:00
Philippe Martin
9e39df37d3 Use map for runningIn instead of array in JSON output (#6094)
* Use map for runningIn instead of array

* Set false entries in runningIn map

* Rename RunningModeList to RunningModes + fix doc

* Fix integration test
2022-09-06 18:55:19 +02:00
Armel Soro
7bd4d25de6 Allow binding to services from other namespaces (#5936)
* Allow Dynamic Client to list dynamic resources from a specified namespace

If the namespace specified is empty, it works as before
by returning resources from the current namespace.

Listing dynamic resources is used
when listing service binding instances.

* Allow users to select a namespace from which Service Binding Instances are retrieved

For consistency, this supports both interactive and non-interactive modes.
Non-interactive mode is supported via a '--service-namespace' flag.
As before, if this namespace is not specified, we default
to using the current namespace.

This also handles permission errors that might occur while listing namespaces/projects.
On Openshift, listing projects returns all the projects a user
effectively has access to, but this does not behave the same way
in vanilla K8s clusters. If user is allowed to list namespaces/projects,
the list returned is not filtered by any ACL filter [1].

In the case a user is not allowed to list namespaces/projects,
rather than returning an error, we are prompting them to manually
enter a different namespace (or nothing to use the current one).

[1] https://github.com/kubernetes/kubernetes/issues/48537

* Make the "No bindable service instances found" error message more explicit by mentioning the namespace

* Add namespace information to service (with or without Devfile)

* Add namespace information to 'list binding' and 'describe binding' output

* Check SBO availability before user is asked questions
2022-07-21 18:44:05 +02:00
Armel Soro
2ae27e9dcd Allow setting namingStrategy when using odo add binding (#5912)
* Add integration test for setting naming strategy non-interactively

* Add ability to set `namingStrategy` via `odo add binding`

For consistency, this supports both interactive and non-interactive modes.

More details about Service Binding naming strategies in [1].

[1] https://docs.openshift.com/container-platform/4.10/applications/connecting_applications_to_services/binding-workloads-using-sbo.html#sbo-naming-strategies_binding-workloads-using-sbo

* Update documentation

* Add information about the naming strategy to `odo describe binding`

* Test that naming strategy is part (or not) of `odo list binding` JSON output
2022-07-12 13:04:03 +00:00
Philippe Martin
d74a1a8b81 odo add binding without devfile.yaml (#5858)
* Set Kind in servicebinding instead or Resource

* odo add binding without Devfile

* Force select at least one operation option

* Change message for selecting operations

* Add Go back when selecting resource name for waorkload

* Doc

* Enable interactive binding tests for Kubernetes

* Add integration tests

* Validate and Test workload flag

* Fix doc about workload flag

* Apply suggestions from code review

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

* Review

* Fix interactive test

Co-authored-by: Parthvi Vala <pvala@redhat.com>
2022-06-24 13:01:40 +00:00
Philippe Martin
87c8d2c72b odo list binding (#5823)
* CLI

* odo level with devfile only

* List from cluster

* Add running mode

* Doc + Integration tests + command works without Devfile

* Fix context.New / tests

* Human readable output

* Add namespace to human readable output

* Integration tests for human readable output

* Add doc

* Mutualize code for output table

* Refaactor + test ListAllBindings

* Move api functions to kclient

* Apply suggestions from code review

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

* Fix want1

* Review

Co-authored-by: Armel Soro <armel@rm3l.org>
2022-06-21 08:43:59 +00:00