-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix docker stack services command Port output #943
Fix docker stack services command Port output #943
Conversation
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 🐯
@@ -172,3 +172,16 @@ func findService(services *apiv1.ServiceList, name string) (apiv1.Service, bool) | |||
} | |||
return apiv1.Service{}, false | |||
} | |||
|
|||
func makeServiceEndpoint(service apiv1.Service, publishMode swarm.PortConfigPublishMode) swarm.Endpoint { |
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.
nit: s/makeServiceEndpoint/serviceEndoint
? 😛
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.
Fixed
22903e0
to
1615089
Compare
Codecov Report
@@ Coverage Diff @@
## master #943 +/- ##
==========================================
+ Coverage 53.92% 54.22% +0.29%
==========================================
Files 262 262
Lines 16604 16610 +6
==========================================
+ Hits 8954 9007 +53
+ Misses 7049 7001 -48
- Partials 601 602 +1 |
…ice is a LoadBalancer or a NodePort * added tests on Kubernetes service conversion to swarm service Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
1615089
to
b816bde
Compare
@@ -116,25 +116,31 @@ func (t tasksBySlot) Less(i, j int) bool { | |||
return t[j].Meta.CreatedAt.Before(t[i].CreatedAt) | |||
} | |||
|
|||
const ( | |||
publishedServiceSuffix = "-published" | |||
publishedOnRandomPortSuffix = "-random-ports" |
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.
nit: There was some discussion around naming of this; as they're not fully "random", but "selected from an ephemeral range"
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.
Ok, good to know, but unfortunately these names are defined in the already shipped compose controller...
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.
Yeah, probably not a big issue, it's just that they are not really "random" (could be sequential), so "ephemeral" is possibly a better description.
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, thanks!
- What I did
A previous fix on the Kubernetes Compose Controller created two services when ports are exposed, one headless (its type is ClusterIP) and another with the exposed port (its type is LoadBalancer). The
services
command wasn't looking at the right place for the exposed ports, so now it prints the exposed ports defined in the LoadBalancer service.- How I did it
I identify the corresponding LoadBalancer service, suffixed by "-published" in its name.
- How to verify it
Deploy a stack with an exposed port:
Before the fix:
After the fix:
- Description for the changelog
Fix
docker stack services
PORTS column on Kubernetes.- A picture of a cute animal (not mandatory but encouraged)