-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
ideahitme
commented
Jan 17, 2017
•
edited
Loading
edited
- Create config.go to store all mate configurations
- Remove flags initialisation from all internal packages (this is generally a bad practice to do so)
- Make internal packages more independent and actually "invocable"
@linki I would like to hear your opinion on this :) |
|
||
KubeServer *url.URL | ||
KubeFormat string | ||
TrackNodePorts bool |
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.
how about - for consistency with the flags - to prefix with kubernetes
or change the flags to kube
? (the latter would require a version bump)
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.
+1 for kubernetes prefix :)
if err != nil { | ||
log.Fatalf("Error creating producer: %v", err) | ||
} | ||
|
||
c, err := consumers.NewSynced(params.consumer) | ||
c, err := newSyncConsumer(cfg) |
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.
use newSyncedConsumer
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.
or newSynchronizedConsumer
case "aws": | ||
consumer, err = consumers.NewAWSConsumer(cfg.AWSRecordGroupID) | ||
case "stdout": | ||
consumer, err = consumers.NewStdout() |
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.
if you want we can also change these functions to:
consumers.NewGoogleCloudDNSConsumer
consumers.NewAWSRoute53Consumer
consumers.NewStdoutConsumer
consumers.NewSynchronizedConsumer
to have unified and unambiguous naming.
} | ||
return producers.NewFake(fakeConfig) | ||
case "null": | ||
return producers.NewNull() |
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.
let's change this to
producers.NewKubernetesProducer
producers.NewFakeProducer
producers.NewNullProducer
endpoint.Hostname = fmt.Sprintf("%s.%s", randomString(6), a.targetDomain) | ||
case fixedMode: | ||
case "fixed": |
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.
you still have those modes defined as const
up there. We should use them. Also I think it's a good idea.
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.
yup, adding back
I think this is a very valuable PR for mate 👍 I would be glad if you can sneak in the changes I proposed as well. |
@linki thanks for valuable comments :) please take a look again |
awesome @ideahitme |
one last thing... |
if err != nil { | ||
return nil, err | ||
} | ||
func NewSynchronizedConsumer(consumer Consumer) (Consumer, error) { | ||
return &SyncedConsumer{Consumer: consumer}, nil |
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.
let's also change this struct name
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.
@linki done :)
👍 |