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
show ports in table after deployment / inspect #1430
Conversation
@steiler yeah, I agree having a long table is not great. |
Alright, so the port-bindings field in now part of the auto.tmpl. Hence will be outputted as part of the topology-data.json. |
So we have the below now.
|
types/types.go
Outdated
@@ -129,7 +129,7 @@ type NodeConfig struct { | |||
// Bind mounts strings (src:dest:options). | |||
Binds []string `json:"binds,omitempty"` | |||
// PortBindings define the bindings between the container ports and host ports | |||
PortBindings nat.PortMap `json:"portbindings,omitempty"` | |||
PortBindings nat.PortMap `json:"-"` |
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.
was this removed for testing?
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 you removed it because portbindings is now substituted by port-bindings
which is calculated based on runtime state?
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.
Yes the latter was my thinking. The assumption is, that you're interested in the actual running state, which is a concret port per mapping and the possible range is pretty much of no interest...
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.
clab/export.go
Outdated
gc, err := n.GetContainers(ctx) | ||
if err != nil { | ||
return 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.
@steiler works nicely, this piece is the only thing that I am hesitant about.
Doing an API Get for all nodes just to fetch port bindings is not optimal:
- not all nodes have port bindings defined.
ADD1: unless we do not call the Get API when no port bindings are defined. - and even if they have them, maybe we can just update the binding information once we created the node? I wonder if we already receive the port binding info as a result of a container create?
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.
since you've now made it part of NodeConfig, we should be able to get this info earlier on as part of the deployment, yes.
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.
I remembered, that we had a function designed just for this
see 9e5952e
Codecov Report
@@ Coverage Diff @@
## main #1430 +/- ##
==========================================
- Coverage 20.58% 20.51% -0.07%
==========================================
Files 58 58
Lines 6558 6579 +21
==========================================
Hits 1350 1350
- Misses 5085 5106 +21
Partials 123 123
|
Thanks @steiler |
What is not sooo nice is, that the table gets wider and you therefore have to have a wider screen to not have any line breaks within a row.
another option might be to also introduce a port command as docker has, to figure out the ports in a seperate output.
This cmd lists port bindings: