Add Alibaba Cloud ECI Provider

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>
This commit is contained in:
shidao-ytt
2018-09-18 22:59:32 +08:00
parent 101baecc86
commit e9d17c23d3
5 changed files with 918 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
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
}