-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support Marathon 1.5 Network API #283
Conversation
apps/app.go
Outdated
@@ -162,14 +167,22 @@ type indexedPortDefinition struct { | |||
} | |||
|
|||
func (app App) findConsulPortDefinitions() []indexedPortDefinition { | |||
var appPortDefinitions []PortDefinition | |||
if len(app.Container.PortMappings) > 0 { |
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 a comment here with information about deprecation of PortDefinitons
in favour of PortMappings
and link to Marathon release notes?
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 can extract this part to a function with proper godoc. e.g.
func (app App) getPortDefinitions() []PortDefinition {
var appPortDefinitions []PortDefinition
if len(app.Container.PortMappings) > 0 {
appPortDefinitions = app.Container.PortMappings
} else {
appPortDefinitions = app.PortDefinitions
}
return appPortDefinitions
}
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 a test for this change?
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.
Sounds good. Added the changes and unittest
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.
Thanks for nice patch. It looks like it's backward compatible, cool! Please add a comment with information about why we need this logic and a test for this logic.
apps/app.go
Outdated
// Deprecated: Allows for backward compatibility with Marathons' network API | ||
// PortDefinitions are deprecated in favor of Marathons' new PortMappings | ||
// see https://github.com/mesosphere/marathon/pull/5391 | ||
func extractPortDefinitions(app *App) []PortDefinition { |
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 not a struct receiver?
func (app App) extractPortDefinitions()
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.
Good suggestion. I'll update.
@zanes2016 Thanks a lot! |
@janisz No problem! Thanks for the quick feedback |
I've manually tested this end-to-end with Marathon, Consul, and this new binary. This patch addresses issue #230
I'm able to manually compile this code using native
go run
. But I'm not able to runmake build
, etc. So maybe someone (@janisz) can test this?