-
Notifications
You must be signed in to change notification settings - Fork 173
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
[specific ci=Group23-VIC-Machine-Service] container-name-convention support added to vic-machine API #6634
[specific ci=Group23-VIC-Machine-Service] container-name-convention support added to vic-machine API #6634
Conversation
@@ -266,6 +266,10 @@ func vchToModel(op trace.Operation, vch *vm.VirtualMachine, d *data.Data, execut | |||
model.SyslogAddr = strfmt.URI(syslogConfig.Network + "://" + syslogConfig.RAddr) | |||
} | |||
|
|||
if containerNameConvention := vchConfig.ContainerNameConvention; containerNameConvention != "" { |
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.
Could we simply do this here?
if vchConfig.ContainerNameConvention != "" {
model.ContainerNameConvention = vchConfig.ContainerNameConvention
}
lib/apiservers/service/swagger.json
Outdated
@@ -803,6 +803,10 @@ | |||
"type": "string", | |||
"format": "uri", | |||
"pattern": "^(tc|ud)p:\/\/.*" | |||
}, | |||
"container_name_convention": { |
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.
Based on the comments in vic-machine/common/container.go
, it seems like we expect more container-related properties to be added in the future:
// other container flags to to added"
// default container memory
// default container cpu
// default container network
Given that, I think this should probably be structured along the lines of the following to give us more flexibility to eventually represent those properties as a part of this JSON structure:
"container": {
"type": "object",
"properties": {
"name_convention": {
"type": "string",
"pattern": "^.*(\\{id\\}|\\{name\\}).*"
}
}
}
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 point, thanks
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
@AngieCris #6527 is closed which this PR is referring to for adding integration tests. Does that mean we need to add tests as part of this then for scenarios covered here? |
@mdharamadas1 adding tests for this functionality now, will let you know when it's done |
2faf0a5
to
c98e4aa
Compare
e2957ac
to
66411cf
Compare
1c89e96
to
bf5b2f7
Compare
bf5b2f7
to
66411cf
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.
Looks good!
Currently the integration test only verifies of inspect output contains the container naming convention supplied when creating the specific VCH. |
dfd6a3a
to
eb07b69
Compare
6d0e535
to
9576e8e
Compare
2d7026a
to
99035e4
Compare
009a4ac
to
bb141ee
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
Fixes #6503
container-name-convention support is now added to vic-machine create API and inspect API.
Details
POST request body includes a
container
object that specifies the configurations for containers on the VCH such as network, CPU, memory (not implemented yet). Withincontainer
field,name_convention
field is a string that specifies a naming convention for vSphere display names for containers.name_convention
must contain either{id}
or{name}
as token (including both tokens in naming convention is currently not supported).For example, if the naming convention is
container-{id}
and there's a container running on the VCH, the vSphere display name for this container would becontainer-short_id
whereshort_id
is the short ID of that container.Note that this only changes the display names of containers on vSphere, not actual Docker container names.
An example of vic-machine create API request body:
The response body of POST request now includes a field
name_convention
field undercontainer
of type string that specifies the vSphere display naming convention for containers running on the VCH.Example vic-machine inspect GET response body:
Remaining work
In integration test, verify container naming convention with docker