Starting a refactoring around RunContext and Docker local/remote Api#2497
Starting a refactoring around RunContext and Docker local/remote Api#2497nkubala merged 8 commits intoGoogleContainerTools:masterfrom
Conversation
18b418d to
d83eec8
Compare
Codecov Report
|
| // NewAPIClient guesses the docker client to use based on current kubernetes context. | ||
| func NewAPIClient(forceRemove bool, insecureRegistries map[string]bool) (LocalDaemon, error) { | ||
| // NewAPIClientImpl guesses the docker client to use based on current kubernetes context. | ||
| func NewAPIClientImpl(runCtx *runcontext.RunContext) (LocalDaemon, error) { |
There was a problem hiding this comment.
wdyt about having a dockerCLIContext or something that contains just the necessary fields for this constructor? then that can live inside the runcontext and we can just pass that in here.
type DockerCLIContext struct {
insecureRegistries map[string]bool
prune bool
}
type RunContext struct {
dockerCLIContext *DockerCLIContext
...
}
func NewAPIClientImpl(cliContext *docker.DockerCLIContext) (LocalDaemon, error) {
...
}
cli, err := docker.NewAPIClient(runctx.DockerCLIContext)There was a problem hiding this comment.
Yeah, I could try that
| } | ||
|
|
||
| func getTagger(t latest.TagPolicy, customTag string) (tag.Tagger, error) { | ||
| func getTagger(runCtx *runcontext.RunContext) (tag.Tagger, error) { |
There was a problem hiding this comment.
so is the end goal here just to make everything consistent? maybe I'm mistaken but I thought that you wanted to move away from the runcontext in these constructors. just trying to understand
There was a problem hiding this comment.
:-) For now, I'm aiming at consistency.
774b787 to
7cb0410
Compare
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Once those options are set by command line flags, they are immutable. Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
7cb0410 to
916c7d9
Compare
|
@nkubala could you take another look? That would be awesome because this one is a bit painful to rebase. |
My goals are:
This is just the beginning of the refactoring but already improves a bit the codebase