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

Private/babbara/enable proxy setting #17

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

abhimanyubabbar
Copy link
Contributor

No description provided.

@abhimanyubabbar abhimanyubabbar force-pushed the private/babbara/enable-proxy-setting branch from 19e197a to 128346a Compare October 2, 2020 19:36
@abhimanyubabbar abhimanyubabbar force-pushed the private/babbara/enable-proxy-setting branch from 64eca32 to af7d420 Compare October 14, 2020 07:52
Copy link
Contributor

@roopakparikh roopakparikh left a comment

Choose a reason for hiding this comment

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

Some minor comments, else looks good, we do have overlapping changes, but since your code preceded mine, please go ahead and merge after making the suggested changes.

func New(fqdn string, proxy string) (Client, error) {

http, err := NewHTTP(
func(impl *HTTPImpl) { impl.Proxy = proxy },
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we passing in functions ? Why don't we just pass in the value ?

// external services
type Client struct {
Resmgr Resmgr
Keystone Keystone
Qbert Qbert
Executor Executor
Segment Segment
HTTP HTTP
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call it an HTTPClient

Qbert: NewQbert(fqdn),
Resmgr: NewResmgr(fqdn, http),
Keystone: NewKeystone(fqdn, http),
Qbert: NewQbert(fqdn, http),
Executor: ExecutorImpl{},
Segment: NewSegment(fqdn),
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to understand more on how we have used in different places, in general I would like to see more "events" and segment should be able to "consume" those events instead of directly using segment.


var transport http.RoundTripper
if resp.Proxy != "" {
proxyURL, err := url.Parse(resp.Proxy)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should parse it when user enters the proxy and error out. ProxyURL can be used inside the code instead of passing proxy as string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fail at the input site only you mean ?!

t := rehttp.NewTransport(transport, rehttp.RetryAll(
rehttp.RetryAny(
rehttp.RetryTemporaryErr(),
rehttp.RetryStatuses(400, 404),
Copy link
Contributor

Choose a reason for hiding this comment

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

What about when gateway times out, I think it is 502 or 503 I can't recall

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RetryTemporaryErr() covers them I think. I'll check

resp, err := util.AskBool("Prep local node for kubernetes cluster")
if err != nil || !resp {
log.Errorf("Couldn't fetch user content")
prep, err := util.AskBool("PrepLocal node for kubernetes cluster")
Copy link
Contributor

Choose a reason for hiding this comment

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

we should protect these via a silent option, in other words if there is "--silent" present we should move forward without asking.

if err := PrepNode(ctx, c, "", "", "", []string{}); err != nil {
return fmt.Errorf("Unable to prepnode: %w", err)
if prep {
err = PrepNode(ctx, c, "", "", "", []string{})
Copy link
Contributor

Choose a reason for hiding this comment

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

put a comment to talk about the parameters


// Host interface exposes the functions
// required to setup the host correctly.
type Host interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good


// SwapOff disables the swap.
func (h Debian) SwapOff() error {
return h.exec.Run("bash", "-c", "swapoff -a")
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 not persistent

@@ -21,11 +21,12 @@ type Keystone interface {
}

type KeystoneImpl struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

In terms of the organization, I would actually move up all of these: Keystone.go, Resmgr.go into their own packages: /pkg/keystone/keystone.go; /pkg/resmgr/resmgr.go;...

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