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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5687794
Removing cli layer and integration tests related to service catalog
mohammedzee1000 Aug 3, 2021
51251b8
Fixing missing error msg
mohammedzee1000 Aug 3, 2021
efa65a3
Fixing golint errors
mohammedzee1000 Aug 3, 2021
bd8280c
Fixing error for interactive mode
mohammedzee1000 Aug 4, 2021
0b9d350
Moving interactive mode error to top
mohammedzee1000 Aug 4, 2021
d8bbb98
Fixing
mohammedzee1000 Aug 4, 2021
75e567a
Fixing interactive mode error condition
mohammedzee1000 Aug 9, 2021
7f483e6
Removing some more service related code
mohammedzee1000 Aug 9, 2021
ef22cac
Fixing golint
mohammedzee1000 Aug 9, 2021
e6e4c16
Removing service catalog backend part 1
mohammedzee1000 Aug 9, 2021
ac789f1
Updating changelogs
mohammedzee1000 Aug 9, 2021
b11c178
Removing some more of the service catalog related code
mohammedzee1000 Aug 9, 2021
ffff877
Updating as per comments in review
mohammedzee1000 Aug 11, 2021
4bd90d9
Update pkg/odo/cli/service/create.go
mohammedzee1000 Aug 11, 2021
8157746
Fixing gofmt
mohammedzee1000 Aug 11, 2021
5265aff
Adding kube to cli docs
mohammedzee1000 Aug 11, 2021
c2ad74f
Updating changelog as per comments by @dharmit
mohammedzee1000 Aug 12, 2021
9571113
Removing some unnessasary stuff
mohammedzee1000 Aug 12, 2021
1c7587f
Updating docs based changes as per review
mohammedzee1000 Aug 16, 2021
7cc5ec1
Fixing test
mohammedzee1000 Aug 16, 2021
8794667
Update pkg/odo/cli/catalog/describe/service.go
mohammedzee1000 Aug 17, 2021
1578dc3
Update pkg/odo/cli/service/list.go
mohammedzee1000 Aug 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added a column in odo list output to indicate components created by odo ([#4962](https://github.com/openshift/odo/pull/4962))
- Fix description for "odo link" command ([#4930](https://github.com/openshift/odo/pull/4930))
- Add deprecation warnings for s2i components([#4967](https://github.com/openshift/odo/issues/4967))
- Dropping support for service catalog based services ([#4906](https://github.com/openshift/odo/pull/4906))

### Bug Fixes

Expand Down
9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ test-cmd-login-logout: ## Run odo login and logout tests
test-cmd-link-unlink-4-cluster: ## Run link and unlink commnad tests against 4.x cluster
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo link and unlink commnad tests" tests/integration/

.PHONY: test-cmd-link-unlink-311-cluster
test-cmd-link-unlink-311-cluster: ## Run link and unlink command tests against 3.11 cluster
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo link and unlink command tests" tests/integration/servicecatalog/

.PHONY: test-cmd-service
test-cmd-service: ## Run odo service command tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo service command tests" tests/integration/servicecatalog/
Expand Down Expand Up @@ -299,11 +295,6 @@ test-integration-devfile: ## Run devfile integration tests
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration/devfile/
$(RUN_GINKGO) $(GINKGO_FLAGS_SERIAL) tests/integration/devfile/debug/

# Only service and link command tests are the part of this test run
.PHONY: test-integration-service-catalog
test-integration-service-catalog: ## Run command's integration tests which are dependent on service catalog enabled cluster.
$(RUN_GINKGO) $(GINKGO_FLAGS) tests/integration/servicecatalog/

.PHONY: test-e2e-beta
test-e2e-beta: ## Run core beta flow e2e tests
$(RUN_GINKGO) $(GINKGO_FLAGS) -focus="odo core beta flow" tests/e2escenarios/
Expand Down
16 changes: 0 additions & 16 deletions pkg/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
applabels "github.com/openshift/odo/pkg/application/labels"
"github.com/openshift/odo/pkg/component"
"github.com/openshift/odo/pkg/occlient"
"github.com/openshift/odo/pkg/service"
"github.com/openshift/odo/pkg/util"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -86,21 +85,6 @@ func Delete(client *occlient.Client, name string) error {

labels := applabels.GetLabels(name, false)

// first delete the services (ServiceInstance in OpenShift terminology)
// belonging to the app
svcList, err := service.List(client, name)
if err != nil {
// error is returned when there's no Service Catalog enabled in the service
klog.V(4).Infof("Service catalog is not enabled in the cluster, skipping service deletion")
} else {
for _, svc := range svcList.Items {
err = service.DeleteServiceAndUnlinkComponents(client, svc.Name, name)
if err != nil {
return errors.Wrapf(err, "unable to delete the application %s due to failure in deleting service(s) in the application", name)
}
}
}

supported, err := client.IsDeploymentConfigSupported()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/application/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package application provides functions to list, check existence of, delete and get machine readable description of applications.
// An application is a set of components and services.
// An application is materialized by the `app:` label in `deployments`, `deploymentconfigs`,
// or service instances (service instances from Service Catalog or from Operator Backed Services).
// or service instances (service instances from Operator Backed Services).
package application
20 changes: 2 additions & 18 deletions pkg/odo/cli/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import (
"fmt"

applabels "github.com/openshift/odo/pkg/application/labels"
"github.com/openshift/odo/pkg/component"
"github.com/openshift/odo/pkg/kclient"
"github.com/openshift/odo/pkg/log"
"github.com/openshift/odo/pkg/occlient"
"github.com/openshift/odo/pkg/odo/genericclioptions"
"github.com/pkg/errors"
"k8s.io/klog"

"github.com/openshift/odo/pkg/component"
odoutil "github.com/openshift/odo/pkg/odo/util"
"github.com/openshift/odo/pkg/odo/util/completion"
"github.com/openshift/odo/pkg/service"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -87,18 +84,5 @@ func printAppInfo(client *occlient.Client, kClient *kclient.Client, appName stri
}
}
}
// List services that will be removed
serviceList, err := service.List(client, appName)
if err != nil {
log.Info("No services / could not get services")
klog.V(4).Info(err.Error())
}
if len(serviceList.Items) != 0 {
log.Info("This application has following service(s) that will be deleted")
for _, ser := range serviceList.Items {
log.Info("service named", ser.ObjectMeta.Name, "of type", ser.Spec.Type)
}
}

return nil
}
18 changes: 3 additions & 15 deletions pkg/odo/cli/catalog/describe/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,25 @@ import (

"github.com/openshift/odo/pkg/odo/genericclioptions"
"github.com/openshift/odo/pkg/service"
svc "github.com/openshift/odo/pkg/service"
"github.com/spf13/cobra"
ktemplates "k8s.io/kubectl/pkg/util/templates"
)

const serviceRecommendedCommandName = "service"

var (
serviceExample = ktemplates.Examples(` # Describe a service catalog service
%[1]s mysql-persistent

# Describe a Operator backed service
serviceExample = ktemplates.Examples(`# Describe a Operator backed service
%[1]s
`)

serviceLongDesc = ktemplates.LongDesc(`Describes a service type.
This command supports both Service Catalog services and Operator backed services.
This command supports Operator backed services.
A user can describe an Operator backed service by providing the full identifier for an Operand i.e. <operator_type>/<cr_name> which they can find by running "odo catalog list services".

If the format doesn't match <operator_type>/<cr_name> then service catalog services would be searched.

`)
)

// DescribeServiceOptions encapsulates the options for the odo catalog describe service command
type DescribeServiceOptions struct {
// name of the service to describe, from command arguments
serviceName string
// resolved service
service svc.ServiceClass
plans []svc.ServicePlan
// generic context options common to all commands
*genericclioptions.Context

Expand All @@ -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()

o.backend = NewOperatorBackend()
} else {
o.backend = NewServiceCatalogBackend()
return fmt.Errorf("no deployable operators found")
}

return o.backend.CompleteDescribeService(o, args)
Expand Down
99 changes: 0 additions & 99 deletions pkg/odo/cli/catalog/describe/service_catalog_backend.go

This file was deleted.

23 changes: 5 additions & 18 deletions pkg/odo/cli/catalog/list/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import (

const servicesRecommendedCommandName = "services"

var servicesExample = ` # Get the supported services from service catalog
var servicesExample = ` # Get the supported services
%[1]s`

// ServiceOptions encapsulates the options for the odo catalog list services command
type ServiceOptions struct {
// list of known services
services catalog.ServiceTypeList
// list of clusterserviceversions (installed by Operators)
csvs *olm.ClusterServiceVersionList
// generic context options common to all commands
Expand All @@ -49,11 +47,6 @@ func (o *ServiceOptions) Complete(name string, cmd *cobra.Command, args []string
return err
}
}

o.services, _ = catalog.ListSvcCatServices(o.Client)

o.services = util.FilterHiddenServices(o.services)

return
}

Expand All @@ -65,20 +58,16 @@ func (o *ServiceOptions) Validate() (err error) {
// Run contains the logic for the command associated with ListServicesOptions
func (o *ServiceOptions) Run(cmd *cobra.Command) (err error) {
if log.IsJSON() {
machineoutput.OutputSuccess(newCatalogListOutput(&o.services, o.csvs))
machineoutput.OutputSuccess(newCatalogListOutput(o.csvs))
} else {
if len(o.csvs.Items) == 0 && len(o.services.Items) == 0 {
log.Info("no deployable services/operators found")
if len(o.csvs.Items) == 0 {
log.Info("no deployable operators found")
return
}

if len(o.csvs.Items) > 0 {
util.DisplayClusterServiceVersions(o.csvs)
}

if len(o.services.Items) > 0 {
util.DisplayServices(o.services)
}
}
return
}
Expand All @@ -102,18 +91,16 @@ func NewCmdCatalogListServices(name, fullName string) *cobra.Command {
type catalogListOutput struct {
v1.TypeMeta `json:",inline"`
v1.ObjectMeta `json:"metadata,omitempty"`
Services *catalog.ServiceTypeList `json:"services,omitempty"`
// list of clusterserviceversions (installed by Operators)
Operators *olm.ClusterServiceVersionList `json:"operators,omitempty"`
}

func newCatalogListOutput(services *catalog.ServiceTypeList, operators *olm.ClusterServiceVersionList) catalogListOutput {
func newCatalogListOutput(operators *olm.ClusterServiceVersionList) catalogListOutput {
return catalogListOutput{
TypeMeta: v1.TypeMeta{
Kind: "List",
APIVersion: machineoutput.APIVersion,
},
Services: services,
Operators: operators,
}
}
2 changes: 1 addition & 1 deletion pkg/odo/cli/catalog/search/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewCmdCatalogSearchService(name, fullName string) *cobra.Command {
Long: `Search service type in catalog.

This searches for a partial match for the given search term in all the available
services from service catalog.
services from operator hub services.
`,
Example: fmt.Sprintf(serviceExample, fullName),
Args: cobra.ExactArgs(1),
Expand Down
Loading