本文整理汇总了Golang中github.com/juju/juju/apiserver/params.ContainerManagerConfig.ManagerConfig方法的典型用法代码示例。如果您正苦于以下问题:Golang ContainerManagerConfig.ManagerConfig方法的具体用法?Golang ContainerManagerConfig.ManagerConfig怎么用?Golang ContainerManagerConfig.ManagerConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/apiserver/params.ContainerManagerConfig
的用法示例。
在下文中一共展示了ContainerManagerConfig.ManagerConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ContainerManagerConfig
// ContainerManagerConfig returns information from the environment config that is
// needed for configuring the container manager.
func (p *ProvisionerAPI) ContainerManagerConfig(args params.ContainerManagerConfigParams) (params.ContainerManagerConfig, error) {
var result params.ContainerManagerConfig
config, err := p.st.EnvironConfig()
if err != nil {
return result, err
}
cfg := make(map[string]string)
cfg[container.ConfigName] = container.DefaultNamespace
switch args.Type {
case instance.LXC:
if useLxcClone, ok := config.LXCUseClone(); ok {
cfg["use-clone"] = fmt.Sprint(useLxcClone)
}
if useLxcCloneAufs, ok := config.LXCUseCloneAUFS(); ok {
cfg["use-aufs"] = fmt.Sprint(useLxcCloneAufs)
}
if lxcDefaultMTU, ok := config.LXCDefaultMTU(); ok {
logger.Debugf("using default MTU %v for all LXC containers NICs", lxcDefaultMTU)
cfg[container.ConfigLXCDefaultMTU] = fmt.Sprintf("%d", lxcDefaultMTU)
}
}
if !environs.AddressAllocationEnabled() {
// No need to even try checking the environ for support.
logger.Debugf("address allocation feature flag not enabled")
result.ManagerConfig = cfg
return result, nil
}
// Create an environment to verify networking support.
env, err := environs.New(config)
if err != nil {
return result, err
}
if netEnv, ok := environs.SupportsNetworking(env); ok {
// Passing network.AnySubnet below should be interpreted by
// the provider as "does ANY subnet support this".
supported, err := netEnv.SupportsAddressAllocation(network.AnySubnet)
if err == nil && supported {
cfg[container.ConfigIPForwarding] = "true"
} else if err != nil {
// We log the error, but it's safe to ignore as it's not
// critical.
logger.Debugf("address allocation not supported (%v)", err)
}
// AWS requires NAT in place in order for hosted containers to
// reach outside.
if config.Type() == provider.EC2 {
cfg[container.ConfigEnableNAT] = "true"
}
}
result.ManagerConfig = cfg
return result, nil
}
示例2: ContainerManagerConfig
// ContainerManagerConfig returns information from the environment config that is
// needed for configuring the container manager.
func (p *ProvisionerAPI) ContainerManagerConfig(args params.ContainerManagerConfigParams) (params.ContainerManagerConfig, error) {
var result params.ContainerManagerConfig
cfg := make(map[string]string)
cfg[container.ConfigModelUUID] = p.st.ModelUUID()
switch args.Type {
case instance.LXD:
// TODO(jam): DefaultMTU needs to be handled here
// TODO(jam): Do we want to handle ImageStream here, or do we
// hide it from them? (all cached images must come from the
// same image stream?)
}
result.ManagerConfig = cfg
return result, nil
}
示例3: ContainerManagerConfig
// ContainerManagerConfig returns information from the environment config that is
// needed for configuring the container manager.
func (p *ProvisionerAPI) ContainerManagerConfig(args params.ContainerManagerConfigParams) (params.ContainerManagerConfig, error) {
var result params.ContainerManagerConfig
config, err := p.st.EnvironConfig()
if err != nil {
return result, err
}
cfg := make(map[string]string)
cfg[container.ConfigName] = "juju"
switch args.Type {
case instance.LXC:
if useLxcClone, ok := config.LXCUseClone(); ok {
cfg["use-clone"] = fmt.Sprint(useLxcClone)
}
if useLxcCloneAufs, ok := config.LXCUseCloneAUFS(); ok {
cfg["use-aufs"] = fmt.Sprint(useLxcCloneAufs)
}
}
result.ManagerConfig = cfg
return result, nil
}