mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add DefaultAddressPools to docker info #40388
Signed-off-by: Wang Yumu <37442693@qq.com>
This commit is contained in:
parent
260c26b7be
commit
840a12ac90
3 changed files with 45 additions and 9 deletions
|
@ -4676,6 +4676,25 @@ definitions:
|
||||||
such as number of nodes, and expiration are included.
|
such as number of nodes, and expiration are included.
|
||||||
type: "string"
|
type: "string"
|
||||||
example: "Community Engine"
|
example: "Community Engine"
|
||||||
|
DefaultAddressPools:
|
||||||
|
description: |
|
||||||
|
List of custom default address pools for local networks, which can be
|
||||||
|
specified in the daemon.json file or dockerd option.
|
||||||
|
|
||||||
|
Example: a Base "10.10.0.0/16" with Size 24 will define the set of 256
|
||||||
|
10.10.[0-255].0/24 address pools.
|
||||||
|
type: "array"
|
||||||
|
items:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
Base:
|
||||||
|
description: "The network address in CIDR format"
|
||||||
|
type: "string"
|
||||||
|
example: "10.10.0.0/16"
|
||||||
|
Size:
|
||||||
|
description: "The network pool size"
|
||||||
|
type: "integer"
|
||||||
|
example: "24"
|
||||||
Warnings:
|
Warnings:
|
||||||
description: |
|
description: |
|
||||||
List of warnings / informational messages about missing features, or
|
List of warnings / informational messages about missing features, or
|
||||||
|
|
|
@ -203,15 +203,16 @@ type Info struct {
|
||||||
// LiveRestoreEnabled determines whether containers should be kept
|
// LiveRestoreEnabled determines whether containers should be kept
|
||||||
// running when the daemon is shutdown or upon daemon start if
|
// running when the daemon is shutdown or upon daemon start if
|
||||||
// running containers are detected
|
// running containers are detected
|
||||||
LiveRestoreEnabled bool
|
LiveRestoreEnabled bool
|
||||||
Isolation container.Isolation
|
Isolation container.Isolation
|
||||||
InitBinary string
|
InitBinary string
|
||||||
ContainerdCommit Commit
|
ContainerdCommit Commit
|
||||||
RuncCommit Commit
|
RuncCommit Commit
|
||||||
InitCommit Commit
|
InitCommit Commit
|
||||||
SecurityOptions []string
|
SecurityOptions []string
|
||||||
ProductLicense string `json:",omitempty"`
|
ProductLicense string `json:",omitempty"`
|
||||||
Warnings []string
|
DefaultAddressPools []NetworkAddressPool
|
||||||
|
Warnings []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyValue holds a key/value pair
|
// KeyValue holds a key/value pair
|
||||||
|
@ -219,6 +220,12 @@ type KeyValue struct {
|
||||||
Key, Value string
|
Key, Value string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkAddressPool is a temp struct used by Info struct
|
||||||
|
type NetworkAddressPool struct {
|
||||||
|
Base string
|
||||||
|
Size int
|
||||||
|
}
|
||||||
|
|
||||||
// SecurityOpt contains the name and options of a security option
|
// SecurityOpt contains the name and options of a security option
|
||||||
type SecurityOpt struct {
|
type SecurityOpt struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
|
@ -78,6 +78,7 @@ func (daemon *Daemon) SystemInfo() *types.Info {
|
||||||
daemon.fillPluginsInfo(v)
|
daemon.fillPluginsInfo(v)
|
||||||
daemon.fillSecurityOptions(v, sysInfo)
|
daemon.fillSecurityOptions(v, sysInfo)
|
||||||
daemon.fillLicense(v)
|
daemon.fillLicense(v)
|
||||||
|
daemon.fillDefaultAddressPools(v)
|
||||||
|
|
||||||
if v.DefaultRuntime == config.LinuxV1RuntimeName {
|
if v.DefaultRuntime == config.LinuxV1RuntimeName {
|
||||||
v.Warnings = append(v.Warnings, fmt.Sprintf("Configured default runtime %q is deprecated and will be removed in the next release.", config.LinuxV1RuntimeName))
|
v.Warnings = append(v.Warnings, fmt.Sprintf("Configured default runtime %q is deprecated and will be removed in the next release.", config.LinuxV1RuntimeName))
|
||||||
|
@ -229,6 +230,15 @@ func (daemon *Daemon) fillAPIInfo(v *types.Info) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (daemon *Daemon) fillDefaultAddressPools(v *types.Info) {
|
||||||
|
for _, pool := range daemon.configStore.DefaultAddressPools.Value() {
|
||||||
|
v.DefaultAddressPools = append(v.DefaultAddressPools, types.NetworkAddressPool{
|
||||||
|
Base: pool.Base,
|
||||||
|
Size: pool.Size,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func hostName() string {
|
func hostName() string {
|
||||||
hostname := ""
|
hostname := ""
|
||||||
if hn, err := os.Hostname(); err != nil {
|
if hn, err := os.Hostname(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue