-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Homogenization of the providers (part 1) #2518
Homogenization of the providers (part 1) #2518
Conversation
59d7949
to
1787729
Compare
tmpl := p.frontEndRuleTemplate | ||
tmpl, err := tmpl.Parse(customFrontendRule) | ||
if err != nil { | ||
log.Errorf("failed to parse Consul Catalog custom frontend rule: %s", err) |
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.
Can you upper case it?
var buffer bytes.Buffer | ||
err = tmpl.Execute(&buffer, templateObjects) | ||
if err != nil { | ||
log.Errorf("failed to execute Consul Catalog custom frontend rule template: %s", err) |
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.
Can you upper case it?
return func(app *marathon.Application) { | ||
app.AddLabel(types.LabelPrefix+serviceName+"."+property, value) | ||
app.AddLabel(label.Prefix+serviceName+"."+property, value) |
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.
Should not we use fmt.Sprintf
?
tmpl := p.frontEndRuleTemplate | ||
tmpl, err := tmpl.Parse(customFrontendRule) | ||
if err != nil { | ||
log.Errorf("failed to parse Consul Catalog custom frontend rule: %s", err) |
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.
Can you upper case it?
var buffer bytes.Buffer | ||
err = tmpl.Execute(&buffer, templateObjects) | ||
if err != nil { | ||
log.Errorf("failed to execute Consul Catalog custom frontend rule template: %s", err) |
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.
Can you upper case it?
provider/mesos/config_test.go
Outdated
t.Fatalf("expected %#v, got %#v", c.expectedBackends, actualConfig.Backends) | ||
} | ||
if !reflect.DeepEqual(actualConfig.Frontends, c.expectedFrontends) { | ||
t.Fatalf("expected %#v, got %#v", c.expectedFrontends, actualConfig.Frontends) |
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.
Can you upper case it?
provider/mesos/config_test.go
Outdated
|
||
var p = taskRecords(taskState) | ||
if len(p) == 0 { | ||
t.Fatal("taskRecord should return at least one task") |
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.
Can you add the word Function
at the beginning,? Thus the falal log begins with an upper case.
} | ||
|
||
func (p *Provider) getFrontendRule(service rancherData) string { | ||
defaultRule := "Host:" + strings.ToLower(strings.Replace(service.Name, "/", ".", -1)) + "." + p.Domain |
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.
Should not we use fmt.Sprintf
?
provider/consul/consul_catalog.go
Outdated
|
||
data, meta, err := catalog.Services(options) | ||
if err != nil { | ||
log.Errorf("Failed to list services: %s", err) |
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.
Should not we use %v
instead of %s
to log an err
?
provider/consul/consul_catalog.go
Outdated
for key, value := range data { | ||
nodes, _, err := catalog.Service(key, "", &api.QueryOptions{}) | ||
if err != nil { | ||
log.Errorf("Failed to get detail of service %s: %s", key, err) |
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.
Should not we use %v
instead of %s
to log an err
?
1787729
to
73de2bf
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.
LGTM 🎉 👏 🔨
😢 I failed to review this PR, but that's awesome job @ldez 👏 👏 👏 |
What does this PR do?
The first step a the homogenization of the providers.
Rewrite Labels/Annotations system (provider with template)
map[string]string
map[string]string
map[string]string
*map[string]string
map[string]string
task.Labels
map[string]*string
more:
No-Rewrite
Motivation
make it easier to add new label.
More