mirror of
https://github.com/containers/podman.git
synced 2025-06-28 14:29:04 +08:00
Merge pull request #8251 from baude/networkaliases
network aliases for container creation
This commit is contained in:
@ -131,8 +131,9 @@ func (f FirewallConfig) Bytes() ([]byte, error) {
|
||||
|
||||
// DNSNameConfig describes the dns container name resolution plugin config
|
||||
type DNSNameConfig struct {
|
||||
PluginType string `json:"type"`
|
||||
DomainName string `json:"domainName"`
|
||||
PluginType string `json:"type"`
|
||||
DomainName string `json:"domainName"`
|
||||
Capabilities map[string]bool `json:"capabilities"`
|
||||
}
|
||||
|
||||
// Bytes outputs the configuration as []byte
|
||||
|
@ -122,9 +122,12 @@ func NewFirewallPlugin() FirewallConfig {
|
||||
// NewDNSNamePlugin creates the dnsname config with a given
|
||||
// domainname
|
||||
func NewDNSNamePlugin(domainName string) DNSNameConfig {
|
||||
caps := make(map[string]bool, 1)
|
||||
caps["aliases"] = true
|
||||
return DNSNameConfig{
|
||||
PluginType: "dnsname",
|
||||
DomainName: domainName,
|
||||
PluginType: "dnsname",
|
||||
DomainName: domainName,
|
||||
Capabilities: caps,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,13 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Re
|
||||
podName := getCNIPodName(ctr)
|
||||
|
||||
podNetwork := r.getPodNetwork(ctr.ID(), podName, ctrNS.Path(), ctr.config.Networks, ctr.config.PortMappings, requestedIP, requestedMAC)
|
||||
aliases, err := ctr.runtime.state.GetAllNetworkAliases(ctr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(aliases) > 0 {
|
||||
podNetwork.Aliases = aliases
|
||||
}
|
||||
|
||||
results, err := r.netPlugin.SetUpPod(podNetwork)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user