Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

odo link and odo unlink write to devfile without deploying to cluster#4819

Merged
openshift-merge-robot merged 15 commits into
redhat-developer:mainfrom
feloy:feature-4208/odo-link
Jul 1, 2021
Merged

odo link and odo unlink write to devfile without deploying to cluster#4819
openshift-merge-robot merged 15 commits into
redhat-developer:mainfrom
feloy:feature-4208/odo-link

Conversation

@feloy
Copy link
Copy Markdown
Contributor

@feloy feloy commented Jun 16, 2021

What type of PR is this?

/kind feature

What does this PR do / why we need it:

  • odo link stores link info in devfile
  • odo link does not create sbr
  • odo link fails if link with same name already exists
  • odo unlink removes link info from devfile
  • odo push creates sbr and makes the container run correctly
  • odo push deletes sbr and makes the container run correctly
  • set owner references on Kubernetes inlined resources
  • possibility to create link to a non deployed service

Which issue(s) this PR fixes:

Fixes #4208
Fixes #4750
Fixes #4768

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

  • Update changelog

  • I have read the test guidelines

How to test changes / Special notes to the reviewer:

@openshift-ci openshift-ci Bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Jun 16, 2021
Comment thread pkg/odo/cli/component/common_link.go Outdated
@feloy feloy changed the title Feature 4208/odo link [WIP] Feature 4208/odo link Jun 17, 2021
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jun 17, 2021
@feloy feloy force-pushed the feature-4208/odo-link branch 3 times, most recently from 2449b9e to 877186b Compare June 17, 2021 14:37
@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jun 18, 2021

/test v4.7-integration-e2e

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 19, 2021
@feloy feloy force-pushed the feature-4208/odo-link branch 2 times, most recently from f8ed8dd to c68988a Compare June 22, 2021 11:36
@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jun 22, 2021

/test psi-kubernetes-integration-e2e

@feloy feloy force-pushed the feature-4208/odo-link branch from c6a6f2e to 34e04ef Compare June 22, 2021 13:36
@feloy feloy removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 22, 2021
@feloy feloy changed the title [WIP] Feature 4208/odo link Feature 4208/odo link Jun 22, 2021
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jun 22, 2021
Copy link
Copy Markdown
Member

@dharmit dharmit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@feloy thanks for this PR! An amazing result of this PR is that it takes a devfile with component, service and link information and doing odo push creates it all on the cluster. It's an experience that we had been talking about achieving since a LONG time!

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 22, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharmit

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Jun 22, 2021
})
}

list := helper.CmdShouldPass("odo", "catalog", "list", "services")
Copy link
Copy Markdown
Contributor

@anandrkskd anandrkskd Jun 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the new runner functions in tests.
Functions mentioned in this PR will remove be removed.
I would request you to use those instead of the old ones.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feloy can you also make changes mentioned in this comment. This PR will remove the older cmd helper functions.
Thanks

@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jun 22, 2021

/test psi-kubernetes-integration-e2e

Comment on lines +74 to +84
When("a link is created between the component and the service", func() {

BeforeEach(func() {
helper.CmdShouldPass("odo", "link", svcFullName)
})

When("odo push is executed", func() {
BeforeEach(func() {
helper.CmdShouldPass("odo", "push")
oc.PodsShouldBeRunning(commonVar.Project, componentName+`-app-.[a-z0-9-]*`)
})
Copy link
Copy Markdown
Contributor

@anandrkskd anandrkskd Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feloy why are we separating odo link and odo push in two when do we want to add a test in between these two scenario?

Can we use this instead? (asking this because I see only one test case getting tested under two layer of when)

When("a link is created between the component and the service and odo push is executed", func() {
				BeforeEach(func() {
					helper.CmdShouldPass("odo", "link", svcFullName)
					helper.CmdShouldPass("odo", "push")
					oc.PodsShouldBeRunning(commonVar.Project, componentName+`-app-.[a-z0-9-]*`)
				})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, no problem, we can use your version, as there is no test between the two steps.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@feloy feloy force-pushed the feature-4208/odo-link branch from 6461a96 to ec91a51 Compare June 23, 2021 06:58
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 23, 2021
@feloy feloy force-pushed the feature-4208/odo-link branch from 5677500 to 4be820c Compare June 23, 2021 07:54
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 23, 2021
@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jun 23, 2021

/test psi-kubernetes-integration-e2e

@feloy feloy force-pushed the feature-4208/odo-link branch from 4be820c to 12fed53 Compare June 23, 2021 09:35
@feloy feloy force-pushed the feature-4208/odo-link branch from 5cac471 to f8592f0 Compare June 30, 2021 07:23
@valaparthvi
Copy link
Copy Markdown
Contributor

@feloy I noticed a funny thing with odo describe.
When 2 odo services are linked to it, and one of them is linked along with --bind-as-files, it doesn't show up in odo describe.

Steps to reproduce -

  1. odo create nodejs frontend --starter
  2. odo push
  3. odo service create etcdoperator.v0.9.4-clusterwide/EtcdCluster
  4. odo push
  5. odo link EtcdCluster/etcdcluster
  6. odo push
  7. odo service create postgresql-operator.v0.1.1/Backup
  8. odo push
  9. odo link Backup/backup --bind-as-files
  10. odo push
  11. odo describe

I have tried this a few times and was always able to reproduce, can you check it once?

@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jun 30, 2021

@feloy I noticed a funny thing with odo describe.
When 2 odo services are linked to it, and one of them is linked along with --bind-as-files, it doesn't show up in odo describe.

Steps to reproduce -

  1. odo create nodejs frontend --starter
  2. odo push
  3. odo service create etcdoperator.v0.9.4-clusterwide/EtcdCluster
  4. odo push
  5. odo link EtcdCluster/etcdcluster
  6. odo push
  7. odo service create postgresql-operator.v0.1.1/Backup
  8. odo push
  9. odo link Backup/backup --bind-as-files
  10. odo push
  11. odo describe

I have tried this a few times and was always able to reproduce, can you check it once?

odo describe as I demoed you this morning is not implemented in this PR but in the other one (based on this one): #4856

@valaparthvi
Copy link
Copy Markdown
Contributor

odo describe as I demoed you this morning is not implemented in this PR but in the other one (based on this one): #4856

Ah okay. Apart from it being dependent on this PR, is it ready for testing or still a WIP?

@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jun 30, 2021

/test psi-kubernetes-integration-e2e

1 similar comment
@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jul 1, 2021

/test psi-kubernetes-integration-e2e

Copy link
Copy Markdown
Contributor

@mik-dass mik-dass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jul 1, 2021
@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jul 1, 2021

[kubectl] The connection to the server -IP REDACTED-:8443 was refused - did you specify the right host or port?

/test psi-kubernetes-integration-e2e

@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Jul 1, 2021

Flaky test
[Fail] odo devfile push command tests verify command executions when default build and run commands are defined [It] should execute correct commands

/test v4.7-integration-e2e

@openshift-bot
Copy link
Copy Markdown

/retest

Please review the full test history for this PR and help us cut down flakes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.

Projects

None yet

7 participants