Skip to content

Commit

Permalink
Revert "Add support for creating component from service catalog (#413)"
Browse files Browse the repository at this point in the history
This reverts commit bbcf73f.
  • Loading branch information
cdrage authored Aug 29, 2018
1 parent bbcf73f commit 0d89e9f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 656 deletions.
102 changes: 7 additions & 95 deletions cmd/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"text/tabwriter"

"github.com/redhat-developer/odo/pkg/catalog"
svc "github.com/redhat-developer/odo/pkg/service"
"github.com/spf13/cobra"
)

Expand All @@ -22,26 +21,15 @@ var catalogCmd = &cobra.Command{

var catalogListCmd = &cobra.Command{
Use: "list",
Short: "List all available component & service types.",
Long: "List all available component and service types from OpenShift",
Example: ` # Get the supported components
odo catalog list components
# Get the supported services from service catalog
odo catalog list services
`,
}

var catalogListComponentCmd = &cobra.Command{
Use: "components",
Short: "List all available component types.",
Long: "List all available component types from OpenShift's Image Builder.",
Example: ` # Get the supported components
odo catalog list components
odo catalog list
# Search for a supported component
odo catalog search components nodejs
odo search nodejs
`,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
client := getOcClient()
catalogList, err := catalog.List(client)
Expand All @@ -62,61 +50,18 @@ var catalogListComponentCmd = &cobra.Command{
},
}

var catalogListServiceCmd = &cobra.Command{
Use: "services",
Short: "Lists all the services from service catalog",
Long: "Lists all the services from service catalog",
Example: ` # List all services
odo catalog list services
# Search for a supported services
odo catalog search services mysql
`,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
client := getOcClient()
catalogList, err := svc.ListCatalog(client)
checkError(err, "unable to list services because Service Catalog is not enabled in your cluster")
switch len(catalogList) {
case 0:
fmt.Printf("No deployable services found\n")
default:
fmt.Println("The following services can be deployed:")
for _, service := range catalogList {
fmt.Printf("- %v\n", service)
}
}
},
}

var catalogSearchCmd = &cobra.Command{
Use: "search",
Short: "Search available component & service types.",
Long: `Search available component & service types..
This searches for a partial match for the given search term in all the available
components & services.
`,
Example: ` # Search for a component
odo catalog search components python
# Search for a service
odo catalog search service mysql
`,
}

var catalogSearchComponentCmd = &cobra.Command{
Use: "components",
Use: "search <component name>",
Short: "Search component type in catalog",
Long: `Search component type in catalog.
This searches for a partial match for the given search term in all the available
components.
`,
Args: cobra.ExactArgs(1),
Example: ` # Search for a component
odo catalog search components python
odo catalog search pyt
`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
client := getOcClient()
searchTerm := args[0]
Expand All @@ -135,43 +80,10 @@ components.
},
}

var catalogSearchServiceCmd = &cobra.Command{
Use: "services",
Short: "Search service type in catalog",
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.
`,
Example: ` # Search for a service
odo catalog search services mysql
`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
client := getOcClient()
searchTerm := args[0]
components, err := svc.Search(client, searchTerm)
checkError(err, "unable to search for services")

switch len(components) {
case 0:
fmt.Printf("No service matched the query: %v\n", searchTerm)
default:
fmt.Println("The following services were found:")
for _, component := range components {
fmt.Printf("- %v\n", component)
}
}
},
}

func init() {
catalogCmd.AddCommand(catalogSearchCmd)
catalogCmd.AddCommand(catalogListCmd)
catalogListCmd.AddCommand(catalogListComponentCmd)
catalogListCmd.AddCommand(catalogListServiceCmd)
catalogSearchCmd.AddCommand(catalogSearchComponentCmd)
catalogSearchCmd.AddCommand(catalogSearchServiceCmd)

// Add a defined annotation in order to appear in the help menu
catalogCmd.Annotations = map[string]string{"command": "other"}
catalogCmd.SetUsageTemplate(cmdUsageTemplate)
Expand Down
162 changes: 0 additions & 162 deletions cmd/service.go

This file was deleted.

17 changes: 6 additions & 11 deletions pkg/occlient/fakeclient.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package occlient

import (
fakeServiceCatalogClientSet "github.com/kubernetes-incubator/service-catalog/pkg/client/clientset_generated/clientset/fake"
fakeAppsClientset "github.com/openshift/client-go/apps/clientset/versioned/fake"
fakeBuildClientset "github.com/openshift/client-go/build/clientset/versioned/fake"
fakeImageClientset "github.com/openshift/client-go/image/clientset/versioned/fake"
Expand All @@ -13,13 +12,12 @@ import (
// FakeClientSet holds fake ClientSets
// this is returned by FakeNew to access methods of fake client sets
type FakeClientset struct {
Kubernetes *fakeKubeClientset.Clientset
AppsClientset *fakeAppsClientset.Clientset
BuildClientset *fakeBuildClientset.Clientset
ImageClientset *fakeImageClientset.Clientset
RouteClientset *fakeRouteClientset.Clientset
ProjClientset *fakeProjClientset.Clientset
ServiceCatalogClientSet *fakeServiceCatalogClientSet.Clientset
Kubernetes *fakeKubeClientset.Clientset
AppsClientset *fakeAppsClientset.Clientset
BuildClientset *fakeBuildClientset.Clientset
ImageClientset *fakeImageClientset.Clientset
RouteClientset *fakeRouteClientset.Clientset
ProjClientset *fakeProjClientset.Clientset
}

// FakeNew creates new fake client for testing
Expand Down Expand Up @@ -50,8 +48,5 @@ func FakeNew() (*Client, *FakeClientset) {
fkclientset.BuildClientset = fakeBuildClientset.NewSimpleClientset()
client.buildClient = fkclientset.BuildClientset.Build()

fkclientset.ServiceCatalogClientSet = fakeServiceCatalogClientSet.NewSimpleClientset()
client.serviceCatalogClient = fkclientset.ServiceCatalogClientSet.Servicecatalog()

return &client, &fkclientset
}
Loading

0 comments on commit 0d89e9f

Please sign in to comment.