Alibaba Cloud ECI(Elastic Container Instance) is a service that allow you run containers without having to manage servers or clusters. This commit add ECI provider for virtual kubelet, connects ECI with kubernetes cluster. Signed-off-by: xianwei.zw <xianwei.zw@alibaba-inc.com> Signed-off-by: shidao.ytt <shidao.ytt@alibaba-inc.com>
52 lines
953 B
Go
52 lines
953 B
Go
package alicloud
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/BurntSushi/toml"
|
|
"github.com/virtual-kubelet/virtual-kubelet/providers"
|
|
)
|
|
|
|
type providerConfig struct {
|
|
Region string
|
|
OperatingSystem string
|
|
CPU string
|
|
Memory string
|
|
Pods string
|
|
VSwitch string
|
|
SecureGroup string
|
|
}
|
|
|
|
func (p *ECIProvider) loadConfig(r io.Reader) error {
|
|
var config providerConfig
|
|
if _, err := toml.DecodeReader(r, &config); err != nil {
|
|
return err
|
|
}
|
|
|
|
p.region = config.Region
|
|
if p.region == "" {
|
|
p.region = "cn-hangzhou"
|
|
}
|
|
|
|
p.vSwitch = config.VSwitch
|
|
p.secureGroup = config.SecureGroup
|
|
|
|
p.cpu = config.CPU
|
|
if p.cpu == "" {
|
|
p.cpu = "20"
|
|
}
|
|
p.memory = config.Memory
|
|
if p.memory == "" {
|
|
p.memory = "100Gi"
|
|
}
|
|
p.pods = config.Pods
|
|
if p.pods == "" {
|
|
p.pods = "20"
|
|
}
|
|
p.operatingSystem = config.OperatingSystem
|
|
if p.operatingSystem == "" {
|
|
p.operatingSystem = providers.OperatingSystemLinux
|
|
}
|
|
return nil
|
|
}
|