✨ feat(eci): 支持通过注解指定ECS规格
All checks were successful
Virtual Kubelet Docker Build and Deploy / build-and-deploy (push) Successful in 4m30s
All checks were successful
Virtual Kubelet Docker Build and Deploy / build-and-deploy (push) Successful in 4m30s
- 添加对k8s.aliyun.com/eci-use-specs注解的解析 - 将注解值作为InstanceType参数传递给ECI创建请求
This commit is contained in:
7
eci.go
7
eci.go
@@ -185,6 +185,13 @@ func (p *ECIProvider) CreatePod(ctx context.Context, pod *v1.Pod) error {
|
||||
request := eci.CreateCreateContainerGroupRequest()
|
||||
request.RestartPolicy = string(pod.Spec.RestartPolicy)
|
||||
|
||||
// 解析ECS规格注解
|
||||
if pod.Annotations != nil {
|
||||
if specs, exists := pod.Annotations["k8s.aliyun.com/eci-use-specs"]; exists {
|
||||
request.InstanceType = specs
|
||||
}
|
||||
}
|
||||
|
||||
// 添加抢占式实例策略配置
|
||||
request.SpotStrategy = "SpotAsPriceGo" // 设置抢占式实例策略为按价格竞价
|
||||
//request.SpotDuration = 0 // 设置抢占式实例持续时间为0(非定时抢占)
|
||||
|
||||
Reference in New Issue
Block a user