Update VCH inspect API to output TLS friendly docker host and admin portal address#7533
Update VCH inspect API to output TLS friendly docker host and admin portal address#7533AngieCris merged 11 commits intovmware:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7533 +/- ##
=========================================
- Coverage 31.51% 31.42% -0.1%
=========================================
Files 281 281
Lines 42020 42042 +22
=========================================
- Hits 13244 13210 -34
- Misses 27616 27671 +55
- Partials 1160 1161 +1
Continue to review full report at Codecov.
|
| model.Runtime.DockerHost, model.Runtime.AdminPortal = getAddresses(vchConfig) | ||
| model.Runtime.DockerHost, model.Runtime.AdminPortal, err = getAddresses(executor, vchConfig) | ||
| if err != nil { | ||
| op.Warn("No client IP assigned.") |
There was a problem hiding this comment.
How about logging err instead of "No client IP assigned." (In this case, it's basically the same message, but if we ever add another error to getAddresses, this might be misleading.)
| dockerHost, adminPortal = getAddresses(vchConfig) | ||
| dockerHost, adminPortal, err = getAddresses(executor, vchConfig) | ||
| if err != nil { | ||
| op.Warnf("No client IP address assigned for VCH %s", id) |
There was a problem hiding this comment.
As above; we should base the log message on err instead.
|
|
||
| dockerHost := "" | ||
| if !vchConfig.HostCertificate.IsNil() { | ||
| dockerHost = fmt.Sprintf("%s:%d", hostIP, opts.DefaultTLSHTTPPort) |
There was a problem hiding this comment.
I think the pattern from the old code, where we set a dockerPort based on vchConfig.HostCertificate.IsNil() and then have a single dockerHost = fmt.Sprintf("%s:%d", publicIP, dockerPort) is a little cleaner.
|
@mhagen-vmware This change is to update API to behave the same as CLI, the API related tests will be added later in #7290, including both positive and negative tests. |
zjs
left a comment
There was a problem hiding this comment.
But running 6-09 on CI now throws an error if
--resource-poolis not given, so I added that to the test suite.
Is this a bug? It doesn't seem like resource pool should be required for inspect.
| hostIP = executor.GetTLSFriendlyHostIP(clientIP, cert, vchConfig.CertificateAuthorities) | ||
| } | ||
|
|
||
| var dockerPort string |
There was a problem hiding this comment.
Why not just define dockerPort as an integer? That should avoid the need to fmt.Sprintf("%d", below.
There was a problem hiding this comment.
I was trying to mimic CLI implementation:
if !conf.HostCertificate.IsNil() {
d.DockerPort = fmt.Sprintf("%d", opts.DefaultTLSHTTPPort)
} else {
d.DockerPort = fmt.Sprintf("%d", opts.DefaultHTTPPort)
}
CLI is setting the d.DockerPort field of type string in executor, but in API we're not using the docker IP/port from executor fields.
Fixing it now.
|
@zjs mistyped sorry...it's |
|
Our documentation doesn't suggest that |
|
@zjs From the documentation:
Also here:
When I was testing against my nimbus VC, I have to provide |
…ortal address (vmware#7533) 1. Update VCH inspect API to output TLS friendly docker host and admin portal address 2. Include --compute-resource for vic-machine commands in robot tests
…ortal address (vmware#7533) 1. Update VCH inspect API to output TLS friendly docker host and admin portal address 2. Include --compute-resource for vic-machine commands in robot tests
[specific ci=6-09-Inspect]Fixes #7321
--compute-resourcefor vic-machine commands in robot testsAPI related tests are going to be in PR: #7290
(#7290 is blocked by this PR)