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

Break apart the Kubernetes Client #214

Closed
wants to merge 1 commit into from

Conversation

rthallisey
Copy link
Contributor

Make a separate directory for clients so they are not part of the APB code. This will make the clients
easy to initialize, a single place to create the object, and adds the ability to easily create new ones.

Partially-fixes: #213

@rthallisey
Copy link
Contributor Author

Testing: Run the normal broker tests.

Make a seperate directory for clients so they are
not apart of the APB code.  This will make the clients
easy to initialize and create new ones.
Copy link
Contributor

@eriknelson eriknelson left a comment

Choose a reason for hiding this comment

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

I actually think I captured most of my thoughts for this in the #222 review. Main thing I would add is moving more of the client stuff out of apb/client.go somewhere here:

I think we should push any remaining client code unrelated to actually running an apb into the clients package, then we should reconsider renaming apb/client.go to something that more accurately describes what it's doing. Semantically, it's the part of the apb package that's responsible for actually executing apb methods. Could almost be apb/apb.go? Curious what you guys think.

Copy link
Contributor

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

Overall looks good. One concern is the Client struct with multiple clients in it. I see there are three other PRs related to this one. I'll look those over and revisit this concern. Marking as request changes so it does not get merged until I come back.

@@ -11,9 +11,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
restclient "k8s.io/client-go/rest"

"github.com/openshift/ansible-service-broker/pkg/clients"
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow I never realized how ugly our import is :( not really a problem with this PR, just something I noticed finally. Would be cool if we could get: openshift.io/asb/

Copy link
Contributor

Choose a reason for hiding this comment

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

On the plus side importing our a clients package is good.

}

clientset, err := clientset.NewForConfig(clientConfig)
k8s, err := clients.Kubernetes(log)
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the simplicity of this. I do not like how the Client struct has a bunch of clients in it. Will keep looking at this and other PRs to see if I understand the need for it. I know originally it was

type Client struct {
    dockerClient ...
}

return config, nil
}

func Kubernetes(log *logging.Logger) (*clientset.Clientset, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is definitely cleaner. 👍

@jmrodri
Copy link
Contributor

jmrodri commented Jun 23, 2017

I'm going to approve this on my side. The main concern is similar to @eriknelson need to remove Clients struct. But the changes here seem reasonable.

@eriknelson
Copy link
Contributor

@jmrodri Plan is for me to follow up this series with a PR that removes the Client, which is reasonable because this is a good step forwards and looks stable.

Copy link
Contributor

@eriknelson eriknelson left a comment

Choose a reason for hiding this comment

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

ACK based on the above, I'll follow up with a PR since I requested the change.

Copy link
Contributor

@eriknelson eriknelson left a comment

Choose a reason for hiding this comment

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

Sorry, @shawn-hurley brought up a good point on the other PR. I think anything exported needs docstrings to help him out with linter stuff.

Also, do we want to close this and the docker PR so everything is centralized on #222 @rthallisey @jmrodri ?

@rthallisey
Copy link
Contributor Author

Working in #222

@rthallisey rthallisey closed this Jun 23, 2017
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.

Break apart all the clients so they are easier to consume
3 participants