Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

refactoring mate config #68

Merged
merged 9 commits into from
Jan 25, 2017
Merged

refactoring mate config #68

merged 9 commits into from
Jan 25, 2017

Conversation

ideahitme
Copy link
Contributor

@ideahitme ideahitme commented Jan 17, 2017

  1. Create config.go to store all mate configurations
  2. Remove flags initialisation from all internal packages (this is generally a bad practice to do so)
  3. Make internal packages more independent and actually "invocable"

@ideahitme ideahitme removed the wip label Jan 20, 2017
@ideahitme
Copy link
Contributor Author

@linki I would like to hear your opinion on this :)


KubeServer *url.URL
KubeFormat string
TrackNodePorts bool
Copy link
Owner

@linki linki Jan 20, 2017

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)

Copy link
Contributor Author

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)
Copy link
Owner

@linki linki Jan 20, 2017

Choose a reason for hiding this comment

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

use newSyncedConsumer

Copy link
Owner

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()
Copy link
Owner

@linki linki Jan 20, 2017

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()
Copy link
Owner

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":
Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, adding back

@linki
Copy link
Owner

linki commented Jan 20, 2017

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.

@ideahitme
Copy link
Contributor Author

@linki thanks for valuable comments :) please take a look again

@ideahitme ideahitme changed the title start refactoring mate config refactoring mate config Jan 20, 2017
@linki
Copy link
Owner

linki commented Jan 20, 2017

awesome @ideahitme

@linki
Copy link
Owner

linki commented Jan 20, 2017

one last thing...

if err != nil {
return nil, err
}
func NewSynchronizedConsumer(consumer Consumer) (Consumer, error) {
return &SyncedConsumer{Consumer: consumer}, nil
Copy link
Owner

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@linki done :)

@linki
Copy link
Owner

linki commented Jan 25, 2017

👍

@linki linki merged commit 34a37b4 into master Jan 25, 2017
@ideahitme ideahitme deleted the refactor-flag-config branch January 27, 2017 18:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants