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

Dropping support for service catalog based services #4906

Merged

Conversation

mohammedzee1000
Copy link
Contributor

@mohammedzee1000 mohammedzee1000 commented Jul 12, 2021

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

What type of PR is this?
/kind code-refactoring
/kind cleanup

What does this PR do / why we need it:
We are dropping support for service catalog based services

Which issue(s) this PR fixes:

Fixes #4890
Fixes #5004

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:

  • odo catalog list services should not list service catalog even if it is available in cluster
> ./odo catalog list services
Services available through Operators
NAME                                CRDs
redis-operator.v0.6.0               RedisCluster, Redis
service-binding-operator.v0.8.0     ServiceBinding
  • odo catalog describe service x/y should describe operator backed service and fail otherwise
> odo catalog describe service blah
 ✗  unable to search classes by name (the server could not find the requested resource (get clusterserviceclasses.servicecatalog.k8s.io))
> odo catalog describe service redis-operator.v0.6.0/Redis
Kind: Redis
Version: v1beta1
Description: Redis
Parameters:

 PATH  DISPLAYNAME  DESCRIPTION 



  • odo service create should successfully create operator backed services and attempts to create service catalog should fail
> odo service create blah
 ✗  invalid service name, use the format <operator-type>/<crd-name>
> odo service create redis-operator.v0.6.0/Redis
Successfully added service to the configuration; do 'odo push' to create service on the cluster
  • odo service list should only list operator backed services
  • odo service delete should successfully delete operator backed services

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. kind/code-refactoring labels Jul 12, 2021
@openshift-ci openshift-ci bot requested review from dharmit and mik-dass July 12, 2021 13:10
@mohammedzee1000 mohammedzee1000 force-pushed the remove_service_catalog branch 2 times, most recently from fea4d1c to 0ce112d Compare July 14, 2021 06:31
@netlify
Copy link

netlify bot commented Jul 14, 2021

✔️ Deploy Preview for odo-docusaurus-preview ready!

🔨 Explore the source changes: 9571113

🔍 Inspect the deploy log: https://app.netlify.com/sites/odo-docusaurus-preview/deploys/6119f3cb9650f10008db0189

😎 Browse the preview: https://deploy-preview-4906--odo-docusaurus-preview.netlify.app

@mohammedzee1000
Copy link
Contributor Author

prow error
/retest

@mohammedzee1000
Copy link
Contributor Author

/refresh

@mohammedzee1000
Copy link
Contributor Author

timeout
/test psi-unit-test-windows

@mohammedzee1000 mohammedzee1000 changed the title WIP Dropping support for service catalog based services Dropping support for service catalog based services Jul 16, 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 Jul 16, 2021
@mohammedzee1000
Copy link
Contributor Author

timeouts
/retest

@mohammedzee1000
Copy link
Contributor Author

timed out
/retest

@mohammedzee1000
Copy link
Contributor Author

ci error
/retest

@mohammedzee1000
Copy link
Contributor Author

macos machine issue
/test psi-unit-test-mac

@mohammedzee1000
Copy link
Contributor Author

/test v4.7-integration-e2e

@mohammedzee1000
Copy link
Contributor Author

/retest

@mohammedzee1000
Copy link
Contributor Author

/retest

1 similar comment
@mohammedzee1000
Copy link
Contributor Author

/retest

service svc.ServiceClass
plans []svc.ServicePlan
// service svc.ServiceClass
// plans []svc.ServicePlan
Copy link
Member

Choose a reason for hiding this comment

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

These fields are all related to Service Catalog. Remove them. We don't need them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

o.backend = NewServiceCatalogBackend()
_, _, err = service.IsOperatorServiceNameValid(args[0])
if err != nil {
return fmt.Errorf("invalid operator name and service catalog not supported %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to mention in CLI output that Service Catalog is not supported anymore. We should put it on our project documentation on the website and the changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment on lines 43 to 44
// Kubernetes or OpenShift 4.x cluster. It doesn't occur when there are
// no operators installed.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should remove these comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can still see them

Copy link
Member

Choose a reason for hiding this comment

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

I'm seeing below:

// Error only occurs when OperatorHub is not installed/enabled on the
// Kubernetes or OpenShift 4.x cluster.
// Neither OperatorHub nor Service Catalog is enabled on the cluster

IMO, it should be:

// Error only occurs when OperatorHub is not installed/enabled on the
// Kubernetes or OpenShift 4.x cluster. It doesn't occur when there are
// no operators installed.
// OperatorHub is not enabled on the cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated ptal

cmpExists, err := component.Exists(o.Client, suppliedName, o.Application)
if err != nil {
return fmt.Errorf("Unable to determine if component exists:\n%v", err)
}

if !cmpExists && !svcExists {
if !cmpExists {
return fmt.Errorf("Neither a service nor a component named %s could be located. Please create one of the two before attempting to use 'odo %s'", suppliedName, o.operationName)
Copy link
Member

Choose a reason for hiding this comment

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

I know it's not modified as a part of this PR but errors shouldn't start with capital letter. Can you please change it?

Suggested change
return fmt.Errorf("Neither a service nor a component named %s could be located. Please create one of the two before attempting to use 'odo %s'", suppliedName, o.operationName)
return fmt.Errorf("neither a service nor a component named %s could be located. Please create one of the two before attempting to use 'odo %s'", suppliedName, o.operationName)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

if o.Context.Project == "" || o.Context.Application == "" {
return odoutil.ThrowContextError()
}
return fmt.Errorf("operator backed services not installed and service catalog is no longer supported")
Copy link
Member

Choose a reason for hiding this comment

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

Same suggestion. We don't need to mention Service Catalog on CLI any more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

}
return true
}
//func equal(s1, s2 []string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Why are we commenting? We can just remove it, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed file as it is last thing remaining

"k8s.io/klog"

scv1beta1 "github.com/kubernetes-sigs/service-catalog/pkg/apis/servicecatalog/v1beta1"
Copy link
Member

Choose a reason for hiding this comment

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

This import corresponds to Service Catalog. Is something in this file still doing something with it? Can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

When("user runs odo service commands with help flag", func() {
It("should display the help for odo service -h", func() {
appHelp := helper.Cmd("odo", "service", "-h").ShouldPass().Out()
Expect(appHelp).To(ContainSubstring("Perform service catalog operations"))
Copy link
Member

Choose a reason for hiding this comment

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

IMO, we sholdn't be showing "service catalog" on CLI. I couldn't find another occurrence of this string being checked with a Ctrl+F. We should remove it, IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

mohammedzee1000 and others added 5 commits August 16, 2021 10:42
Co-authored-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
@mohammedzee1000
Copy link
Contributor Author

reset and rebased, now il ensure some of the docs changes did not disappear

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

openshift-ci bot commented Aug 16, 2021

@mohammedzee1000: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Rerun command
ci/prow/v4.7-integration-e2e 5f5d898 link /test v4.7-integration-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@mohammedzee1000
Copy link
Contributor Author

project json format error
/test v4.8-integration-e2e

@valaparthvi
Copy link
Contributor

I think people are confusing odo catalog service v/s openshift service catalog v/s Service Catalog Backend. I was confused at first too but the reason why service catalog is used here is that openshift service catalog was the only way to create services in the days this code was written.
In later stages, we got operators and potentially helm in the future. But the name service catalog has stuck (#4906 (comment))

Then perhaps we should consider renaming the interface to something like Service Backend or something less ambiguous. But again, out of scope for this PR.

Copy link
Contributor

@feloy feloy left a comment

Choose a reason for hiding this comment

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

Some little comments, LGTM otherwise

pkg/odo/cli/catalog/describe/service.go Outdated Show resolved Hide resolved
@@ -59,7 +47,7 @@ func (o *DescribeServiceOptions) Complete(name string, cmd *cobra.Command, args
if _, _, err := service.SplitServiceKindName(args[0]); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can as usual handle the error case first:

	if _, _, err := service.SplitServiceKindName(args[0]); err != nil {
		return fmt.Errorf("no deployable operators found")
	}
	o.backend = NewOperatorBackend()

pkg/odo/cli/service/list.go Outdated Show resolved Hide resolved
Copy link
Contributor

@valaparthvi valaparthvi left a comment

Choose a reason for hiding this comment

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

I have a few concerns about the deleted unit tests and completion handlers, which still seem relevant, but they definitely need refactoring. Maybe we can comment the tests for now, and refactor them to work with services that we still support, i.e. Operator Backed Services.

Other than that, since the integration tests pass and no other irrelevant integration tests were deleted or modified, I am inclined to do a lgtm.

}
}

func TestLinkCompletionHandler(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if we should completely remove these tests. I understand that they might need modification, but I don't think it's a good idea to completely remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recorded an issue

}
}

func TestUnlinkCompletionHandler(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as TestLinkCompletionHandlers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recorded in issue

}
}

func TestServiceClassCompletionHandler(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Which command does this handler test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recorded in issue

@@ -1,9 +1,6 @@
package service
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure unit tests in this file are not relevant anymore, even with the operator backed services?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recorded in issue before

@@ -1,124 +0,0 @@
package service
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should completely remove this unit test file, it is still relevant to operator backed services because we still have this command in odo. What it needs is refactoring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recorded in issue before

"github.com/openshift/odo/pkg/storage"
"github.com/openshift/odo/pkg/url"
"github.com/openshift/odo/pkg/util"
"github.com/posener/complete"
"github.com/spf13/cobra"
)

// ServiceCompletionHandler provides service name completion for the current project and application
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure we want to remove this handler? Wouldn't it be helpful with the OBS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recorded in issue before

Co-authored-by: Philippe Martin <contact@elol.fr>
@mohammedzee1000
Copy link
Contributor Author

@valaparthvi opened issues as per discussion
#4996
#4997

Co-authored-by: Philippe Martin <contact@elol.fr>
@sonarcloud
Copy link

sonarcloud bot commented Aug 17, 2021

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@valaparthvi
Copy link
Contributor

valaparthvi commented Aug 17, 2021

@mohammedzee1000 I am curious, why have you not removed the serviceCatalog references from the kclient package? Are they still relevant or are you planning to take them up in part 2?
https://github.com/mohammedzee1000/odo/blob/remove_service_catalog/pkg/kclient/serviceCatalog.go
https://github.com/mohammedzee1000/odo/blob/remove_service_catalog/pkg/kclient/serviceCatalog_test.go

@mohammedzee1000
Copy link
Contributor Author

@mohammedzee1000 I am curious, why have you not removed the serviceCatalog references from the kclient package? Are they still relevant or are you planning to take them up in part 2?
https://github.com/mohammedzee1000/odo/blob/remove_service_catalog/pkg/kclient/serviceCatalog.go
https://github.com/mohammedzee1000/odo/blob/remove_service_catalog/pkg/kclient/serviceCatalog_test.go

Yes, there are still usages in link and unlink and both should be dropped simultanously

Copy link
Contributor

@valaparthvi valaparthvi left a comment

Choose a reason for hiding this comment

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

No major changes have been made to the integration tests (except that of Service Catalog's) and they are all passing; all the remaining references will be removed in the next PR, hence I'm approving this PR.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Aug 18, 2021
@openshift-ci openshift-ci bot merged commit 0b8b712 into redhat-developer:main Aug 18, 2021
@rm3l rm3l added the area/refactoring Issues or PRs related to code refactoring label Jun 19, 2023
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. area/refactoring Issues or PRs related to code refactoring estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. 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.

odo catalog describe service broken Remove code and cli docs related to 3.11 and Service Catalog
6 participants