Skip to content
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

odo describe binding #5773

Conversation

feloy
Copy link
Contributor

@feloy feloy commented May 30, 2022

What type of PR is this:

/kind feature

What does this PR do / why we need it:

Which issue(s) this PR fixes:

Fixes #5659

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

@netlify
Copy link

netlify bot commented May 30, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit ec92333
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/6299efe72dd4fb0008d4578b

@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 May 30, 2022
@feloy feloy changed the title odo describe binding [wip] odo describe binding May 30, 2022
@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 May 30, 2022
@openshift-ci openshift-ci bot requested review from dharmit and rm3l May 30, 2022 06:48
@odo-robot
Copy link

odo-robot bot commented May 30, 2022

Unit Tests on commit 92603c9 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented May 30, 2022

Kubernetes Tests on commit 92603c9 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented May 30, 2022

Windows Tests (OCP) on commit 92603c9 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented May 30, 2022

OpenShift Tests on commit 92603c9 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented May 30, 2022

Validate Tests on commit 92603c9 finished successfully.
View logs: TXT HTML

@feloy feloy force-pushed the feature-5659/describe-binding branch 5 times, most recently from 07ee170 to 465ab4d Compare May 30, 2022 15:09
@feloy feloy changed the title [wip] odo describe binding odo describe binding May 30, 2022
@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 May 30, 2022
@feloy feloy force-pushed the feature-5659/describe-binding branch from 465ab4d to 7ad8b3a Compare May 30, 2022 15:22
pkg/odo/cli/describe/binding.go Outdated Show resolved Hide resolved
pkg/odo/cli/describe/binding.go Outdated Show resolved Hide resolved
pkg/odo/cli/describe/binding.go Outdated Show resolved Hide resolved
pkg/binding/binding.go Show resolved Hide resolved
pkg/binding/binding.go Show resolved Hide resolved
@kadel
Copy link
Member

kadel commented Jun 1, 2022

did some basic testing and this looks great.

👍 ❤️ for adding documentation.

I would maybe add just one small thing.

When a user runs odo describe binding in a directory with devfile for which odo dev is not running odo should probably provide some hint why is that.
Currently, it shows only

...
...
...
Available binding information: unknown

We could add a note at the end of the output to explain what is happening.

...
...
...
Available binding information: unknown

Binding information for one or more ServiceBinding is not available because they don't exist on the cluster yet.
Start `odo dev` first to see binding information. 

pkg/api/binding.go Outdated Show resolved Hide resolved
pkg/api/binding.go Outdated Show resolved Hide resolved
pkg/binding/binding.go Show resolved Hide resolved
@feloy
Copy link
Contributor Author

feloy commented Jun 1, 2022

With hindsight, shouldn't we check that the secret does exist as well (since we are getting the binding information from the secret)? I just manually deleted the secret in my local cluster (thinking it would maybe get recreated, but it was not)

I'm not sure. If the InjectionReady condition of the SB is true but the secret is not present, that seems an operational problem to me, and the user should be aware of it. Also, if the user has deleted the secret, odo should not behave normally IMO, but return an error.

@rm3l
Copy link
Member

rm3l commented Jun 1, 2022

With hindsight, shouldn't we check that the secret does exist as well (since we are getting the binding information from the secret)? I just manually deleted the secret in my local cluster (thinking it would maybe get recreated, but it was not)

I'm not sure. If the InjectionReady condition of the SB is true but the secret is not present, that seems an operational problem to me, and the user should be aware of it. Also, if the user has deleted the secret, odo should not behave normally IMO, but return an error.

Okay - makes sense. Thanks.

@feloy feloy requested a review from rm3l June 1, 2022 11:47
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jun 1, 2022
- [Describe with access to Devfile](#describe-with-access-to-devfile)
- [Describe without access to Devfile](#describe-without-access-to-devfile)

## Describe with access to Devfile
Copy link
Member

Choose a reason for hiding this comment

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

For command reference, we are trying to have a consistent format between all documentation. Can you split these sections up similar to: https://odo.dev/docs/3.0.0/command-reference/dev ?

Ex. Section for Description, Running the Command and Devfile usage.

Copy link
Contributor Author

@feloy feloy Jun 2, 2022

Choose a reason for hiding this comment

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

I made the changes, thanks

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jun 2, 2022
@feloy feloy force-pushed the feature-5659/describe-binding branch from 231082b to 489855e Compare June 2, 2022 13:21
@valaparthvi
Copy link
Contributor

/approve

@openshift-ci
Copy link

openshift-ci bot commented Jun 2, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: valaparthvi

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 /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 2, 2022
@feloy feloy requested review from cdrage and rm3l June 2, 2022 15:11
Copy link
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.

Few comments/questions, few change requests.

pkg/api/binding.go Show resolved Hide resolved
pkg/binding/binding.go Outdated Show resolved Hide resolved
pkg/binding/binding.go Outdated Show resolved Hide resolved
pkg/binding/binding.go Show resolved Hide resolved
}

if bindingSB.Spec.BindAsFiles {
bindings := make([]string, 0, len(secret.Data))
Copy link
Member

Choose a reason for hiding this comment

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

This declaration could be made outside the if block so that it doesn't need to be done twice.

pkg/kclient/binding.go Show resolved Hide resolved
pkg/kclient/binding.go Show resolved Hide resolved
return specApi.ServiceBinding{}, err
}

var result specApi.ServiceBinding
Copy link
Member

Choose a reason for hiding this comment

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

Similar question as in GetBindingServiceBinding method for var result declaration.

pkg/odo/cli/describe/binding.go Outdated Show resolved Hide resolved
pkg/odo/cli/describe/binding.go Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 3, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@feloy
Copy link
Contributor Author

feloy commented Jun 3, 2022

Thanks @dharmit for your review. I made changes based on your feedback, or replied to some comments

@dharmit
Copy link
Member

dharmit commented Jun 3, 2022

Since the request made by @cdrage is addressed already, and my change requests have also been addressed, LGTM.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jun 3, 2022
@openshift-merge-robot openshift-merge-robot merged commit ba7f1a1 into redhat-developer:main Jun 3, 2022
cdrage pushed a commit to cdrage/odo that referenced this pull request Aug 31, 2022
* List Servicebindings from SBO only

* Support both implementations

* Integration tests (TBC)

* Human readable output

* Support --name flag

* Reference doc

* fix

* self review

* Check for InjectionReady condition before to get bindings

* Fix comments

* Remove unnecessary error returned value

* Display info when status is unknown

* Sections in doc

* Review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Development

Successfully merging this pull request may close these issues.

user should be able to display details about SB
7 participants