-
Notifications
You must be signed in to change notification settings - Fork 243
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
Adds mapping support to odo link #5237
Conversation
✔️ Deploy Preview for odo-docusaurus-preview canceled. 🔨 Explore the source changes: 6b1a7dc 🔍 Inspect the deploy log: https://app.netlify.com/sites/odo-docusaurus-preview/deploys/61a8be2cd5f3150007dca9fa |
Another reason being that there are certain breaking changes which were taking longer to figure out. Refer discussion in this thread on Kubernetes Slack for more context. |
sidebar_position: 4 | ||
--- | ||
|
||
`odo link` command helps link an odo component to an Operator backed service or another odo component. It does this by using [Service Binding Operator](https://github.com/redhat-developer/service-binding-operator). At the time of writing this, odo makes use of the Service Binding library and not the Operator itself to achieve the desired functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation is very detailed, and based on the quickstart project: I think it would be better to place it in the Using odo section, and have a more concise and generic doc as reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, while writing this, I had the thought of putting a concise form of it in the "Using odo" section. But can we do it separately?
Also, I think only this doc in "Command Reference" is based on Quickstart project. Which is not good. But I couldn't think of a better way to convey the point. Do you have any other idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see your point now. You are suggesting to add this document to the "Using odo" section. And in this section, we keep a concise document.
We will have to add the bits for linking backend and frontend component in that case. And also figure out what to keep in what doc. Doable. Let's do it.
I'm having some issues with keys referencing another types like for example
But I might be doing something wrong, or it might need newer SB version. /approve |
@dharmit I'm not sure that removing the We can see the same thing in the integration tests: some tests are checking that the name of some file does not contain |
@feloy yeah, it's pretty annoying state that we are in right now. At the moment, the tests are failing (I'm checking locally as well against CRC) and here's the error message # from component directory of component A, link the component B
$ odo link compB
$ odo push
$ odo unlink compB
# try to unlink again
$ odo unlink compB
✗ failed to unlink the component "compB-app" since no link was found in the configuration referring this component Expected error message is: $ odo unlink compB
✗ failed to unlink the component "compB" since no link was found in the configuration referring this component Now that we have modified |
One way to handle this better could be to introduce an element in the |
/test psi-kubernetes-integration-e2e |
/lgtm |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
7 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
- Sticking to SBO library v0.9.0 because the feature can be implemented using it just fine. - Docs doesn't cover `--bind-as-files`. I would prefer to keep it in a separate PR. - Added `id` field to the ServiceBinding resource created by odo and it defaults to same name as that of service's. No option to change the `id` itself. - Removed a hyphen from the `redis.yaml` file because it caused `odo push` for a link using the `--map` flag to fail due to it.
Although the error raised talks only about the requirement to have Operator Hub for linking services, I observed this error when doing `odo unlink`. However, since odo supports creation/deletion of links using Service Binding library and shouldn't really need Operator Hub installed to do that operation, I removed this check.
SplitN helps split string into specific number of parts. Using it would help support parameters that have `=` in their value.
This hack is required because we moved a bunch of code for creation of the service binding resource (`o.serviceBinding`) from `validate` function to `complete` function. As a result, if the target is not an Operator backed service, `o.serviceName` is being set to the name of the Kubernetes Service of a component which is of the form `<component-name>-<application-name>`. This hack is not done to fix something pointed by the tests. I observed that the filename of the file created under `kubernetes/` directory changed from `odo-service-frontend-backend.yaml` to `odo-service-frontend-backend-app.yaml`. This hack removes the `app` part in the name.
Removes the "ugly" hack added in a previous commit and basis the error message for 'unlink' operation on whether the user is trying to unlink from a service or a component.
SSSSSSSSSSSSSSSSSSSSSSSSSSSS
Ran 19 of 48 Specs in 1394.911 seconds
SUCCESS! -- 19 Passed | 0 Failed | 0 Pending | 29 Skipped
PASS | FOCUSED
Ginkgo ran 1 suite in 23m19.346800807s
Test Suite Passed
Detected Programmatic Focus - setting exit status to 197
$ git diff --unified=0
diff --git a/tests/integration/cmd_link_unlink_test.go b/tests/integration/cmd_link_unlink_test.go
index a34b853e2..f01afceba 100644
--- a/tests/integration/cmd_link_unlink_test.go
+++ b/tests/integration/cmd_link_unlink_test.go
@@ -87 +87 @@ var _ = Describe("odo link and unlink command tests", func() {
- When("a link is created between the two components", func() {
+ FWhen("a link is created between the two components", func() {
@@ -157 +157 @@ var _ = Describe("odo link and unlink command tests", func() {
- When("a link is created between the two components with --bind-as-files", func() {
+ FWhen("a link is created between the two components with --bind-as-files", func() {
|
Amending to re-trigger the tests
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel 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 |
/lgtm |
|
/test psi-kubernetes-integration-e2e
|
/test psi-kubernetes-integration-e2e
|
/test psi-kubernetes-integration-e2e Tests timed out after 4h! 🤯
|
using it just fine.
Docs doesn't cover--bind-as-files
. I would prefer to keep it in aseparate PR.
--bind-as-files
docs e8dfa50.id
field to the ServiceBinding resource created by odo and itdefaults to same name as that of service's. No option to change the
id
itself.redis.yaml
file because it causedodo push
for a link using the--map
flag to fail due to it.What type of PR is this?
/kind feature
What does this PR do / why we need it:
$subject. We need it for the users to be able to inject custom binding data while linking
Which issue(s) this PR fixes:
Fixes #4937
PR acceptance criteria:
Unit test
Integration test
Documentation
I have read the test guidelines
How to test changes / Special notes to the reviewer:
Considering the backend component and postgres service from odo quickstart guide, try linking using: