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

Add ocdev catalog command #243

Merged
merged 2 commits into from
Mar 26, 2018
Merged

Conversation

concaf
Copy link
Contributor

@concaf concaf commented Mar 20, 2018

Fix #194 #35

@concaf concaf 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 Mar 20, 2018
@concaf
Copy link
Contributor Author

concaf commented Mar 20, 2018

@kadel would love your initial feedback

return GetImageStreams(openShiftNameSpace)
}

func GetImageStreams(namespace string) ([]string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to call this function GetImageStreamNames if it is returning just names.
Also comment would be nice ;-)

@@ -380,10 +385,25 @@ func getExposedPorts(image *imagev1.ImageStreamImage) ([]corev1.ContainerPort, e
return ports, nil
}

func GetDefaultBuilderImages() ([]string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Comment would be nice ;-)

@@ -49,6 +52,41 @@ var (
namespace string
)

func init() {
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't use init for this :-(
We will have to construct struct that will represent openshift client and that will hold all the client-go clients

@kadel
Copy link
Member

kadel commented Mar 20, 2018

a few pointers, but in general I think goes in the right direction

@concaf
Copy link
Contributor Author

concaf commented Mar 22, 2018

@kadel made the changes, also added the service catalog support, PTAL!


// clusterServiceClassExists returns true if the given external name of the
// cluster service class exists in the cluster, and false otherwise
func (c *Client) clusterServiceClassExists(name string) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're not using this in this PR, but we will need this when we implement deploying using s2i with this, so maybe we can keep this util function here


// imageStreamExists returns true if the given image stream exists in the given
// namespace
func (c *Client) imageStreamExists(name string, namespace string) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're not using this in this PR, but we will need this when we implement deploying using s2i with this, so maybe we can keep this util function here

@concaf concaf changed the title Add oc catalog command Add ocdev catalog command Mar 22, 2018
@@ -34,18 +35,23 @@ import (
"github.com/openshift/source-to-image/pkg/tar"
s2ifs "github.com/openshift/source-to-image/pkg/util/fs"

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

@kadel kadel Mar 22, 2018

Choose a reason for hiding this comment

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

This should be named properly. v1beta1 is too generic and it will collide with other objects.
How about catalogv1beta1 "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1" so it follows naming convention with other apis that we are importing??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to scv1beta1

@concaf concaf 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 Mar 22, 2018
@kadel
Copy link
Member

kadel commented Mar 22, 2018

We have to somehow display that this requires service catalog. Probably in the readme and also in help messages.

Another thing is that it displays a lot of stuff that currently can't be deployed (everything from service catalog). We should hide it from output until component createcan handle that stuff.

@concaf
Copy link
Contributor Author

concaf commented Mar 23, 2018

@kadel that means hiding the entire service catalog output

cmd/catalog.go Outdated
}

var catalogSearchCmd = &cobra.Command{
Use: "search",
Copy link
Member

Choose a reason for hiding this comment

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

search <search_term> or something like this to indicate that there is one argument required and what that argument 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.

added

)

// List lists all the available component types
// Currently queries the image streams in openshift namespace
Copy link
Member

Choose a reason for hiding this comment

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

Is that comment true. I can see that in code GetClusterServiceClassExternalNames() is called

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

@concaf
Copy link
Contributor Author

concaf commented Mar 23, 2018

@kadel commented out service catalog for now, and made the changes, PTAL

@kadel
Copy link
Member

kadel commented Mar 23, 2018

@kadel that means hiding the entire service catalog output

Yes, I doesn't make sense to show it right now when we don't have a way to deploy those thinks

@kadel
Copy link
Member

kadel commented Mar 23, 2018

It would be nice to clean up Cobra metadata, so we have nice command line output with examples.
Something like what is here : https://github.com/redhat-developer/ocdev/pull/247/files#diff-1dcc122e377b3a7b4adf52faf26c0188R31

Otherwise this LGTM

@concaf
Copy link
Contributor Author

concaf commented Mar 26, 2018

@kadel added more description to the catalog commands, PTAL

This commit adds github.com/kubernetes-incubator/service-catalog,
version: v0.1.9 and github.com/satori/go.uuid, version: v1.1.0 (
which is required by service-catalog) to the vendor directory.

The standard procedure of adding the dependencies to glide.yaml
and then running `glide update --strip-vendor` was followed.
cmd/catalog.go Outdated
# Get the supported components
ocdev catalog list

# Deploy the component
Copy link
Member

Choose a reason for hiding this comment

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

There should be only examples for this command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

cmd/catalog.go Outdated
Example: `# Search for a component
ocdev catalog search pyt

# Deploy the component
Copy link
Member

Choose a reason for hiding this comment

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

just examples for this command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

This commit adds support for `ocdev catalog` command which
currently has 2 commands, list and search, to list all the
components and to search for a component.

To achieve this, the service catalog API has been used.
@kadel kadel merged commit c95f488 into redhat-developer:master Mar 26, 2018
@concaf concaf mentioned this pull request Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants