mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #26677 from Microsoft/jjh/networkendpointlist
Windows OCI: Remove endpoint list
This commit is contained in:
commit
dc8631ea53
6 changed files with 43 additions and 42 deletions
|
@ -69,34 +69,6 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
|
||||||
s.Root.Path = c.BaseFS
|
s.Root.Path = c.BaseFS
|
||||||
s.Root.Readonly = c.HostConfig.ReadonlyRootfs
|
s.Root.Readonly = c.HostConfig.ReadonlyRootfs
|
||||||
|
|
||||||
// In s.Windows.Networking
|
|
||||||
// Connect all the libnetwork allocated networks to the container
|
|
||||||
var epList []string
|
|
||||||
if c.NetworkSettings != nil {
|
|
||||||
for n := range c.NetworkSettings.Networks {
|
|
||||||
sn, err := daemon.FindNetwork(n)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
ep, err := c.GetEndpointInNetwork(sn)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := ep.DriverInfo()
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if data["hnsid"] != nil {
|
|
||||||
epList = append(epList, data["hnsid"].(string))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s.Windows.Networking = &windowsoci.WindowsNetworking{
|
|
||||||
EndpointList: epList,
|
|
||||||
}
|
|
||||||
|
|
||||||
// In s.Windows.Resources
|
// In s.Windows.Resources
|
||||||
// @darrenstahlmsft implement these resources
|
// @darrenstahlmsft implement these resources
|
||||||
cpuShares := uint64(c.HostConfig.CPUShares)
|
cpuShares := uint64(c.HostConfig.CPUShares)
|
||||||
|
|
|
@ -51,10 +51,37 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
|
||||||
layerOpts.LayerPaths = append([]string{layerPath}, layerOpts.LayerPaths...)
|
layerOpts.LayerPaths = append([]string{layerPath}, layerOpts.LayerPaths...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get endpoints for the libnetwork allocated networks to the container
|
||||||
|
var epList []string
|
||||||
|
if container.NetworkSettings != nil {
|
||||||
|
for n := range container.NetworkSettings.Networks {
|
||||||
|
sn, err := daemon.FindNetwork(n)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ep, err := container.GetEndpointInNetwork(sn)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := ep.DriverInfo()
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if data["hnsid"] != nil {
|
||||||
|
epList = append(epList, data["hnsid"].(string))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now build the full set of options
|
// Now build the full set of options
|
||||||
createOptions = append(createOptions, &libcontainerd.FlushOption{IgnoreFlushesDuringBoot: !container.HasBeenStartedBefore})
|
createOptions = append(createOptions, &libcontainerd.FlushOption{IgnoreFlushesDuringBoot: !container.HasBeenStartedBefore})
|
||||||
createOptions = append(createOptions, hvOpts)
|
createOptions = append(createOptions, hvOpts)
|
||||||
createOptions = append(createOptions, layerOpts)
|
createOptions = append(createOptions, layerOpts)
|
||||||
|
if epList != nil {
|
||||||
|
createOptions = append(createOptions, &libcontainerd.NetworkEndpointsOption{Endpoints: epList})
|
||||||
|
}
|
||||||
|
|
||||||
return &createOptions, nil
|
return &createOptions, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,10 +106,6 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
|
||||||
HvPartition: false,
|
HvPartition: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
if spec.Windows.Networking != nil {
|
|
||||||
configuration.EndpointList = spec.Windows.Networking.EndpointList
|
|
||||||
}
|
|
||||||
|
|
||||||
if spec.Windows.Resources != nil {
|
if spec.Windows.Resources != nil {
|
||||||
if spec.Windows.Resources.CPU != nil {
|
if spec.Windows.Resources.CPU != nil {
|
||||||
if spec.Windows.Resources.CPU.Shares != nil {
|
if spec.Windows.Resources.CPU.Shares != nil {
|
||||||
|
@ -151,6 +147,9 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
|
||||||
}
|
}
|
||||||
if l, ok := option.(*LayerOption); ok {
|
if l, ok := option.(*LayerOption); ok {
|
||||||
layerOpt = l
|
layerOpt = l
|
||||||
|
}
|
||||||
|
if n, ok := option.(*NetworkEndpointsOption); ok {
|
||||||
|
configuration.EndpointList = n.Endpoints
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,13 @@ type Stats hcsshim.Statistics
|
||||||
// Resources defines updatable container resource values.
|
// Resources defines updatable container resource values.
|
||||||
type Resources struct{}
|
type Resources struct{}
|
||||||
|
|
||||||
// ServicingOption is an empty CreateOption with a no-op application that signifies
|
// ServicingOption is a CreateOption with a no-op application that signifies
|
||||||
// the container needs to be used for a Windows servicing operation.
|
// the container needs to be used for a Windows servicing operation.
|
||||||
type ServicingOption struct {
|
type ServicingOption struct {
|
||||||
IsServicing bool
|
IsServicing bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlushOption is an empty CreateOption that signifies if the container should be
|
// FlushOption is a CreateOption that signifies if the container should be
|
||||||
// started with flushes ignored until boot has completed. This is an optimisation
|
// started with flushes ignored until boot has completed. This is an optimisation
|
||||||
// for first boot of a container.
|
// for first boot of a container.
|
||||||
type FlushOption struct {
|
type FlushOption struct {
|
||||||
|
@ -61,6 +61,12 @@ type LayerOption struct {
|
||||||
LayerPaths []string
|
LayerPaths []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkEndpointsOption is a CreateOption that provides the runtime list
|
||||||
|
// of network endpoints to which a container should be attached during its creation.
|
||||||
|
type NetworkEndpointsOption struct {
|
||||||
|
Endpoints []string
|
||||||
|
}
|
||||||
|
|
||||||
// Checkpoint holds the details of a checkpoint (not supported in windows)
|
// Checkpoint holds the details of a checkpoint (not supported in windows)
|
||||||
type Checkpoint struct {
|
type Checkpoint struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
|
@ -34,3 +34,8 @@ func (h *HyperVIsolationOption) Apply(interface{}) error {
|
||||||
func (h *LayerOption) Apply(interface{}) error {
|
func (h *LayerOption) Apply(interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply for the network endpoints option is a no-op.
|
||||||
|
func (s *NetworkEndpointsOption) Apply(interface{}) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -37,8 +37,6 @@ type Spec struct {
|
||||||
type Windows struct {
|
type Windows struct {
|
||||||
// Resources contains information for handling resource constraints for the container
|
// Resources contains information for handling resource constraints for the container
|
||||||
Resources *WindowsResources `json:"resources,omitempty"`
|
Resources *WindowsResources `json:"resources,omitempty"`
|
||||||
// Networking contains the platform specific network settings for the container.
|
|
||||||
Networking *WindowsNetworking `json:"networking,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process contains information to start a specific application inside the container.
|
// Process contains information to start a specific application inside the container.
|
||||||
|
@ -116,12 +114,6 @@ type Mount struct {
|
||||||
Options []string `json:"options,omitempty"`
|
Options []string `json:"options,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// WindowsNetworking contains the platform specific network settings for the container
|
|
||||||
type WindowsNetworking struct {
|
|
||||||
// List of endpoints to be attached to the container
|
|
||||||
EndpointList []string `json:"endpoints,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// WindowsStorage contains storage resource management settings
|
// WindowsStorage contains storage resource management settings
|
||||||
type WindowsStorage struct {
|
type WindowsStorage struct {
|
||||||
// Specifies maximum Iops for the system drive
|
// Specifies maximum Iops for the system drive
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue