-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: master
Are you sure you want to change the base?
Conversation
19e197a
to
128346a
Compare
…ing hostagent through proxy
64eca32
to
af7d420
Compare
There was a problem hiding this 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 }, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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{}) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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;...
No description provided.