diff --git a/adaptor/container_api_adaptor/alibaba/eci/config_eci.conf b/adaptor/container_api_adaptor/alibaba/eci/config_eci.conf deleted file mode 100644 index 3f3c6a0e..00000000 --- a/adaptor/container_api_adaptor/alibaba/eci/config_eci.conf +++ /dev/null @@ -1,26 +0,0 @@ -[pod_create_conf] -region_id=cn-hangzhou -#容器实例名称(pod名) 对应阿里 ContainerGroupName(阿里必需) -container_group_name=pcm-test-ali-pod -#镜像地址 对应阿里 Container.Image(阿里必需) -container_image=registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx -#容器名称 对应阿里 Container.Name(阿里必需) -container_name=pcm-test-ali-container - -[pod_delete_conf] -# 地域id -region_id=cn-hangzhou -#容器实例ID -container_group_id=eci-bp1c3eqfq98nz2kbiooo - -[pod_list_conf] -# 地域id -region_id=cn-hangzhou - -[pod_update_conf] -# 地域id -region_id=cn-hangzhou -#容器实例ID -container_group_id=eci-bp1c3eqfq98nz2kbiooo -#可选 这里用重启策略做更新测试 -restart_policy=Never \ No newline at end of file diff --git a/adaptor/container_api_adaptor/alibaba/eci/eci.go b/adaptor/container_api_adaptor/alibaba/eci/eci.go deleted file mode 100644 index c81a7b38..00000000 --- a/adaptor/container_api_adaptor/alibaba/eci/eci.go +++ /dev/null @@ -1,121 +0,0 @@ -package eci - -import ( - "fmt" - "github.com/aliyun/alibaba-cloud-sdk-go/services/eci" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/auth/aksk" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/config" -) - -// CreateContainerGroup 创建 -func CreateContainerGroup(cloudStack string, akskPath string, configPath string) string { - - var client *eci.Client - configCommon, _ := config.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - - //创建客户端 - client, _ = eci.NewClientWithAccessKey(configCommon.RegionId, configAksk.AccessKey, configAksk.SecretKey) - // 生成创建请求 - createContainerRequest := eci.CreateCreateContainerGroupRequest() - // 必需参数 - //区域ID - createContainerRequest.RegionId = configCommon.RegionId - //POD名称 - createContainerRequest.ContainerGroupName = configCommon.ContainerGroupName - //容器名称和镜像名称 - createContainerRequestContainer := make([]eci.CreateContainerGroupContainer, 1) - createContainerRequestContainer[0].Image = configCommon.ContainerImage - createContainerRequestContainer[0].Name = configCommon.ContainerName - createContainerRequest.Container = &createContainerRequestContainer - - client.GetConfig().MaxRetryTime = 0 - createContainerGroupResponse, err := client.CreateContainerGroup(createContainerRequest) - if err != nil { - panic(err) - } - containerGroupId := createContainerGroupResponse.ContainerGroupId - fmt.Println("Alibaba ContainerGroup created:", containerGroupId) - return containerGroupId -} - -// DescribeContainerGroup 查询Pod -func DescribeContainerGroup(cloudStack string, akskPath string, configPath string) eci.DescribeContainerGroupsContainerGroup0 { - var client *eci.Client - - configCommon, _ := config.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - client, _ = eci.NewClientWithAccessKey(configCommon.RegionId, configAksk.AccessKey, configAksk.SecretKey) - - // 生成查询请求 - describeContainerGroupsRequest := eci.CreateDescribeContainerGroupsRequest() - describeContainerGroupsRequest.RegionId = configCommon.RegionIdList - describeContainerGroupsResponse, err := client.DescribeContainerGroups(describeContainerGroupsRequest) - if err != nil { - panic(err) - } - describeContainerGroupNumber := len(describeContainerGroupsResponse.ContainerGroups) - - //当前区域没有Pod情形的处理 - if describeContainerGroupsResponse.TotalCount != 1 && describeContainerGroupNumber != 1 { - fmt.Println("Invalid ContainerGroups count", describeContainerGroupsResponse.TotalCount, describeContainerGroupNumber) - panic("Invalid ContainerGroups count") - } - - fmt.Println("Alibaba ContainerGroup Name:", describeContainerGroupsResponse.ContainerGroups[0].ContainerGroupName, "\n", - "ContainerGroup Id:", describeContainerGroupsResponse.ContainerGroups[0].ContainerGroupId) - - return describeContainerGroupsResponse.ContainerGroups[0] -} - -// UpdateContainerGroup 更新Pod -func UpdateContainerGroup(cloudStack string, akskPath string, configPath string) string { - var client *eci.Client - - configCommon, _ := config.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - - client, _ = eci.NewClientWithAccessKey(configCommon.RegionId, configAksk.AccessKey, configAksk.SecretKey) - - //生成更新请求 - updateContainerGroupRequest := eci.CreateUpdateContainerGroupRequest() - updateContainerGroupRequest.RegionId = configCommon.RegionIdUpdate - updateContainerGroupRequest.ContainerGroupId = configCommon.ContainerGroupIdUpdate - - //容器实体内容,这里测试可以修改配置文件中的重启策略 - updateContainerRequestContainer := make([]eci.UpdateContainerGroupContainer, 1) - updateContainerRequestContainer[0].Image = configCommon.ContainerImage - updateContainerRequestContainer[0].Name = configCommon.ContainerName - updateContainerGroupRequest.Container = &updateContainerRequestContainer - updateContainerGroupRequest.RestartPolicy = configCommon.RestartPolicyUpdate - - updateContainerGroupResponse, err := client.UpdateContainerGroup(updateContainerGroupRequest) - if err != nil { - panic(err) - } - requestId := updateContainerGroupResponse.RequestId - fmt.Println("Alibaba ContainerGroup: ", configCommon.ContainerGroupIdUpdate, " Updated with request ID:", requestId) - return requestId -} - -// DeleteContainerGroup 删除Pod -func DeleteContainerGroup(cloudStack string, akskPath string, configPath string) string { - var client *eci.Client - configCommon, _ := config.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - client, _ = eci.NewClientWithAccessKey(configCommon.RegionId, configAksk.AccessKey, configAksk.SecretKey) - - //生成删除请求 - deleteContainerGroupRequest := eci.CreateDeleteContainerGroupRequest() - deleteContainerGroupRequest.RegionId = configCommon.RegionIdDelete - deleteContainerGroupRequest.ContainerGroupId = configCommon.ContainerGroupIdDelete - - deleteContainerGroupResponse, err := client.DeleteContainerGroup(deleteContainerGroupRequest) - if err != nil { - panic(err) - } - requestId := deleteContainerGroupResponse.RequestId - fmt.Println("Alibaba ContainerGroup: ", configCommon.ContainerGroupIdUpdate, " Deleted with request ID:", requestId) - - return requestId -} diff --git a/adaptor/container_api_adaptor/common/api/common_api.go b/adaptor/container_api_adaptor/common/api/common_api.go deleted file mode 100644 index 88fdad6c..00000000 --- a/adaptor/container_api_adaptor/common/api/common_api.go +++ /dev/null @@ -1,99 +0,0 @@ -package api - -import ( - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/alibaba/eci" - cciAksk "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/auth/aksk" - cci "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/resources/pod" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/tencent/eks" -) - -//CreatePod 创建Pod通用方法 -func CreatePod(cloudStack string, akskPath string, configPath string) { - switch cloudStack { - - case "alibaba": - eci.CreateContainerGroup(cloudStack, akskPath, configPath) - - case "huawei": - cs, err := cciAksk.NewClient(cloudStack, akskPath, configPath) - if err != nil { - panic(err) - } - _, err = cci.CreatePod(cs, configPath) - if err != nil { - return - } - - case "tencent": - eks.CreateEksInstance(cloudStack, akskPath, configPath) - } - -} - -// DeletePod 删除Pod 通用方法 -func DeletePod(cloudStack string, akskPath string, configPath string) { - - switch cloudStack { - - case "alibaba": - eci.DeleteContainerGroup(cloudStack, akskPath, configPath) - - case "huawei": - cs, err := cciAksk.NewClient(cloudStack, akskPath, configPath) - if err != nil { - panic(err) - } - err = cci.DeletePod(cs, configPath) - if err != nil { - return - } - - case "tencent": - eks.DeleteEksInstance(cloudStack, akskPath, configPath) - } -} - -//UpdatePod 更新Pod通用方法 -func UpdatePod(cloudStack string, akskPath string, configPath string) { - - switch cloudStack { - - case "alibaba": - eci.UpdateContainerGroup(cloudStack, akskPath, configPath) - - case "huawei": - cs, err := cciAksk.NewClient(cloudStack, akskPath, configPath) - if err != nil { - panic(err) - } - _, err = cci.UpdatePod(cs, configPath) - if err != nil { - return - } - case "tencent": - eks.UpdateEksInstance(cloudStack, akskPath, configPath) - } -} - -//ListPod 查询Pod通用方法 -func ListPod(cloudStack string, akskPath string, configPath string) { - - switch cloudStack { - - case "alibaba": - eci.DescribeContainerGroup(cloudStack, akskPath, configPath) - - case "huawei": - cs, err := cciAksk.NewClient(cloudStack, akskPath, configPath) - if err != nil { - panic(err) - } - _, err = cci.ListPod(cs, configPath) - if err != nil { - return - } - - case "tencent": - eks.ListEksInstance(cloudStack, akskPath, configPath) - } -} diff --git a/adaptor/container_api_adaptor/common/auth/aksk/akskConfig.go b/adaptor/container_api_adaptor/common/auth/aksk/akskConfig.go deleted file mode 100644 index 62a33c81..00000000 --- a/adaptor/container_api_adaptor/common/auth/aksk/akskConfig.go +++ /dev/null @@ -1,43 +0,0 @@ -package aksk - -import ( - "fmt" - "github.com/Unknwon/goconfig" - "os" -) - -type AkskContainerConfig struct { - AccessKey string - SecretKey string -} - -func AkskConfig(cloudStack string, akskPath string) (AkskContainerConfig, error) { - var cfg *goconfig.ConfigFile - config, err := goconfig.LoadConfigFile(akskPath) - if err != nil { - fmt.Println("get config file error:", err.Error()) - os.Exit(-1) - } - cfg = config - var accessKey string - var secretKey string - switch cloudStack { - - case "alibaba": - accessKey, _ = cfg.GetValue(cloudStack, "access_key") - secretKey, _ = cfg.GetValue(cloudStack, "secret_key") - - case "huawei": - accessKey, _ = cfg.GetValue(cloudStack, "access_key") - secretKey, _ = cfg.GetValue(cloudStack, "secret_key") - case "tencent": - accessKey, _ = cfg.GetValue(cloudStack, "access_key") - secretKey, _ = cfg.GetValue(cloudStack, "secret_key") - } - - var akskConfig = AkskContainerConfig{ - AccessKey: accessKey, - SecretKey: secretKey, - } - return akskConfig, nil -} diff --git a/adaptor/container_api_adaptor/common/auth/aksk/aksk_template.conf b/adaptor/container_api_adaptor/common/auth/aksk/aksk_template.conf deleted file mode 100644 index 7c900b40..00000000 --- a/adaptor/container_api_adaptor/common/auth/aksk/aksk_template.conf +++ /dev/null @@ -1,14 +0,0 @@ -#阿里 -[alibaba] -access_key = -secret_key = - -#华为 -[huawei] -access_key = -secret_key = - -#腾讯 -[tencent] -access_key = -secret_key = \ No newline at end of file diff --git a/adaptor/container_api_adaptor/common/config/config.go b/adaptor/container_api_adaptor/common/config/config.go deleted file mode 100644 index d121a027..00000000 --- a/adaptor/container_api_adaptor/common/config/config.go +++ /dev/null @@ -1,133 +0,0 @@ -package config - -import ( - "fmt" - "github.com/Unknwon/goconfig" - "os" - "strconv" -) - -type PCMContainerConfig struct { - RegionId string - ContainerGroupName string - ContainerImage string - ContainerName string - CpuPod string - MemoryPod string - CpuContainer string - MemoryContainer string - CpuPodFloat float64 - MemoryPodFloat float64 - CpuContainerFloat float64 - MemoryContainerFloat float64 - NameSpace string - SecurityGroupId string - SubnetId string - VpcId string - RegionIdDelete string - ContainerGroupIdDelete string - RegionIdList string - NamespaceUpdate string - RegionIdUpdate string - ContainerImageUpdate string - ContainerNameUpdate string - CpuPodUpdate string - MemoryPodUpdate string - ContainerGroupNameUpdate string - ContainerGroupIdUpdate string - RestartPolicyUpdate string - NamespaceDelete string - ContainerGroupNameDelete string -} - -func PCMconfig(configPath string) (PCMContainerConfig, error) { - - //加载配置文件 - var cfg *goconfig.ConfigFile - config, err := goconfig.LoadConfigFile(configPath) - if err != nil { - fmt.Println("get config file error:", err.Error()) - os.Exit(-1) - } - cfg = config - - //[创建]通用创建必需信息 - regionId, _ := cfg.GetValue("pod_create_conf", "region_id") - containerGroupName, _ := cfg.GetValue("pod_create_conf", "container_group_name") - containerImage, _ := cfg.GetValue("pod_create_conf", "container_image") - containerName, _ := cfg.GetValue("pod_create_conf", "container_name") - - //[创建]阿里创建必需(unique) - - //[创建]腾讯创建必需(unique) - cpuPod, _ := cfg.GetValue("pod_create_conf", "cpu_pod") - memoryPod, _ := cfg.GetValue("pod_create_conf", "memory_pod") - cpuPodFloat, _ := strconv.ParseFloat(cpuPod, 64) - memoryPodFloat, _ := strconv.ParseFloat(memoryPod, 64) - securityGroupId, _ := cfg.GetValue("pod_create_conf", "security_group_id") - subnetId, _ := cfg.GetValue("pod_create_conf", "subnet_id") - vpcId, _ := cfg.GetValue("pod_create_conf", "vpc_id") - - //[创建]华为创建必需(unique) - nameSpace, _ := cfg.GetValue("pod_create_conf", "namespace") - - //[创建]非必需参数 - cpuContainer, _ := cfg.GetValue("pod_create_conf", "cpu_container") - memoryContainer, _ := cfg.GetValue("pod_create_conf", "memory_container") - cpuContainerFloat, _ := strconv.ParseFloat(cpuContainer, 64) - memoryContainerFloat, _ := strconv.ParseFloat(memoryContainer, 64) - - //[删除]通用删除配置信息 - regionIdDelete, _ := cfg.GetValue("pod_delete_conf", "region_id") - containerGroupIdDelete, _ := cfg.GetValue("pod_delete_conf", "container_group_id") - nameSpaceDelete, _ := cfg.GetValue("pod_delete_conf", "namespace") - containerGroupNameDelete, _ := cfg.GetValue("pod_delete_conf", "container_group_name") - - //[查询]通用查询配置信息 - regionIdList, _ := cfg.GetValue("pod_list_conf", "region_id") - - //[更新]通用更新配置信息 - regionIdUpdate, _ := cfg.GetValue("pod_update_conf", "region_id") - namespaceUpdate, _ := cfg.GetValue("pod_update_conf", "namespace") - containerGroupIdUpdate, _ := cfg.GetValue("pod_update_conf", "container_group_id") - restartPolicyUpdate, _ := cfg.GetValue("pod_update_conf", "restart_policy") - ContainerNameUpdate, _ := cfg.GetValue("pod_update_conf", "container_name") - CpuPodUpdate, _ := cfg.GetValue("pod_update_conf", "cpu_pod") - MemoryPodUpdate, _ := cfg.GetValue("pod_update_conf", "memory_pod") - ContainerGroupNameUpdate, _ := cfg.GetValue("pod_update_conf", "container_group_name") - - var configCommon = PCMContainerConfig{ - RegionId: regionId, - ContainerGroupName: containerGroupName, - ContainerImage: containerImage, - ContainerName: containerName, - CpuPod: cpuPod, - MemoryPod: memoryPod, - CpuContainer: cpuContainer, - MemoryContainer: memoryContainer, - CpuPodFloat: cpuPodFloat, - MemoryPodFloat: memoryPodFloat, - CpuContainerFloat: cpuContainerFloat, - MemoryContainerFloat: memoryContainerFloat, - NameSpace: nameSpace, - SecurityGroupId: securityGroupId, - SubnetId: subnetId, - VpcId: vpcId, - RegionIdDelete: regionIdDelete, - ContainerGroupIdDelete: containerGroupIdDelete, - RegionIdList: regionIdList, - RegionIdUpdate: regionIdUpdate, - NamespaceUpdate: namespaceUpdate, - ContainerGroupIdUpdate: containerGroupIdUpdate, - RestartPolicyUpdate: restartPolicyUpdate, - ContainerImageUpdate: containerName, - ContainerNameUpdate: ContainerNameUpdate, - CpuPodUpdate: CpuPodUpdate, - MemoryPodUpdate: MemoryPodUpdate, - ContainerGroupNameUpdate: ContainerGroupNameUpdate, - NamespaceDelete: nameSpaceDelete, - ContainerGroupNameDelete: containerGroupNameDelete, - } - - return configCommon, nil -} diff --git a/adaptor/container_api_adaptor/common/config/config_common.conf b/adaptor/container_api_adaptor/common/config/config_common.conf deleted file mode 100644 index c8a9fb66..00000000 --- a/adaptor/container_api_adaptor/common/config/config_common.conf +++ /dev/null @@ -1,45 +0,0 @@ -[container_conf] -[pod_create_conf] -#测试账号ak -access_key = -secret_key = -#region -region_id= -#容器实例名称(pod名) -container_group_name= -#镜像地址 -container_image= -#容器名称 -container_name= -#namespace 华为CCI基于K8S namespace进行管理,需要单独提供namespace (华为必需) -namespace= -#Pod拥有核数 对应腾讯 Cpu(腾讯必需) -cpu_pod=1 -#Pod拥有内存大小 对应腾讯 Memory(腾讯必需) -memory_pod=2 -#安全组ID 对应腾讯 SecurityGroupIds(腾讯必需) -security_group_id= -#子网ID 对应腾讯 SubnetId(腾讯必需) -subnet_id= -#VPC ID 对应腾讯 VpcId(腾讯必需) -vpc_id= -##考虑多个函数分成不同的配置组 -##用户可以在请求中指定任务在各厂商调度比例 -##地域、厂商、用户AKSK等信息通过独立的配置文件进行导入 - -[pod_create_conf] -#可选项,框架可以不必过于细节 -ali_count=10000 -huawei_count=10000 -tencent_count=20000 - -hangzhou_count=20000 -shanghai_count=20000 - - -[pod_delete_conf] -[pod_update_conf] -[pod_list_conf] - - - diff --git a/adaptor/container_api_adaptor/common/main.go b/adaptor/container_api_adaptor/common/main.go deleted file mode 100644 index f97e5856..00000000 --- a/adaptor/container_api_adaptor/common/main.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -import "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/api" - -func main() { - - aliConfigPath := "adaptor/container_api_adaptor/alibaba/eci/config_eci.conf" - huaweiConfigPath := "adaptor/container_api_adaptor/huawei/cci/config_cci.conf" - tencentConfigPath := "adaptor/container_api_adaptor/tencent/eks/config_eks.conf" - akskPath := "adaptor/container_api_adaptor/common/auth/aksk/aksk.conf" - println(aliConfigPath) - println(huaweiConfigPath) - println(tencentConfigPath) - println(akskPath) - - //api.CreatePod("alibaba", akskPath, aliConfigPath) - //api.ListPod("alibaba", akskPath, aliConfigPath) - //api.UpdatePod("alibaba", akskPath, aliConfigPath) - //api.DeletePod("alibaba", akskPath, aliConfigPath) - - //api.CreatePod("huawei", akskPath, huaweiConfigPath) - api.ListPod("huawei", akskPath, huaweiConfigPath) - //api.UpdatePod("huawei", akskPath, huaweiConfigPath) - //api.DeletePod("huawei", akskPath, huaweiConfigPath) - - //api.CreatePod("tencent", akskPath, tencentConfigPath) - //api.ListPod("tencent", akskPath, tencentConfigPath) - //api.UpdatePod("tencent", akskPath, tencentConfigPath) - //api.DeletePod("tencent", akskPath, tencentConfigPath) - -} diff --git a/adaptor/container_api_adaptor/huawei/cci/config_cci.conf b/adaptor/container_api_adaptor/huawei/cci/config_cci.conf deleted file mode 100644 index cf35c089..00000000 --- a/adaptor/container_api_adaptor/huawei/cci/config_cci.conf +++ /dev/null @@ -1,39 +0,0 @@ -[pod_create_conf] -#region 对应华为 Region (华为创建Namespace必需) -region_id=cn-north-4 -#namespace 华为CCI基于K8S namespace进行管理,需要单独提供namespace 对应Pod.ObjectMeta.Namespace (华为必需) -namespace=test-k8s-client-namespace1 -#容器实例名称(pod名) 对应华为 Pod.ObjectMeta.Name (华为必需) -container_group_name=pcm-test-huawei-pod -#镜像地址 对应华为 Pod.PodSpec.Containers.Container.Image (华为必需) -container_image=library/nginx:stable-alpine-perl -#容器名称 对应华为 Pod.PodSpec.Containers.Container.Name (华为必需) -container_name=pcm-test-huawei-container -#Pod拥有核数 对应华为 Pod.PodSpec.Containers.Container.Resources.Limits.ResourceCPU (华为必需) -cpu_pod=500m -#Pod拥有内存大小 对应华为 Pod.PodSpec.Containers.Container.Resources.Limits.ResourceMemory (华为必需) -memory_pod=1024Mi - -[pod_delete_conf] -# 地域id -namespace=test-k8s-client-namespace1 -#容器实例名称(pod名) 对应华为 Pod.ObjectMeta.Name (华为必需) -container_group_name=pcm-test-huawei-pod - -[pod_list_conf] -# 地域id -region_id=cn-hangzhou - -[pod_update_conf] -#容器实例名称(pod名) 对应华为 Pod.ObjectMeta.Name (华为必需) -container_group_name=pcm-test-huawei-pod -#镜像地址 对应华为 Pod.PodSpec.Containers.Container.Image (华为必需) -container_image=library/nginx:stable-alpine-perl -#容器名称 对应华为 Pod.PodSpec.Containers.Container.Name (华为必需) -container_name=pcm-test-huawei-container-new -#Pod拥有核数 对应华为 Pod.PodSpec.Containers.Container.Resources.Limits.ResourceCPU (华为必需) -cpu_pod=500m -#Pod拥有内存大小 对应华为 Pod.PodSpec.Containers.Container.Resources.Limits.ResourceMemory (华为必需) -memory_pod=2048Mi -namespace=test-k8s-client-namespace1 -restart_policy=Always diff --git a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/doc.go b/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/doc.go deleted file mode 100644 index 032b35de..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// +k8s:deepcopy-gen=package -// +groupName=networking.cci.io -// +groupGoName=NetworkingCCI -package v1beta1 diff --git a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/register.go b/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/register.go deleted file mode 100644 index 0dc2257f..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/register.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package -const GroupName = "networking.cci.io" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - localSchemeBuilder = &SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Network{}, - &NetworkList{}, - ) - // Add the watch version that applies - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/types.go b/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/types.go deleted file mode 100644 index bef61bf9..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/types.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright (c) 2017 OpenStack Foundation. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// NetworkList is a list of network resource in container. -type NetworkList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - Items []Network `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Network is a network resource in container. -type Network struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec defines the attributes on a network - // +optional - Spec NetworkSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - // Status describes the network status - // +optional - Status NetworkStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// NetworkSpec describes the attributes on a network resource. -type NetworkSpec struct { - // network type - NetworkType string `json:"networkType,omitempty" protobuf:"bytes,5,opt,name=networkType"` - // ID of the VPC to attach - AttachedVPC string `json:"attachedVPC,omitempty" protobuf:"bytes,4,opt,name=attachedVPC"` - // network ID - NetworkID string `json:"networkID,omitempty" protobuf:"bytes,7,opt,name=networkID"` - // Subnet ID - SubnetID string `json:"subnetID,omitempty" protobuf:"bytes,8,opt,name=subnetID"` - // available zone - AvailableZone string `json:"availableZone,omitempty" protobuf:"bytes,9,opt,name=availableZone"` - // The CIDR of the network - CIDR string `json:"cidr,omitempty" protobuf:"bytes,3,opt,name=cidr"` -} - -// NetworkStatus describes the status of a network -type NetworkStatus struct { - // State describes the network state - // +optional - State string `json:"state" protobuf:"bytes,1,opt,name=state"` - // Message describes why network is in current state - // +optional - Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` -} - -const ( - // NetworkInitializing means the network is initializing - NetworkInitializing = "Initializing" - // NetworkPending means the network is processing - NetworkPending = "Pending" - // NetworkActive means the network is available - NetworkActive = "Active" - // NetworkFailed means the network is not available - NetworkFailed = "Failed" - // NetworkTerminating means the network is undergoing graceful termination - NetworkTerminating = "Terminating" -) diff --git a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/zz_generated.deepcopy.go b/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index d35acf28..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,119 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1beta1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Network) DeepCopyInto(out *Network) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Network. -func (in *Network) DeepCopy() *Network { - if in == nil { - return nil - } - out := new(Network) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Network) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkList) DeepCopyInto(out *NetworkList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Network, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkList. -func (in *NetworkList) DeepCopy() *NetworkList { - if in == nil { - return nil - } - out := new(NetworkList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NetworkList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. -func (in *NetworkSpec) DeepCopy() *NetworkSpec { - if in == nil { - return nil - } - out := new(NetworkSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkStatus) DeepCopyInto(out *NetworkStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkStatus. -func (in *NetworkStatus) DeepCopy() *NetworkStatus { - if in == nil { - return nil - } - out := new(NetworkStatus) - in.DeepCopyInto(out) - return out -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/auth/aksk/aksk.go b/adaptor/container_api_adaptor/huawei/pkg/auth/aksk/aksk.go deleted file mode 100644 index 0810021a..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/auth/aksk/aksk.go +++ /dev/null @@ -1,92 +0,0 @@ -package aksk - -import ( - "fmt" - - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/auth/aksk" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/config" - clientset "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/client-go/tools/clientcmd/api" -) - -const ( - apiVersion = "client.authentication.k8s.io/v1beta1" - // 云容器实例 CCI,参考https://developer.huaweicloud.com/endpoint - //cciEndpoint = "https://cci.cn-north-4.myhuaweicloud.com" - // 统一身份认证服务 IAM,参考https://developer.huaweicloud.com/endpoint - iamEndpoint = "https://iam.myhuaweicloud.com" - // 地区和终端节点,参考https://developer.huaweicloud.com/endpoint - //projectName = "cn-north-4" - // 获取AK/SK参考: https://support.huaweicloud.com/devg-cci/cci_kubectl_01.html#cci_kubectl_01__section17023744719 - - //ak = "ATQTIWUT9K66VRMMXKVY" - //sk = "Wa0aixDVuhZOfDZGWvgIJQBHnyiDlGdgDn1Ai5Yy" - - DomainId = "0a4e7f245680f3040fdfc011720e50a0" //账号ID,可以在我的凭证获取 - ProjectId = "0a62ffb0d48026c12fbfc011b8d23f0b" //项目ID,可以在我的凭证获取 - SecurityGroupID = "5157f1d1-fe7d-47a1-beaf-aee027b99755" //安全组ID,可以在安全组控制台获取 - AvailableZone = "cn-north-4a" //az名称,例如cn-north-1a、cn-north-4a或cn-east-3a - VpcID = "0333b519-7903-49e8-908e-ed56216fe921" //虚拟私有云的ID,可在VPC控制台获取 - Cidr = "10.0.0.0/10" //子网网段,例如192.168.128.0/18 - NetworkID = "2a14ac3f-07f7-4479-9930-3ea06a888f54" //<子网的网络ID,可在VPC控制台 > 子网中获取> - SubnetID = "0dea26d7-2544-424c-b7aa-620b206fce35" //<子网ID,可在VPC控制台 > 子网获取> -) - -// NewClient 通过AK/SK认证创建Clientset -func NewClient(cloudStack string, akskPath string, configPath string) (*kubernetes.Clientset, error) { - - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - configCommon, _ := config.PCMconfig(configPath) - - ak := configAksk.AccessKey - sk := configAksk.SecretKey - regionId := configCommon.RegionId - cciEndpoint := "https://cci." + regionId + ".myhuaweicloud.com" - - cciConfig, err := clientcmd.BuildConfigFromFlags(cciEndpoint, "") - if err != nil { - return nil, err - } - var optionArgs []string - optionArgs = append(optionArgs, fmt.Sprintf("--iam-endpoint=%s", iamEndpoint)) - optionArgs = append(optionArgs, fmt.Sprintf("--project-name=%s", regionId)) - optionArgs = append(optionArgs, fmt.Sprintf("--ak=%s", ak)) - optionArgs = append(optionArgs, fmt.Sprintf("--sk=%s", sk)) - cciConfig.ExecProvider = &api.ExecConfig{ - Command: "cci-iam-authenticator", - APIVersion: apiVersion, - Args: append([]string{"token"}, optionArgs...), - Env: make([]api.ExecEnvVar, 0), - } - return kubernetes.NewForConfig(cciConfig) -} - -func NewNetworkClient(cloudStack string, akskPath string, configPath string) (*clientset.Clientset, error) { - - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - configCommon, _ := config.PCMconfig(configPath) - - ak := configAksk.AccessKey - sk := configAksk.SecretKey - regionId := configCommon.RegionId - cciEndpoint := "https://cci." + regionId + ".myhuaweicloud.com" - - configFromFlags, err := clientcmd.BuildConfigFromFlags(cciEndpoint, "") - if err != nil { - return nil, err - } - var optionArgs []string - optionArgs = append(optionArgs, fmt.Sprintf("--iam-endpoint=%s", iamEndpoint)) - optionArgs = append(optionArgs, fmt.Sprintf("--project-name=%s", regionId)) - optionArgs = append(optionArgs, fmt.Sprintf("--ak=%s", ak)) - optionArgs = append(optionArgs, fmt.Sprintf("--sk=%s", sk)) - configFromFlags.ExecProvider = &api.ExecConfig{ - Command: "cci-iam-authenticator", - APIVersion: apiVersion, - Args: append([]string{"token"}, optionArgs...), - Env: make([]api.ExecEnvVar, 0), - } - return clientset.NewForConfig(configFromFlags) -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/auth/kubeconfig/kubeconfig.go b/adaptor/container_api_adaptor/huawei/pkg/auth/kubeconfig/kubeconfig.go deleted file mode 100644 index 0f26de64..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/auth/kubeconfig/kubeconfig.go +++ /dev/null @@ -1,16 +0,0 @@ -package kubeconfig - -import ( - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/clientcmd" -) - -// NewClient 通过kubeconfig配置文件创建Clientset -// kubeconfig配置文件需包含认证相关信息,具体请参考《cci-iam-authenticator使用参考》生成kubeconfig配置文件:https://support.huaweicloud.com/devg-cci/cci_kubectl_03.html -func NewClient() (*kubernetes.Clientset, error) { - config, err := clientcmd.BuildConfigFromFlags("", "/path/to/kubeconfig") - if err != nil { - return nil, err - } - return kubernetes.NewForConfig(config) -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/auth/password/password.go b/adaptor/container_api_adaptor/huawei/pkg/auth/password/password.go deleted file mode 100644 index ce5adc2b..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/auth/password/password.go +++ /dev/null @@ -1,45 +0,0 @@ -package password - -import ( - "fmt" - - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/client-go/tools/clientcmd/api" -) - -const ( - apiVersion = "client.authentication.k8s.io/v1beta1" - // 云容器实例 CCI,参考https://developer.huaweicloud.com/endpoint - cciEndpoint = "<例如华北-北京四: https://cci.cn-north-4.myhuaweicloud.com>" - // 统一身份认证服务 IAM,参考https://developer.huaweicloud.com/endpoint - iamEndpoint = "<例如华北-北京四: https://iam.cn-north-4.myhuaweicloud.com>" - // 地区和终端节点,参考https://developer.huaweicloud.com/endpoint - projectName = "<例如华北-北京四: cn-north-4>" - userName = "" - domainName = "" - password = "" -) - -// NewClient 通过username/password创建Clientset -func NewClient() (*kubernetes.Clientset, error) { - config, err := clientcmd.BuildConfigFromFlags(cciEndpoint, "") - if err != nil { - return nil, err - } - var optionArgs []string - optionArgs = append(optionArgs, fmt.Sprintf("--iam-endpoint=%s", iamEndpoint)) - optionArgs = append(optionArgs, fmt.Sprintf("--project-name=%s", projectName)) - optionArgs = append(optionArgs, fmt.Sprintf("--token-only=false")) - optionArgs = append(optionArgs, fmt.Sprintf("--domain-name=%s", domainName)) - optionArgs = append(optionArgs, fmt.Sprintf("--user-name=%s", userName)) - optionArgs = append(optionArgs, fmt.Sprintf("--password=%s", password)) - - config.ExecProvider = &api.ExecConfig{ - Command: "cci-iam-authenticator", - APIVersion: apiVersion, - Args: append([]string{"token"}, optionArgs...), - Env: make([]api.ExecEnvVar, 0), - } - return kubernetes.NewForConfig(config) -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/clientset.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/clientset.go deleted file mode 100644 index 395ea883..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/clientset.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - networkingcciv1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - NetworkingCCIV1beta1() networkingcciv1beta1.NetworkingCCIV1beta1Interface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - networkingCCIV1beta1 *networkingcciv1beta1.NetworkingCCIV1beta1Client -} - -// NetworkingCCIV1beta1 retrieves the NetworkingCCIV1beta1Client -func (c *Clientset) NetworkingCCIV1beta1() networkingcciv1beta1.NetworkingCCIV1beta1Interface { - return c.networkingCCIV1beta1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - cs.networkingCCIV1beta1, err = networkingcciv1beta1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.networkingCCIV1beta1 = networkingcciv1beta1.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.networkingCCIV1beta1 = networkingcciv1beta1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/doc.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/doc.go deleted file mode 100644 index 55995604..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package v1beta1 diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/clientset_generated.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/clientset_generated.go deleted file mode 100644 index a9e5d778..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/clientset_generated.go +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - clientset "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1" - networkingcciv1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1" - fakenetworkingcciv1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var _ clientset.Interface = &Clientset{} - -// NetworkingCCIV1beta1 retrieves the NetworkingCCIV1beta1Client -func (c *Clientset) NetworkingCCIV1beta1() networkingcciv1beta1.NetworkingCCIV1beta1Interface { - return &fakenetworkingcciv1beta1.FakeNetworkingCCIV1beta1{Fake: &c.Fake} -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/doc.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/doc.go deleted file mode 100644 index 9b99e716..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/register.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/register.go deleted file mode 100644 index 49f5cb55..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/fake/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - networkingcciv1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) -var parameterCodec = runtime.NewParameterCodec(scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - networkingcciv1beta1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme/doc.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme/doc.go deleted file mode 100644 index 7dc37561..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme/register.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme/register.go deleted file mode 100644 index dadfd83f..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - networkingcciv1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - networkingcciv1beta1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/doc.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/doc.go deleted file mode 100644 index 77110195..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1beta1 diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/doc.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/doc.go deleted file mode 100644 index 16f44399..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/fake_network.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/fake_network.go deleted file mode 100644 index 1d67ad3a..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/fake_network.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeNetworks implements NetworkInterface -type FakeNetworks struct { - Fake *FakeNetworkingCCIV1beta1 - ns string -} - -var networksResource = schema.GroupVersionResource{Group: "networking.cci.io", Version: "v1beta1", Resource: "networks"} - -var networksKind = schema.GroupVersionKind{Group: "networking.cci.io", Version: "v1beta1", Kind: "Network"} - -// Get takes name of the network, and returns the corresponding network object, and an error if there is any. -func (c *FakeNetworks) Get(name string, options v1.GetOptions) (result *v1beta1.Network, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(networksResource, c.ns, name), &v1beta1.Network{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Network), err -} - -// List takes label and field selectors, and returns the list of Networks that match those selectors. -func (c *FakeNetworks) List(opts v1.ListOptions) (result *v1beta1.NetworkList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(networksResource, networksKind, c.ns, opts), &v1beta1.NetworkList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.NetworkList{ListMeta: obj.(*v1beta1.NetworkList).ListMeta} - for _, item := range obj.(*v1beta1.NetworkList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested networks. -func (c *FakeNetworks) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(networksResource, c.ns, opts)) - -} - -// Create takes the representation of a network and creates it. Returns the server's representation of the network, and an error, if there is any. -func (c *FakeNetworks) Create(network *v1beta1.Network) (result *v1beta1.Network, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(networksResource, c.ns, network), &v1beta1.Network{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Network), err -} - -// Update takes the representation of a network and updates it. Returns the server's representation of the network, and an error, if there is any. -func (c *FakeNetworks) Update(network *v1beta1.Network) (result *v1beta1.Network, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(networksResource, c.ns, network), &v1beta1.Network{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Network), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeNetworks) UpdateStatus(network *v1beta1.Network) (*v1beta1.Network, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(networksResource, "status", c.ns, network), &v1beta1.Network{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Network), err -} - -// Delete takes name of the network and deletes it. Returns an error if one occurs. -func (c *FakeNetworks) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(networksResource, c.ns, name), &v1beta1.Network{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeNetworks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(networksResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1beta1.NetworkList{}) - return err -} - -// Patch applies the patch and returns the patched network. -func (c *FakeNetworks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Network, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(networksResource, c.ns, name, pt, data, subresources...), &v1beta1.Network{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Network), err -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/fake_networking.cci.io_client.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/fake_networking.cci.io_client.go deleted file mode 100644 index c2d4678a..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/fake/fake_networking.cci.io_client.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeNetworkingCCIV1beta1 struct { - *testing.Fake -} - -func (c *FakeNetworkingCCIV1beta1) Networks(namespace string) v1beta1.NetworkInterface { - return &FakeNetworks{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeNetworkingCCIV1beta1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/generated_expansion.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/generated_expansion.go deleted file mode 100644 index 6cedf6ff..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/generated_expansion.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -type NetworkExpansion interface{} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/network.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/network.go deleted file mode 100644 index 416669f1..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/network.go +++ /dev/null @@ -1,191 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "time" - - v1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1" - scheme "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// NetworksGetter has a method to return a NetworkInterface. -// A group's client should implement this interface. -type NetworksGetter interface { - Networks(namespace string) NetworkInterface -} - -// NetworkInterface has methods to work with Network resources. -type NetworkInterface interface { - Create(*v1beta1.Network) (*v1beta1.Network, error) - Update(*v1beta1.Network) (*v1beta1.Network, error) - UpdateStatus(*v1beta1.Network) (*v1beta1.Network, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1beta1.Network, error) - List(opts v1.ListOptions) (*v1beta1.NetworkList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Network, err error) - NetworkExpansion -} - -// networks implements NetworkInterface -type networks struct { - client rest.Interface - ns string -} - -// newNetworks returns a Networks -func newNetworks(c *NetworkingCCIV1beta1Client, namespace string) *networks { - return &networks{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the network, and returns the corresponding network object, and an error if there is any. -func (c *networks) Get(name string, options v1.GetOptions) (result *v1beta1.Network, err error) { - result = &v1beta1.Network{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networks"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Networks that match those selectors. -func (c *networks) List(opts v1.ListOptions) (result *v1beta1.NetworkList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.NetworkList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("networks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested networks. -func (c *networks) Watch(opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("networks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch() -} - -// Create takes the representation of a network and creates it. Returns the server's representation of the network, and an error, if there is any. -func (c *networks) Create(network *v1beta1.Network) (result *v1beta1.Network, err error) { - result = &v1beta1.Network{} - err = c.client.Post(). - Namespace(c.ns). - Resource("networks"). - Body(network). - Do(). - Into(result) - return -} - -// Update takes the representation of a network and updates it. Returns the server's representation of the network, and an error, if there is any. -func (c *networks) Update(network *v1beta1.Network) (result *v1beta1.Network, err error) { - result = &v1beta1.Network{} - err = c.client.Put(). - Namespace(c.ns). - Resource("networks"). - Name(network.Name). - Body(network). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *networks) UpdateStatus(network *v1beta1.Network) (result *v1beta1.Network, err error) { - result = &v1beta1.Network{} - err = c.client.Put(). - Namespace(c.ns). - Resource("networks"). - Name(network.Name). - SubResource("status"). - Body(network). - Do(). - Into(result) - return -} - -// Delete takes name of the network and deletes it. Returns an error if one occurs. -func (c *networks) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("networks"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *networks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("networks"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Timeout(timeout). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched network. -func (c *networks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Network, err error) { - result = &v1beta1.Network{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("networks"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/networking.cci.io_client.go b/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/networking.cci.io_client.go deleted file mode 100644 index 4fb8ec29..00000000 --- a/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/typed/networking.cci.io/v1beta1/networking.cci.io_client.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1/scheme" - rest "k8s.io/client-go/rest" -) - -type NetworkingCCIV1beta1Interface interface { - RESTClient() rest.Interface - NetworksGetter -} - -// NetworkingCCIV1beta1Client is used to interact with features provided by the networking.cci.io group. -type NetworkingCCIV1beta1Client struct { - restClient rest.Interface -} - -func (c *NetworkingCCIV1beta1Client) Networks(namespace string) NetworkInterface { - return newNetworks(c, namespace) -} - -// NewForConfig creates a new NetworkingCCIV1beta1Client for the given config. -func NewForConfig(c *rest.Config) (*NetworkingCCIV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &NetworkingCCIV1beta1Client{client}, nil -} - -// NewForConfigOrDie creates a new NetworkingCCIV1beta1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *NetworkingCCIV1beta1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new NetworkingCCIV1beta1Client for the given RESTClient. -func New(c rest.Interface) *NetworkingCCIV1beta1Client { - return &NetworkingCCIV1beta1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *NetworkingCCIV1beta1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/adaptor/container_api_adaptor/huawei/resources/deployment/deployment.go b/adaptor/container_api_adaptor/huawei/resources/deployment/deployment.go deleted file mode 100644 index fb199026..00000000 --- a/adaptor/container_api_adaptor/huawei/resources/deployment/deployment.go +++ /dev/null @@ -1,77 +0,0 @@ -package deployment - -import ( - v1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" -) - -const ( - app = "test-k8s-client-deployment" - namespace = "test-k8s-client-namespace1" -) - -// CreateDeployment 创建Deployment -// API参考:https://support.huaweicloud.com/api-cci/createAppsV1NamespacedDeployment.html -func CreateDeployment(client *kubernetes.Clientset) (*v1.Deployment, error) { - var replicas int32 = 2 - var priority int32 = 0 - - container := corev1.Container{ - Name: "container-0", - Image: "library/nginx:stable-alpine-perl", - Resources: corev1.ResourceRequirements{ - Requests: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: resource.MustParse("500m"), - corev1.ResourceMemory: resource.MustParse("1024Mi"), - }, - Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: resource.MustParse("500m"), - corev1.ResourceMemory: resource.MustParse("1024Mi"), - }, - }, - } - - podTemplate := corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{"app": app}}, - Spec: corev1.PodSpec{ - Priority: &priority, - ImagePullSecrets: []corev1.LocalObjectReference{{Name: "imagepull-secret"}}, - Containers: []corev1.Container{container}, - }, - } - - deployment := v1.Deployment{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "apps/v1", - Kind: "Deployment", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: app, - }, - Spec: v1.DeploymentSpec{ - Replicas: &replicas, - Selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "app": app, - }, - }, - Template: podTemplate, - }, - } - return client.AppsV1().Deployments(namespace).Create(&deployment) -} - -// DeleteDeployment 删除Deployment -// API参考:https://support.huaweicloud.com/api-cci/deleteAppsV1NamespacedDeployment.html -func DeleteDeployment(client *kubernetes.Clientset) error { - return client.AppsV1().Deployments(namespace).Delete(app, &metav1.DeleteOptions{}) -} - -// GetDeployment 查询Deployment -// API参考:https://support.huaweicloud.com/api-cci/readAppsV1NamespacedDeployment.html -func GetDeployment(client *kubernetes.Clientset) (*v1.Deployment, error) { - return client.AppsV1().Deployments(namespace).Get(app, metav1.GetOptions{}) -} diff --git a/adaptor/container_api_adaptor/huawei/resources/namespace/namespace.go b/adaptor/container_api_adaptor/huawei/resources/namespace/namespace.go deleted file mode 100644 index 8d9c13fe..00000000 --- a/adaptor/container_api_adaptor/huawei/resources/namespace/namespace.go +++ /dev/null @@ -1,54 +0,0 @@ -package namespace - -import ( - "time" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/kubernetes" -) - -const ( - namespace = "test-k8s-client-namespace1" -) - -// CreateNamespace 创建命名空间 -// API参考:https://support.huaweicloud.com/api-cci/createCoreV1Namespace.html -func CreateNamespace(cs *kubernetes.Clientset) (*corev1.Namespace, error) { - namespace := &corev1.Namespace{ - TypeMeta: metav1.TypeMeta{}, - ObjectMeta: metav1.ObjectMeta{ - Name: namespace, - Annotations: map[string]string{ - "namespace.kubernetes.io/flavor": "general-computing", - "network.cci.io/warm-pool-size": "10", - }, - Labels: map[string]string{ - "rbac.authorization.cci.io/enable-k8s-rbac": "false", - }, - }, - } - return cs.CoreV1().Namespaces().Create(namespace) -} - -// DeleteNamespace 删除Namespace -// API参考:https://support.huaweicloud.com/api-cci/deleteCoreV1Namespace.html -func DeleteNamespace(cs *kubernetes.Clientset) error { - return cs.CoreV1().Namespaces().Delete(namespace, &metav1.DeleteOptions{}) -} - -// WaitNamespaceActive 查询Namespace状态,等待其状态变为"Active" -// API参考:https://support.huaweicloud.com/api-cci/readCoreV1Namespace.html -func WaitNamespaceActive(cs *kubernetes.Clientset) error { - return wait.Poll(time.Second*5, time.Second*30, func() (done bool, err error) { - ns, err := cs.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{}) - if err != nil { - return false, err - } - if ns.Status.Phase == corev1.NamespaceActive { - return true, nil - } - return false, nil - }) -} diff --git a/adaptor/container_api_adaptor/huawei/resources/network/network.go b/adaptor/container_api_adaptor/huawei/resources/network/network.go deleted file mode 100644 index b645c421..00000000 --- a/adaptor/container_api_adaptor/huawei/resources/network/network.go +++ /dev/null @@ -1,58 +0,0 @@ -package network - -import ( - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/apis/networking.cci.io/v1beta1" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/auth/aksk" - "time" - - clientset "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/huawei/pkg/client/networking.cci.io/v1beta1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/wait" -) - -const ( - name = "test-k8s-client-namespace-cn-north-1-default-network" - namespace = "test-k8s-client-namespace1" -) - -// CreateNetwork 创建Network,并等待其状态变更为Active -// 参考《Namespace和Network》 https://support.huaweicloud.com/devg-cci/cci_05_0023.html -// API参考:https://support.huaweicloud.com/api-cci/createNetworkingCciIoV1beta1NamespacedNetwork.html -func CreateNetwork(cs *clientset.Clientset) (*v1beta1.Network, error) { - - network := &v1beta1.Network{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - "network.alpha.kubernetes.io/default-security-group": aksk.SecurityGroupID, - "network.alpha.kubernetes.io/domain-id": aksk.DomainId, - "network.alpha.kubernetes.io/project-id": aksk.ProjectId, - }, - Name: name, - }, - Spec: v1beta1.NetworkSpec{ - AvailableZone: aksk.AvailableZone, - CIDR: aksk.Cidr, - AttachedVPC: aksk.VpcID, - NetworkID: aksk.NetworkID, - NetworkType: "underlay_neutron", - SubnetID: aksk.SubnetID, - }, - } - network, err := cs.NetworkingCCIV1beta1().Networks(namespace).Create(network) - if err != nil { - return nil, err - } - - // 查询Network状态,等待其状态变为"Active" - err = wait.Poll(time.Second*5, time.Second*30, func() (done bool, err error) { - network, err = cs.NetworkingCCIV1beta1().Networks(namespace).Get(name, metav1.GetOptions{}) - if err != nil { - return false, err - } - if network.Status.State == v1beta1.NetworkActive { - return true, nil - } - return false, nil - }) - return network, err -} diff --git a/adaptor/container_api_adaptor/huawei/resources/pod/pod.go b/adaptor/container_api_adaptor/huawei/resources/pod/pod.go deleted file mode 100644 index 9b3c14dd..00000000 --- a/adaptor/container_api_adaptor/huawei/resources/pod/pod.go +++ /dev/null @@ -1,134 +0,0 @@ -package pod - -import ( - "fmt" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/config" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" -) - -// CreatePod 创建Pod -func CreatePod(client *kubernetes.Clientset, configPath string) (*corev1.Pod, error) { - - var configCommon config.PCMContainerConfig - configCommon, _ = config.PCMconfig(configPath) - - nameSpace := configCommon.NameSpace - podName := configCommon.ContainerGroupName - containerImage := configCommon.ContainerImage - containerName := configCommon.ContainerName - cpuPod := configCommon.CpuPod - memoryPod := configCommon.MemoryPod - pod := corev1.Pod{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "core/V1", - Kind: "Pod", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: podName, - Namespace: nameSpace, - Labels: map[string]string{"name": "testapi"}, - }, - Spec: corev1.PodSpec{ - RestartPolicy: corev1.RestartPolicyAlways, - Containers: []corev1.Container{ - { - Name: containerName, - Image: containerImage, - Resources: corev1.ResourceRequirements{ - Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceCPU: resource.MustParse(cpuPod), - corev1.ResourceMemory: resource.MustParse(memoryPod), - }, - }, - }, - }, - }, - Status: corev1.PodStatus{}, - } - - fmt.Println("Huawei ContainerGroup created") - return client.CoreV1().Pods(nameSpace).Create(&pod) -} - -// ListPod 查询Namespace下Pod列表 -func ListPod(client *kubernetes.Clientset, configPath string) (*corev1.PodList, error) { - - var configCommon config.PCMContainerConfig - configCommon, _ = config.PCMconfig(configPath) - - nameSpace := configCommon.NameSpace - - podList, _ := client.CoreV1().Pods(nameSpace).List(metav1.ListOptions{}) - fmt.Println("Huawei ContainerGroup list", podList) - - return podList, nil -} - -// UpdatePod 更新指定Pod -/* -// 跨namespace目前有点问题 -*/ -func UpdatePod(client *kubernetes.Clientset, configPath string) (*corev1.Pod, error) { - - var configCommon config.PCMContainerConfig - configCommon, _ = config.PCMconfig(configPath) - - nameSpace := configCommon.NamespaceUpdate - podName := configCommon.ContainerGroupNameUpdate - containerImage := configCommon.ContainerImageUpdate - containerName := configCommon.ContainerNameUpdate - - pod := corev1.Pod{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "core/V1", - Kind: "Pod", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: podName, - Namespace: nameSpace, - Labels: map[string]string{"name": "pod-test2"}, - }, - Spec: corev1.PodSpec{ - RestartPolicy: corev1.RestartPolicyAlways, - Containers: []corev1.Container{ - { - Name: containerName, - Image: containerImage, - Resources: corev1.ResourceRequirements{ - Limits: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceLimitsCPU: resource.MustParse("500m"), - corev1.ResourceLimitsMemory: resource.MustParse("1Gi"), - }, - Requests: map[corev1.ResourceName]resource.Quantity{ - corev1.ResourceRequestsCPU: resource.MustParse("500m"), - corev1.ResourceRequestsMemory: resource.MustParse("1Gi"), - }, - }, - }, - }, - }, - Status: corev1.PodStatus{}, - } - - podNew, _ := client.CoreV1().Pods(nameSpace).Update(&pod) - fmt.Println("Huawei ContainerGroup updated", podNew) - - return podNew, nil -} - -// DeletePod 删除指定Pod -func DeletePod(client *kubernetes.Clientset, configPath string) error { - - var configCommon config.PCMContainerConfig - configCommon, _ = config.PCMconfig(configPath) - - nameSpace := configCommon.NameSpace - podName := configCommon.ContainerGroupName - - fmt.Println("Huawei ContainerGroup:", podName, " Deleted") - - return client.CoreV1().Pods(nameSpace).Delete(podName, &metav1.DeleteOptions{}) -} diff --git a/adaptor/container_api_adaptor/tencent/eks/config_eks.conf b/adaptor/container_api_adaptor/tencent/eks/config_eks.conf deleted file mode 100644 index 2b5d2e2b..00000000 --- a/adaptor/container_api_adaptor/tencent/eks/config_eks.conf +++ /dev/null @@ -1,34 +0,0 @@ -[pod_create_conf] -#区域ID -region_id=ap-beijing -#容器实例名称(pod名) 对应腾讯EksCiName(腾讯必需) -container_group_name=pcm-test-tencent-pod -#镜像地址 对应腾讯 Container.Image(腾讯必需) -container_image=library/nginx:stable-alpine-perl -#容器名称 对应腾讯 Container.Name(腾讯必需) -container_name=pcm-test-tencent-container -#Pod拥有核数 对应腾讯 Cpu(腾讯必需) -cpu_pod=1 -#Pod拥有内存大小 对应腾讯 Memory(腾讯必需) -memory_pod=2 -#安全组ID 对应腾讯 SecurityGroupIds(腾讯必需) -security_group_id=sg-owzbdinl -#子网ID 对应腾讯 SubnetId(腾讯必需) -subnet_id=subnet-n4h73049 -#VPC ID 对应腾讯 VpcId(腾讯必需) -vpc_id=vpc-e8hdbla8 - -[pod_list_conf] -#区域ID -region_id=ap-beijing - -[pod_update_conf] -#区域ID -region_id=ap-beijing -#容器实例ID 对应腾讯EksCiName(腾讯必需) -container_group_id=eksci-pawu7qad -#容器实例名称(pod名) 对应腾讯EksCiName(腾讯必需) -container_group_name=eksci-pawu7qad - -[pod_delete_conf] -container_group_id=eksci-pawu7qad diff --git a/adaptor/container_api_adaptor/tencent/eks/eks.go b/adaptor/container_api_adaptor/tencent/eks/eks.go deleted file mode 100644 index ac7a5766..00000000 --- a/adaptor/container_api_adaptor/tencent/eks/eks.go +++ /dev/null @@ -1,138 +0,0 @@ -package eks - -import ( - "fmt" - "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" - "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" - "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" - tke "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525" - "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/auth/aksk" - pcmCommon "gitlink.org.cn/JCCE/PCM/adaptor/container_api_adaptor/common/config" -) - -func CreateEksInstance(cloudStack string, akskPath string, configPath string) { - - configCommon, _ := pcmCommon.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - - credential := common.NewCredential( - configAksk.AccessKey, - configAksk.SecretKey, - ) - cpf := profile.NewClientProfile() - cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" - client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) - - request := tke.NewCreateEKSContainerInstancesRequest() - - eksCiName := &configCommon.ContainerGroupName - containerName := &configCommon.ContainerName - containerImage := &configCommon.ContainerImage - eksCpu := &configCommon.CpuPodFloat - eksMemory := &configCommon.MemoryPodFloat - securityGroupId := &configCommon.SecurityGroupId - securityGroupIds := make([]*string, 1) - securityGroupIds[0] = securityGroupId - subNetId := &configCommon.SubnetId - vpcId := &configCommon.VpcId - - request.EksCiName = eksCiName - container := make([]*tke.Container, 1) - container[0] = new(tke.Container) - container[0].Name = containerName - container[0].Image = containerImage - //container[0].Cpu = containerCpuPt - //container[0].Memory = containerMemoryPt - - request.Containers = container - request.Cpu = eksCpu - request.Memory = eksMemory - request.SecurityGroupIds = securityGroupIds - request.SubnetId = subNetId - request.VpcId = vpcId - - response, err := client.CreateEKSContainerInstances(request) - if _, ok := err.(*errors.TencentCloudSDKError); ok { - fmt.Printf("An API error has returned: %s", err) - return - } - if err != nil { - panic(err) - } - fmt.Printf("%s", response.ToJsonString()) -} - -func ListEksInstance(cloudStack string, akskPath string, configPath string) { - - configCommon, _ := pcmCommon.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - - credential := common.NewCredential(configAksk.AccessKey, configAksk.SecretKey) - cpf := profile.NewClientProfile() - cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" - client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) - - request := tke.NewDescribeEKSContainerInstancesRequest() - - response, err := client.DescribeEKSContainerInstances(request) - if _, ok := err.(*errors.TencentCloudSDKError); ok { - fmt.Printf("An API error has returned: %s", err) - return - } - if err != nil { - panic(err) - } - fmt.Printf("%s", response.ToJsonString()) -} - -func UpdateEksInstance(cloudStack string, akskPath string, configPath string) { - - configCommon, _ := pcmCommon.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - - credential := common.NewCredential(configAksk.AccessKey, configAksk.SecretKey) - cpf := profile.NewClientProfile() - cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" - client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) - - request := tke.NewUpdateEKSContainerInstanceRequest() - request.EksCiId = &configCommon.ContainerGroupIdUpdate - request.Name = &configCommon.ContainerGroupNameUpdate - - response, err := client.UpdateEKSContainerInstance(request) - if _, ok := err.(*errors.TencentCloudSDKError); ok { - fmt.Printf("An API error has returned: %s", err) - return - } - if err != nil { - panic(err) - } - fmt.Printf("%s", response.ToJsonString()) -} - -func DeleteEksInstance(cloudStack string, akskPath string, configPath string) { - - configCommon, _ := pcmCommon.PCMconfig(configPath) - configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) - - credential := common.NewCredential(configAksk.AccessKey, configAksk.SecretKey) - cpf := profile.NewClientProfile() - cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" - client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) - - request := tke.NewDeleteEKSContainerInstancesRequest() - eksCiIds := make([]*string, 1) - eksCiIds[0] = &configCommon.ContainerGroupIdDelete - - request.EksCiIds = eksCiIds - - response, err := client.DeleteEKSContainerInstances(request) - if _, ok := err.(*errors.TencentCloudSDKError); ok { - fmt.Printf("An API error has returned: %s", err) - return - } - if err != nil { - panic(err) - } - fmt.Printf("%s", response.ToJsonString()) -} diff --git a/adaptor/pod_adaptor/server/pod/list.go b/adaptor/pod_adaptor/server/pod/list.go index 1664d999..145648be 100644 --- a/adaptor/pod_adaptor/server/pod/list.go +++ b/adaptor/pod_adaptor/server/pod/list.go @@ -2,19 +2,17 @@ package pod import ( "context" - "sync" - "gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/service/poder" "gitlink.org.cn/JCCE/PCM/common/tenanter" "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant" + "sync" "github.com/golang/glog" "github.com/pkg/errors" ) -//ListDetail returns the detail of pod instances -func ListDetail(ctx context.Context, req *pbpod.ListDetailReq) (*pbpod.ListDetailResp, error) { +func CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (*pbpod.CreatePodResp, error) { var ( pod poder.Poder ) @@ -38,15 +36,41 @@ func ListDetail(ctx context.Context, req *pbpod.ListDetailReq) (*pbpod.ListDetai } } - return pod.ListDetail(ctx, req) + return pod.CreatePod(ctx, req) } -//List returns the list of pod instances -func List(ctx context.Context, req *pbpod.ListReq) (*pbpod.ListResp, error) { +func ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) { + var ( + pod poder.Poder + ) + + tenanters, err := tenanter.GetTenanters(req.Provider) + if err != nil { + return nil, errors.WithMessage(err, "getTenanters error") + } + + region, err := tenanter.NewRegion(req.Provider, req.RegionId) + if err != nil { + return nil, errors.WithMessagef(err, "provider %v regionId %v", req.Provider, req.RegionId) + } + + for _, tenanter := range tenanters { + if req.AccountName == "" || tenanter.AccountName() == req.AccountName { + if pod, err = poder.NewPodClient(req.Provider, region, tenanter); err != nil { + return nil, errors.WithMessage(err, "NewPodClient error") + } + break + } + } + + return pod.ListPodDetail(ctx, req) +} + +func ListPod(ctx context.Context, req *pbpod.ListPodReq) (*pbpod.ListPodResp, error) { var ( wg sync.WaitGroup mutex sync.Mutex - podes []*pbpod.PodInstance + pods []*pbpod.PodInstance ) tenanters, err := tenanter.GetTenanters(req.Provider) @@ -67,22 +91,22 @@ func List(ctx context.Context, req *pbpod.ListReq) (*pbpod.ListResp, error) { return } - request := &pbpod.ListDetailReq{ + request := &pbpod.ListPodDetailReq{ Provider: req.Provider, AccountName: tenant.AccountName(), RegionId: region.GetId(), PageNumber: 1, - PageSize: 20, + PageSize: 100, NextToken: "", } for { - resp, err := pod.ListDetail(ctx, request) + resp, err := pod.ListPodDetail(ctx, request) if err != nil { glog.Errorf("ListDetail error %v", err) return } mutex.Lock() - podes = append(podes, resp.Pods...) + pods = append(pods, resp.Pods...) mutex.Unlock() if resp.Finished { break @@ -90,19 +114,19 @@ func List(ctx context.Context, req *pbpod.ListReq) (*pbpod.ListResp, error) { request.PageNumber, request.PageSize, request.NextToken = resp.PageNumber, resp.PageSize, resp.NextToken } }(t, region) + } } wg.Wait() - return &pbpod.ListResp{Pods: podes}, nil + return &pbpod.ListPodResp{Pods: pods}, nil } -// ListAll returns all pod instances -func ListAll(ctx context.Context) (*pbpod.ListResp, error) { +func ListPodAll(ctx context.Context) (*pbpod.ListPodResp, error) { var ( wg sync.WaitGroup mutex sync.Mutex - podes []*pbpod.PodInstance + pods []*pbpod.PodInstance ) wg.Add(len(pbtenant.CloudProvider_name)) @@ -110,19 +134,19 @@ func ListAll(ctx context.Context) (*pbpod.ListResp, error) { go func(provider int32) { defer wg.Done() - resp, err := List(ctx, &pbpod.ListReq{Provider: pbtenant.CloudProvider(provider)}) + resp, err := ListPod(ctx, &pbpod.ListPodReq{Provider: pbtenant.CloudProvider(provider)}) if err != nil { glog.Errorf("List error %v", err) return } mutex.Lock() - podes = append(podes, resp.Pods...) + pods = append(pods, resp.Pods...) mutex.Unlock() }(k) } wg.Wait() - return &pbpod.ListResp{Pods: podes}, nil + return &pbpod.ListPodResp{Pods: pods}, nil } diff --git a/adaptor/pod_adaptor/service/poder/ali_eci.go b/adaptor/pod_adaptor/service/poder/ali_eci.go new file mode 100644 index 00000000..5102011b --- /dev/null +++ b/adaptor/pod_adaptor/service/poder/ali_eci.go @@ -0,0 +1,198 @@ +package poder + +import ( + "context" + "gitlink.org.cn/JCCE/PCM/common/tenanter" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant" + "sync" + + alieci "github.com/aliyun/alibaba-cloud-sdk-go/services/eci" + "github.com/pkg/errors" +) + +var aliClientMutex sync.Mutex + +type AliEci struct { + cli *alieci.Client + region tenanter.Region + tenanter tenanter.Tenanter +} + +func newAliEciClient(region tenanter.Region, tenant tenanter.Tenanter) (Poder, error) { + var ( + client *alieci.Client + err error + ) + + switch t := tenant.(type) { + case *tenanter.AccessKeyTenant: + // 阿里云的sdk有一个 map 的并发问题,go test 加上-race 能检测出来,所以这里加一个锁 + aliClientMutex.Lock() + client, err = alieci.NewClientWithAccessKey(region.GetName(), t.GetId(), t.GetSecret()) + aliClientMutex.Unlock() + default: + } + + if err != nil { + return nil, errors.Wrap(err, "init ali ecs client error") + } + + return &AliEci{ + cli: client, + region: region, + tenanter: tenant, + }, nil +} + +func (eci *AliEci) CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (*pbpod.CreatePodResp, error) { + request := alieci.CreateCreateContainerGroupRequest() + + request.RegionId = eci.region.GetName() + request.ContainerGroupName = req.PodName + requestContainer := make([]alieci.CreateContainerGroupContainer, 1) + requestContainer[0].Image = req.ContainerImage + requestContainer[0].Name = req.ContainerName + request.Container = &requestContainer + + resp, err := eci.cli.CreateContainerGroup(request) + if err != nil { + return nil, errors.Wrap(err, "Aliyun CreatePod error") + } + + isFinished := false + if len(resp.ContainerGroupId) > 0 { + isFinished = true + } + + return &pbpod.CreatePodResp{ + Pods: nil, + Finished: isFinished, + RequestId: resp.RequestId, + }, nil +} + +func (eci *AliEci) ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) { + request := alieci.CreateDescribeContainerGroupsRequest() + request.NextToken = req.NextToken + resp, err := eci.cli.DescribeContainerGroups(request) + if err != nil { + return nil, errors.Wrap(err, "Aliyun ListDetail error") + } + + var ecies = make([]*pbpod.PodInstance, len(resp.ContainerGroups)) + for k, v := range resp.ContainerGroups { + ecies[k] = &pbpod.PodInstance{ + Provider: pbtenant.CloudProvider_ali, + AccountName: eci.tenanter.AccountName(), + PodId: v.ContainerGroupId, + PodName: v.ContainerGroupName, + RegionId: 0, + ContainerImage: v.Containers[k].Image, + ContainerName: v.Containers[k].Name, + CpuPod: v.Cpu, + MemoryPod: v.Memory, + SecurityGroupId: v.SecurityGroupId, + SubnetId: v.InternetIp, + VpcId: v.VpcId, + Namespace: "", + } + + } + + isFinished := false + if len(ecies) < int(req.PageSize) { + isFinished = true + } + + return &pbpod.ListPodDetailResp{ + Pods: ecies, + Finished: isFinished, + PageNumber: req.PageNumber + 1, + PageSize: req.PageSize, + NextToken: resp.NextToken, + RequestId: resp.RequestId, + }, nil +} + +// +//// DescribeContainerGroup 查询Pod +//func DescribeContainerGroup(cloudStack string, akskPath string, configPath string) eci.DescribeContainerGroupsContainerGroup0 { +// var client *eci.Client +// +// configCommon, _ := config.PCMconfig(configPath) +// configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) +// client, _ = eci.NewClientWithAccessKey(configCommon.RegionId, configAksk.AccessKey, configAksk.SecretKey) +// +// // 生成查询请求 +// describeContainerGroupsRequest := eci.CreateDescribeContainerGroupsRequest() +// describeContainerGroupsRequest.RegionId = configCommon.RegionIdList +// describeContainerGroupsResponse, err := client.DescribeContainerGroups(describeContainerGroupsRequest) +// if err != nil { +// panic(err) +// } +// describeContainerGroupNumber := len(describeContainerGroupsResponse.ContainerGroups) +// +// //当前区域没有Pod情形的处理 +// if describeContainerGroupsResponse.TotalCount != 1 && describeContainerGroupNumber != 1 { +// fmt.Println("Invalid ContainerGroups count", describeContainerGroupsResponse.TotalCount, describeContainerGroupNumber) +// panic("Invalid ContainerGroups count") +// } +// +// fmt.Println("Alibaba ContainerGroup Name:", describeContainerGroupsResponse.ContainerGroups[0].ContainerGroupName, "\n", +// "ContainerGroup Id:", describeContainerGroupsResponse.ContainerGroups[0].ContainerGroupId) +// +// return describeContainerGroupsResponse.ContainerGroups[0] +//} +// +//// UpdateContainerGroup 更新Pod +//func UpdateContainerGroup(cloudStack string, akskPath string, configPath string) string { +// var client *eci.Client +// +// configCommon, _ := config.PCMconfig(configPath) +// configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) +// +// client, _ = eci.NewClientWithAccessKey(configCommon.RegionId, configAksk.AccessKey, configAksk.SecretKey) +// +// //生成更新请求 +// updateContainerGroupRequest := eci.CreateUpdateContainerGroupRequest() +// updateContainerGroupRequest.RegionId = configCommon.RegionIdUpdate +// updateContainerGroupRequest.ContainerGroupId = configCommon.ContainerGroupIdUpdate +// +// //容器实体内容,这里测试可以修改配置文件中的重启策略 +// updateContainerRequestContainer := make([]eci.UpdateContainerGroupContainer, 1) +// updateContainerRequestContainer[0].Image = configCommon.ContainerImage +// updateContainerRequestContainer[0].Name = configCommon.ContainerName +// updateContainerGroupRequest.Container = &updateContainerRequestContainer +// updateContainerGroupRequest.RestartPolicy = configCommon.RestartPolicyUpdate +// +// updateContainerGroupResponse, err := client.UpdateContainerGroup(updateContainerGroupRequest) +// if err != nil { +// panic(err) +// } +// requestId := updateContainerGroupResponse.RequestId +// fmt.Println("Alibaba ContainerGroup: ", configCommon.ContainerGroupIdUpdate, " Updated with request ID:", requestId) +// return requestId +//} +// +//// DeleteContainerGroup 删除Pod +//func DeleteContainerGroup(cloudStack string, akskPath string, configPath string) string { +// var client *eci.Client +// configCommon, _ := config.PCMconfig(configPath) +// configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) +// client, _ = eci.NewClientWithAccessKey(configCommon.RegionId, configAksk.AccessKey, configAksk.SecretKey) +// +// //生成删除请求 +// deleteContainerGroupRequest := eci.CreateDeleteContainerGroupRequest() +// deleteContainerGroupRequest.RegionId = configCommon.RegionIdDelete +// deleteContainerGroupRequest.ContainerGroupId = configCommon.ContainerGroupIdDelete +// +// deleteContainerGroupResponse, err := client.DeleteContainerGroup(deleteContainerGroupRequest) +// if err != nil { +// panic(err) +// } +// requestId := deleteContainerGroupResponse.RequestId +// fmt.Println("Alibaba ContainerGroup: ", configCommon.ContainerGroupIdUpdate, " Deleted with request ID:", requestId) +// +// return requestId +//} diff --git a/adaptor/pod_adaptor/service/poder/huawei_cci.go b/adaptor/pod_adaptor/service/poder/huawei_cci.go new file mode 100644 index 00000000..733ed27b --- /dev/null +++ b/adaptor/pod_adaptor/service/poder/huawei_cci.go @@ -0,0 +1,135 @@ +package poder + +// +//import ( +// "fmt" +// "gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/common/config" +// corev1 "k8s.io/api/core/v1" +// "k8s.io/apimachinery/pkg/api/resource" +// metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +// "k8s.io/client-go/kubernetes" +//) +// +//// CreatePod 创建Pod +//func CreatePod(client *kubernetes.Clientset, configPath string) (*corev1.Pod, error) { +// +// var configCommon config.PCMContainerConfig +// configCommon, _ = config.PCMconfig(configPath) +// +// nameSpace := configCommon.NameSpace +// podName := configCommon.ContainerGroupName +// containerImage := configCommon.ContainerImage +// containerName := configCommon.ContainerName +// cpuPod := configCommon.CpuPod +// memoryPod := configCommon.MemoryPod +// pod := corev1.Pod{ +// TypeMeta: metav1.TypeMeta{ +// APIVersion: "core/V1", +// Kind: "Pod", +// }, +// ObjectMeta: metav1.ObjectMeta{ +// Name: podName, +// Namespace: nameSpace, +// Labels: map[string]string{"name": "testapi"}, +// }, +// Spec: corev1.PodSpec{ +// RestartPolicy: corev1.RestartPolicyAlways, +// Containers: []corev1.Container{ +// { +// Name: containerName, +// Image: containerImage, +// Resources: corev1.ResourceRequirements{ +// Limits: map[corev1.ResourceName]resource.Quantity{ +// corev1.ResourceCPU: resource.MustParse(cpuPod), +// corev1.ResourceMemory: resource.MustParse(memoryPod), +// }, +// }, +// }, +// }, +// }, +// Status: corev1.PodStatus{}, +// } +// +// fmt.Println("Huawei ContainerGroup created") +// return client.CoreV1().Pods(nameSpace).Create(&pod) +//} +// +//// ListPod 查询Namespace下Pod列表 +//func ListPod(client *kubernetes.Clientset, configPath string) (*corev1.PodList, error) { +// +// var configCommon config.PCMContainerConfig +// configCommon, _ = config.PCMconfig(configPath) +// +// nameSpace := configCommon.NameSpace +// +// podList, _ := client.CoreV1().Pods(nameSpace).List(metav1.ListOptions{}) +// fmt.Println("Huawei ContainerGroup list", podList) +// +// return podList, nil +//} +// +//// UpdatePod 更新指定Pod +///* +//// 跨namespace目前有点问题 +//*/ +//func UpdatePod(client *kubernetes.Clientset, configPath string) (*corev1.Pod, error) { +// +// var configCommon config.PCMContainerConfig +// configCommon, _ = config.PCMconfig(configPath) +// +// nameSpace := configCommon.NamespaceUpdate +// podName := configCommon.ContainerGroupNameUpdate +// containerImage := configCommon.ContainerImageUpdate +// containerName := configCommon.ContainerNameUpdate +// +// pod := corev1.Pod{ +// TypeMeta: metav1.TypeMeta{ +// APIVersion: "core/V1", +// Kind: "Pod", +// }, +// ObjectMeta: metav1.ObjectMeta{ +// Name: podName, +// Namespace: nameSpace, +// Labels: map[string]string{"name": "pod-test2"}, +// }, +// Spec: corev1.PodSpec{ +// RestartPolicy: corev1.RestartPolicyAlways, +// Containers: []corev1.Container{ +// { +// Name: containerName, +// Image: containerImage, +// Resources: corev1.ResourceRequirements{ +// Limits: map[corev1.ResourceName]resource.Quantity{ +// corev1.ResourceLimitsCPU: resource.MustParse("500m"), +// corev1.ResourceLimitsMemory: resource.MustParse("1Gi"), +// }, +// Requests: map[corev1.ResourceName]resource.Quantity{ +// corev1.ResourceRequestsCPU: resource.MustParse("500m"), +// corev1.ResourceRequestsMemory: resource.MustParse("1Gi"), +// }, +// }, +// }, +// }, +// }, +// Status: corev1.PodStatus{}, +// } +// +// podNew, _ := client.CoreV1().Pods(nameSpace).Update(&pod) +// fmt.Println("Huawei ContainerGroup updated", podNew) +// +// return podNew, nil +//} +// +//// DeletePod 删除指定Pod +//func DeletePod(client *kubernetes.Clientset, configPath string) error { +// +// var configCommon config.PCMContainerConfig +// configCommon, _ = config.PCMconfig(configPath) +// +// nameSpace := configCommon.NameSpace +// podName := configCommon.ContainerGroupName +// +// fmt.Println("Huawei ContainerGroup:", podName, " Deleted") +// +// return client.CoreV1().Pods(nameSpace).Delete(podName, &metav1.DeleteOptions{}) +//} diff --git a/adaptor/pod_adaptor/service/poder/poder.go b/adaptor/pod_adaptor/service/poder/poder.go index 6b184051..9f03f5e4 100644 --- a/adaptor/pod_adaptor/service/poder/poder.go +++ b/adaptor/pod_adaptor/service/poder/poder.go @@ -2,10 +2,8 @@ package poder import ( "context" - - "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" - "gitlink.org.cn/JCCE/PCM/common/tenanter" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant" "github.com/golang/glog" @@ -18,7 +16,8 @@ var ( ) type Poder interface { - ListDetail(ctx context.Context, req *pbpod.ListDetailReq) (resp *pbpod.ListDetailResp, err error) + ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (resp *pbpod.ListPodDetailResp, err error) + CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (resp *pbpod.CreatePodResp, err error) } func NewPodClient(provider pbtenant.CloudProvider, region tenanter.Region, tenant tenanter.Tenanter) (poder Poder, err error) { @@ -32,11 +31,11 @@ func NewPodClient(provider pbtenant.CloudProvider, region tenanter.Region, tenan switch provider { case pbtenant.CloudProvider_ali: - return newAliPodClient(region, tenant) - //case pbtenant.CloudProvider_tencent: - // return newTencentPodClient(region, tenant) + return newAliEciClient(region, tenant) + case pbtenant.CloudProvider_tencent: + return nil, nil case pbtenant.CloudProvider_huawei: - return newHuaweiPodClient(region, tenant) + return nil, nil //TODO aws //case pbtenant.CloudProvider_aws: // return newAwsPodClient(region, tenant) diff --git a/adaptor/pod_adaptor/service/poder/tencent_eks.go b/adaptor/pod_adaptor/service/poder/tencent_eks.go new file mode 100644 index 00000000..37723ed3 --- /dev/null +++ b/adaptor/pod_adaptor/service/poder/tencent_eks.go @@ -0,0 +1,139 @@ +package poder + +// +//import ( +// "fmt" +// "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" +// "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" +// "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" +// tke "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525" +// "gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/common/auth/aksk" +// pcmCommon "gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/common/config" +//) +// +//func CreateEksInstance(cloudStack string, akskPath string, configPath string) { +// +// configCommon, _ := pcmCommon.PCMconfig(configPath) +// configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) +// +// credential := common.NewCredential( +// configAksk.AccessKey, +// configAksk.SecretKey, +// ) +// cpf := profile.NewClientProfile() +// cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" +// client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) +// +// request := tke.NewCreateEKSContainerInstancesRequest() +// +// eksCiName := &configCommon.ContainerGroupName +// containerName := &configCommon.ContainerName +// containerImage := &configCommon.ContainerImage +// eksCpu := &configCommon.CpuPodFloat +// eksMemory := &configCommon.MemoryPodFloat +// securityGroupId := &configCommon.SecurityGroupId +// securityGroupIds := make([]*string, 1) +// securityGroupIds[0] = securityGroupId +// subNetId := &configCommon.SubnetId +// vpcId := &configCommon.VpcId +// +// request.EksCiName = eksCiName +// container := make([]*tke.Container, 1) +// container[0] = new(tke.Container) +// container[0].Name = containerName +// container[0].Image = containerImage +// //container[0].Cpu = containerCpuPt +// //container[0].Memory = containerMemoryPt +// +// request.Containers = container +// request.Cpu = eksCpu +// request.Memory = eksMemory +// request.SecurityGroupIds = securityGroupIds +// request.SubnetId = subNetId +// request.VpcId = vpcId +// +// response, err := client.CreateEKSContainerInstances(request) +// if _, ok := err.(*errors.TencentCloudSDKError); ok { +// fmt.Printf("An API error has returned: %s", err) +// return +// } +// if err != nil { +// panic(err) +// } +// fmt.Printf("%s", response.ToJsonString()) +//} +// +//func ListEksInstance(cloudStack string, akskPath string, configPath string) { +// +// configCommon, _ := pcmCommon.PCMconfig(configPath) +// configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) +// +// credential := common.NewCredential(configAksk.AccessKey, configAksk.SecretKey) +// cpf := profile.NewClientProfile() +// cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" +// client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) +// +// request := tke.NewDescribeEKSContainerInstancesRequest() +// +// response, err := client.DescribeEKSContainerInstances(request) +// if _, ok := err.(*errors.TencentCloudSDKError); ok { +// fmt.Printf("An API error has returned: %s", err) +// return +// } +// if err != nil { +// panic(err) +// } +// fmt.Printf("%s", response.ToJsonString()) +//} +// +//func UpdateEksInstance(cloudStack string, akskPath string, configPath string) { +// +// configCommon, _ := pcmCommon.PCMconfig(configPath) +// configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) +// +// credential := common.NewCredential(configAksk.AccessKey, configAksk.SecretKey) +// cpf := profile.NewClientProfile() +// cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" +// client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) +// +// request := tke.NewUpdateEKSContainerInstanceRequest() +// request.EksCiId = &configCommon.ContainerGroupIdUpdate +// request.Name = &configCommon.ContainerGroupNameUpdate +// +// response, err := client.UpdateEKSContainerInstance(request) +// if _, ok := err.(*errors.TencentCloudSDKError); ok { +// fmt.Printf("An API error has returned: %s", err) +// return +// } +// if err != nil { +// panic(err) +// } +// fmt.Printf("%s", response.ToJsonString()) +//} +// +//func DeleteEksInstance(cloudStack string, akskPath string, configPath string) { +// +// configCommon, _ := pcmCommon.PCMconfig(configPath) +// configAksk, _ := aksk.AkskConfig(cloudStack, akskPath) +// +// credential := common.NewCredential(configAksk.AccessKey, configAksk.SecretKey) +// cpf := profile.NewClientProfile() +// cpf.HttpProfile.Endpoint = "tke.tencentcloudapi.com" +// client, _ := tke.NewClient(credential, configCommon.RegionId, cpf) +// +// request := tke.NewDeleteEKSContainerInstancesRequest() +// eksCiIds := make([]*string, 1) +// eksCiIds[0] = &configCommon.ContainerGroupIdDelete +// +// request.EksCiIds = eksCiIds +// +// response, err := client.DeleteEKSContainerInstances(request) +// if _, ok := err.(*errors.TencentCloudSDKError); ok { +// fmt.Printf("An API error has returned: %s", err) +// return +// } +// if err != nil { +// panic(err) +// } +// fmt.Printf("%s", response.ToJsonString()) +//} diff --git a/cm_bridge/cm_adaptor b/cm_bridge/cm_adaptor deleted file mode 100644 index e69de29b..00000000 diff --git a/common/server/server.go b/common/server/server.go index cb70570a..68d52bb9 100644 --- a/common/server/server.go +++ b/common/server/server.go @@ -2,18 +2,16 @@ package server import ( "context" - - "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" - "gitlink.org.cn/JCCE/PCM/lan_trans/idl/demo" "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" ) type Server struct { // 使用unsafe可以强制让编译器检查是否实现了相关方法 demo.UnsafeDemoServiceServer pbecs.UnsafeEcsServiceServer - pbpod.UnimplementedPodServiceServer + pbpod.UnsafePodServiceServer } func (s *Server) Echo(ctx context.Context, req *demo.StringMessage) (*demo.StringMessage, error) { diff --git a/common/server/server_pod.go b/common/server/server_pod.go index 7833b676..8f4ed672 100644 --- a/common/server/server_pod.go +++ b/common/server/server_pod.go @@ -2,7 +2,6 @@ package server import ( "context" - "gitlink.org.cn/JCCE/PCM/adaptor/pod_adaptor/server/pod" "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" @@ -11,9 +10,17 @@ import ( "google.golang.org/grpc/status" ) -// ListPodDetail return pod detail -func (s *Server) ListPodDetail(ctx context.Context, req *pbpod.ListDetailReq) (*pbpod.ListDetailResp, error) { - resp, err := pod.ListDetail(ctx, req) +func (s *Server) CreatePod(ctx context.Context, req *pbpod.CreatePodReq) (*pbpod.CreatePodResp, error) { + resp, err := pod.CreatePod(ctx, req) + if err != nil { + glog.Errorf("CreatePod error %+v", err) + return nil, status.Errorf(codes.Internal, err.Error()) + } + return resp, nil +} + +func (s *Server) ListPodDetail(ctx context.Context, req *pbpod.ListPodDetailReq) (*pbpod.ListPodDetailResp, error) { + resp, err := pod.ListPodDetail(ctx, req) if err != nil { glog.Errorf("ListPodDetail error %+v", err) return nil, status.Errorf(codes.Internal, err.Error()) @@ -21,12 +28,20 @@ func (s *Server) ListPodDetail(ctx context.Context, req *pbpod.ListDetailReq) (* return resp, nil } -//ListPod return pod list -func (s *Server) ListPod(ctx context.Context, req *pbpod.ListReq) (*pbpod.ListResp, error) { - resp, err := pod.List(ctx, req) +func (s *Server) ListPod(ctx context.Context, req *pbpod.ListPodReq) (*pbpod.ListPodResp, error) { + resp, err := pod.ListPod(ctx, req) if err != nil { glog.Errorf("ListPod error %+v", err) return nil, status.Errorf(codes.Internal, err.Error()) } return resp, nil } + +func (s *Server) ListPodAll(ctx context.Context, req *pbpod.ListPodAllReq) (*pbpod.ListPodResp, error) { + resp, err := pod.ListPodAll(ctx) + if err != nil { + glog.Errorf("ListPodAll error %+v", err) + return nil, status.Errorf(codes.Internal, err.Error()) + } + return resp, nil +} diff --git a/configs/config_template.yaml b/configs/config_template.yaml index 27b43ac4..35c9c9f4 100644 --- a/configs/config_template.yaml +++ b/configs/config_template.yaml @@ -2,13 +2,13 @@ configs: # provider 0:阿里云 1:腾讯云 2:华为云 - provider: 0 name: "ali-PCM" - accessid: "" - accesssecret: "" + accessid: "LTAI5tSCnrhQAdbFhGyWkSL2" + accesssecret: "KN4tqu8lalQdo47SoUQBb88qOWjzYC" - provider: 1 name: "tencent-PCM" - accessid: "" - accesssecret: "" + accessid: "AKIDRefQxnhmuqTU1KRWFl58wQeCE0XoAeEZ" + accesssecret: "LUMVRmGj2kFrEahhZzA5pKvHNSMASntj" - provider: 2 name: "huawei-PCM" - accessid: "" - accesssecret: "" + accessid: "ATQTIWUT9K66VRMMXKVY" + accesssecret: "Wa0aixDVuhZOfDZGWvgIJQBHnyiDlGdgDn1Ai5Yy" diff --git a/idl/pbpod/pod.proto b/idl/pbpod/pod.proto index 33879de6..da73f608 100644 --- a/idl/pbpod/pod.proto +++ b/idl/pbpod/pod.proto @@ -12,71 +12,90 @@ message PodInstance { // 账号名称 string account_name = 2; // 实例id - string instance_id = 3; + string pod_id = 3; // 实例名称 - string instance_name = 4; + string pod_name = 4; // 地域,数据中心 - string region_name = 5; - // 公网ip - string public_ips = 6; - // 实例类型 - string instance_type = 7; - // vcpu数 - int32 cpu = 8; - // 内存MB - int32 memory = 9; - // 实例描述 - string description = 10; - // 状态 - string status = 11; - // 创建时间,ISO8601 - string creation_time = 12; - // 过期时间 - string expire_time = 13; - // 内网ip - repeated string inner_ips = 14; - // vpc id - string vpc_id = 15; - // 安全组id - string security_group_id = 16; - // 子网Id - string SubnetId = 17; - // 容器实例 - Container Container = 18; -} - -message Container { - // 容器镜像 - string image = 1; + int32 region_id = 5; + // 镜像 + string container_image = 6; // 容器名称 - string name = 2; + string container_name = 7; // vcpu数 - int32 cpu = 3; + float cpu_pod = 8; // 内存MB - int32 memory = 4; - // 重启次数 - int32 restart_count = 5; + float memory_pod = 9; + + //安全组ID 对应腾讯 SecurityGroupIds(腾讯必需) + string security_group_id = 10; + //子网ID 对应腾讯 SubnetId(腾讯必需) + string subnet_id = 11; + //VPC ID 对应腾讯 VpcId(腾讯必需) + string vpc_id = 12; + //名空间 + string namespace = 13; + } -message ListDetailReq { + +message CreatePodReq { + // 云类型 + pbtenant.CloudProvider provider = 1; + // 账号名称 + string account_name = 2; + // 实例id + string pod_id = 3; + // 实例名称 + string pod_name = 4; + // 地域,数据中心 + int32 region_id = 5; + // 镜像 + string container_image = 6; + // 容器名称 + string container_name = 7; + // v cpu数 + float cpu_pod = 8; + // 内存MB + float memory_pod = 9; + //安全组ID 对应腾讯 SecurityGroupIds(腾讯必需) + string security_group_id = 10; + //子网ID 对应腾讯 SubnetId(腾讯必需) + string subnet_id = 11; + //VPC ID 对应腾讯 VpcId(腾讯必需) + string vpc_id = 12; + //名空间 + string namespace = 13; +} + +message CreatePodResp { + // Pod集合 + repeated PodInstance pods = 1; + // 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询 + bool finished = 2; + // 请求id,出现问题后提供给云厂商,排查问题 + string request_id = 3; +} + + +message ListPodDetailReq { // 云名称 pbtenant.CloudProvider provider = 1; // 账户名称,根据config.yaml中的配置,默认为第一个配置的账户 string account_name = 2; // 区域Id,参考 tenant.proto 中的各个云的区域 int32 region_id = 3; + // podID + int32 pod_id = 4; // 分页相关参数,页码 - int32 page_number = 4; + int32 page_number = 5; // 分页相关参数,每页数量 - int32 page_size = 5; + int32 page_size = 6; // 分页相关参数,下一页的token - string next_token = 6; - // namespace - string namespace = 7; + string next_token = 7; } -message ListDetailResp { - // pod 容器组集合 +message ListPodDetailResp { + // Pod集合 repeated PodInstance pods = 1; // 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询 bool finished = 2; @@ -90,76 +109,56 @@ message ListDetailResp { string request_id = 6; } -message ListReq { +message ListPodReq { // 云名称 pbtenant.CloudProvider provider = 1; } -message ListResp { - // Pod 容器组集合 +message ListPodResp { + // pod集合 repeated PodInstance pods = 1; } -message CreateReq { - // 云名称 - pbtenant.CloudProvider provider = 1; - // 账户名称,根据config.yaml中的配置,默认为第一个配置的账户 - string account_name = 2; - // 区域Id,参考 tenant.proto 中的各个云的区域 - int32 region_id = 3; - // 镜像地址 - string container_image = 4; - // 容器名称 - string container_name = 5; - // 容器实例名称 - string container_group_name = 6; - // vcpu数 - int32 cpu = 7; - // 内存MB - int32 memory = 8; - // namespace (华为云cci必需) - string namespace = 9; - // 安全组id(腾讯云eks必需) - repeated string security_group_id = 10; - //subnet_id 子网id (腾讯云eks必需) - repeated string subnet_id = 11; - // vpc id (腾讯云eks必需) - string vpc_id = 12; -} +message ListPodAllReq{} -message CreateRep { - repeated string id = 1; - string request_id = 2; -} - -// 容器组类产品接口 +// Pod类产品接口 // 阿里云 - ECI -// 腾讯云 - EKS +// 腾讯云 - TKS // 华为云 - CCI + service PodService { - // 创建pod - 支持云类型、区域 - rpc CreatePod(CreateReq) returns (CreateRep) { + // 创建Pod + rpc CreatePod(CreatePodReq) returns (CreatePodResp) { option (google.api.http) = { post : "/apis/pod/create" body : "*" }; } - // 查询Pod明细 - 支持云类型、区域、账户、分页等过滤条件 - rpc ListPodDetail(ListDetailReq) returns (ListDetailResp) { + + // 查询Pod明细 + rpc ListPodDetail(ListPodDetailReq) returns (ListPodDetailResp) { option (google.api.http) = { post : "/apis/pod/detail" body : "*" }; } - // 查询pod全量 - 根据云类型 - rpc ListPod(ListReq) returns (ListResp) { + // 查询Pod全量 - 根据云类型 + rpc ListPod(ListPodReq) returns (ListPodResp) { option (google.api.http) = { post : "/apis/pod" body : "*" }; } + + // 查询所有云的Pod + rpc ListPodAll(ListPodAllReq) returns (ListPodResp) { + option (google.api.http) = { + post : "/apis/pod/all" + body : "*" + }; + } } \ No newline at end of file diff --git a/lan_trans/idl/demo/demo.pb.gw.go b/lan_trans/idl/demo/demo.pb.gw.go index 66ed1dcd..5fedd6b4 100644 --- a/lan_trans/idl/demo/demo.pb.gw.go +++ b/lan_trans/idl/demo/demo.pb.gw.go @@ -77,12 +77,13 @@ func RegisterDemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/demo.DemoService/Echo") + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/demo.DemoService/Echo", runtime.WithHTTPPathPattern("/apis/demo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_DemoService_Echo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_DemoService_Echo_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -139,12 +140,13 @@ func RegisterDemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/demo.DemoService/Echo") + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/demo.DemoService/Echo", runtime.WithHTTPPathPattern("/apis/demo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_DemoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_DemoService_Echo_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/lan_trans/idl/pbecs/ecs.pb.gw.go b/lan_trans/idl/pbecs/ecs.pb.gw.go index 95d63554..425292e0 100644 --- a/lan_trans/idl/pbecs/ecs.pb.gw.go +++ b/lan_trans/idl/pbecs/ecs.pb.gw.go @@ -145,12 +145,13 @@ func RegisterEcsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail") + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail", runtime.WithHTTPPathPattern("/apis/ecs/detail")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_EcsService_ListEcsDetail_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_EcsService_ListEcsDetail_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -168,12 +169,13 @@ func RegisterEcsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcs") + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcs", runtime.WithHTTPPathPattern("/apis/ecs")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_EcsService_ListEcs_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_EcsService_ListEcs_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -191,12 +193,13 @@ func RegisterEcsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll") + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll", runtime.WithHTTPPathPattern("/apis/ecs/all")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_EcsService_ListEcsAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_EcsService_ListEcsAll_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -253,12 +256,13 @@ func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail") + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsDetail", runtime.WithHTTPPathPattern("/apis/ecs/detail")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_EcsService_ListEcsDetail_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_EcsService_ListEcsDetail_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -273,12 +277,13 @@ func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcs") + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcs", runtime.WithHTTPPathPattern("/apis/ecs")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_EcsService_ListEcs_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_EcsService_ListEcs_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -293,12 +298,13 @@ func RegisterEcsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll") + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbecs.EcsService/ListEcsAll", runtime.WithHTTPPathPattern("/apis/ecs/all")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_EcsService_ListEcsAll_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_EcsService_ListEcsAll_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/lan_trans/idl/pbpod/pod.pb.go b/lan_trans/idl/pbpod/pod.pb.go index 99a55b57..3209d876 100644 --- a/lan_trans/idl/pbpod/pod.pb.go +++ b/lan_trans/idl/pbpod/pod.pb.go @@ -32,37 +32,27 @@ type PodInstance struct { // 账号名称 AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` // 实例id - InstanceId string `protobuf:"bytes,3,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` + PodId string `protobuf:"bytes,3,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"` // 实例名称 - InstanceName string `protobuf:"bytes,4,opt,name=instance_name,json=instanceName,proto3" json:"instance_name,omitempty"` + PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` // 地域,数据中心 - RegionName string `protobuf:"bytes,5,opt,name=region_name,json=regionName,proto3" json:"region_name,omitempty"` - // 公网ip - PublicIps string `protobuf:"bytes,6,opt,name=public_ips,json=publicIps,proto3" json:"public_ips,omitempty"` - // 实例类型 - InstanceType string `protobuf:"bytes,7,opt,name=instance_type,json=instanceType,proto3" json:"instance_type,omitempty"` + RegionId int32 `protobuf:"varint,5,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + // 镜像 + ContainerImage string `protobuf:"bytes,6,opt,name=container_image,json=containerImage,proto3" json:"container_image,omitempty"` + // 容器名称 + ContainerName string `protobuf:"bytes,7,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"` // vcpu数 - Cpu int32 `protobuf:"varint,8,opt,name=cpu,proto3" json:"cpu,omitempty"` + CpuPod float32 `protobuf:"fixed32,8,opt,name=cpu_pod,json=cpuPod,proto3" json:"cpu_pod,omitempty"` // 内存MB - Memory int32 `protobuf:"varint,9,opt,name=memory,proto3" json:"memory,omitempty"` - // 实例描述 - Description string `protobuf:"bytes,10,opt,name=description,proto3" json:"description,omitempty"` - // 状态 - Status string `protobuf:"bytes,11,opt,name=status,proto3" json:"status,omitempty"` - // 创建时间,ISO8601 - CreationTime string `protobuf:"bytes,12,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` - // 过期时间 - ExpireTime string `protobuf:"bytes,13,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"` - // 内网ip - InnerIps []string `protobuf:"bytes,14,rep,name=inner_ips,json=innerIps,proto3" json:"inner_ips,omitempty"` - // vpc id - VpcId string `protobuf:"bytes,15,opt,name=vpc_id,json=vpcId,proto3" json:"vpc_id,omitempty"` - // 安全组id - SecurityGroupId string `protobuf:"bytes,16,opt,name=security_group_id,json=securityGroupId,proto3" json:"security_group_id,omitempty"` - // 子网Id - SubnetId string `protobuf:"bytes,17,opt,name=SubnetId,proto3" json:"SubnetId,omitempty"` - // 容器实例 - Container *Container `protobuf:"bytes,18,opt,name=Container,proto3" json:"Container,omitempty"` + MemoryPod float32 `protobuf:"fixed32,9,opt,name=memory_pod,json=memoryPod,proto3" json:"memory_pod,omitempty"` + //安全组ID 对应腾讯 SecurityGroupIds(腾讯必需) + SecurityGroupId string `protobuf:"bytes,10,opt,name=security_group_id,json=securityGroupId,proto3" json:"security_group_id,omitempty"` + //子网ID 对应腾讯 SubnetId(腾讯必需) + SubnetId string `protobuf:"bytes,11,opt,name=subnet_id,json=subnetId,proto3" json:"subnet_id,omitempty"` + //VPC ID 对应腾讯 VpcId(腾讯必需) + VpcId string `protobuf:"bytes,12,opt,name=vpc_id,json=vpcId,proto3" json:"vpc_id,omitempty"` + //名空间 + Namespace string `protobuf:"bytes,13,opt,name=namespace,proto3" json:"namespace,omitempty"` } func (x *PodInstance) Reset() { @@ -111,95 +101,53 @@ func (x *PodInstance) GetAccountName() string { return "" } -func (x *PodInstance) GetInstanceId() string { +func (x *PodInstance) GetPodId() string { if x != nil { - return x.InstanceId + return x.PodId } return "" } -func (x *PodInstance) GetInstanceName() string { +func (x *PodInstance) GetPodName() string { if x != nil { - return x.InstanceName + return x.PodName } return "" } -func (x *PodInstance) GetRegionName() string { +func (x *PodInstance) GetRegionId() int32 { if x != nil { - return x.RegionName - } - return "" -} - -func (x *PodInstance) GetPublicIps() string { - if x != nil { - return x.PublicIps - } - return "" -} - -func (x *PodInstance) GetInstanceType() string { - if x != nil { - return x.InstanceType - } - return "" -} - -func (x *PodInstance) GetCpu() int32 { - if x != nil { - return x.Cpu + return x.RegionId } return 0 } -func (x *PodInstance) GetMemory() int32 { +func (x *PodInstance) GetContainerImage() string { if x != nil { - return x.Memory + return x.ContainerImage + } + return "" +} + +func (x *PodInstance) GetContainerName() string { + if x != nil { + return x.ContainerName + } + return "" +} + +func (x *PodInstance) GetCpuPod() float32 { + if x != nil { + return x.CpuPod } return 0 } -func (x *PodInstance) GetDescription() string { +func (x *PodInstance) GetMemoryPod() float32 { if x != nil { - return x.Description + return x.MemoryPod } - return "" -} - -func (x *PodInstance) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *PodInstance) GetCreationTime() string { - if x != nil { - return x.CreationTime - } - return "" -} - -func (x *PodInstance) GetExpireTime() string { - if x != nil { - return x.ExpireTime - } - return "" -} - -func (x *PodInstance) GetInnerIps() []string { - if x != nil { - return x.InnerIps - } - return nil -} - -func (x *PodInstance) GetVpcId() string { - if x != nil { - return x.VpcId - } - return "" + return 0 } func (x *PodInstance) GetSecurityGroupId() string { @@ -216,32 +164,55 @@ func (x *PodInstance) GetSubnetId() string { return "" } -func (x *PodInstance) GetContainer() *Container { +func (x *PodInstance) GetVpcId() string { if x != nil { - return x.Container + return x.VpcId } - return nil + return "" } -type Container struct { +func (x *PodInstance) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +type CreatePodReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // 容器镜像 - Image string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` + // 云类型 + Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` + // 账号名称 + AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` + // 实例id + PodId string `protobuf:"bytes,3,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"` + // 实例名称 + PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + // 地域,数据中心 + RegionId int32 `protobuf:"varint,5,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + // 镜像 + ContainerImage string `protobuf:"bytes,6,opt,name=container_image,json=containerImage,proto3" json:"container_image,omitempty"` // 容器名称 - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // vcpu数 - Cpu int32 `protobuf:"varint,3,opt,name=cpu,proto3" json:"cpu,omitempty"` + ContainerName string `protobuf:"bytes,7,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"` + // v cpu数 + CpuPod float32 `protobuf:"fixed32,8,opt,name=cpu_pod,json=cpuPod,proto3" json:"cpu_pod,omitempty"` // 内存MB - Memory int32 `protobuf:"varint,4,opt,name=memory,proto3" json:"memory,omitempty"` - // 重启次数 - RestartCount int32 `protobuf:"varint,5,opt,name=restart_count,json=restartCount,proto3" json:"restart_count,omitempty"` + MemoryPod float32 `protobuf:"fixed32,9,opt,name=memory_pod,json=memoryPod,proto3" json:"memory_pod,omitempty"` + //安全组ID 对应腾讯 SecurityGroupIds(腾讯必需) + SecurityGroupId string `protobuf:"bytes,10,opt,name=security_group_id,json=securityGroupId,proto3" json:"security_group_id,omitempty"` + //子网ID 对应腾讯 SubnetId(腾讯必需) + SubnetId string `protobuf:"bytes,11,opt,name=subnet_id,json=subnetId,proto3" json:"subnet_id,omitempty"` + //VPC ID 对应腾讯 VpcId(腾讯必需) + VpcId string `protobuf:"bytes,12,opt,name=vpc_id,json=vpcId,proto3" json:"vpc_id,omitempty"` + //名空间 + Namespace string `protobuf:"bytes,13,opt,name=namespace,proto3" json:"namespace,omitempty"` } -func (x *Container) Reset() { - *x = Container{} +func (x *CreatePodReq) Reset() { + *x = CreatePodReq{} if protoimpl.UnsafeEnabled { mi := &file_idl_pbpod_pod_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -249,13 +220,13 @@ func (x *Container) Reset() { } } -func (x *Container) String() string { +func (x *CreatePodReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Container) ProtoMessage() {} +func (*CreatePodReq) ProtoMessage() {} -func (x *Container) ProtoReflect() protoreflect.Message { +func (x *CreatePodReq) ProtoReflect() protoreflect.Message { mi := &file_idl_pbpod_pod_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -267,69 +238,117 @@ func (x *Container) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Container.ProtoReflect.Descriptor instead. -func (*Container) Descriptor() ([]byte, []int) { +// Deprecated: Use CreatePodReq.ProtoReflect.Descriptor instead. +func (*CreatePodReq) Descriptor() ([]byte, []int) { return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{1} } -func (x *Container) GetImage() string { +func (x *CreatePodReq) GetProvider() pbtenant.CloudProvider { if x != nil { - return x.Image + return x.Provider + } + return pbtenant.CloudProvider(0) +} + +func (x *CreatePodReq) GetAccountName() string { + if x != nil { + return x.AccountName } return "" } -func (x *Container) GetName() string { +func (x *CreatePodReq) GetPodId() string { if x != nil { - return x.Name + return x.PodId } return "" } -func (x *Container) GetCpu() int32 { +func (x *CreatePodReq) GetPodName() string { if x != nil { - return x.Cpu + return x.PodName + } + return "" +} + +func (x *CreatePodReq) GetRegionId() int32 { + if x != nil { + return x.RegionId } return 0 } -func (x *Container) GetMemory() int32 { +func (x *CreatePodReq) GetContainerImage() string { if x != nil { - return x.Memory + return x.ContainerImage + } + return "" +} + +func (x *CreatePodReq) GetContainerName() string { + if x != nil { + return x.ContainerName + } + return "" +} + +func (x *CreatePodReq) GetCpuPod() float32 { + if x != nil { + return x.CpuPod } return 0 } -func (x *Container) GetRestartCount() int32 { +func (x *CreatePodReq) GetMemoryPod() float32 { if x != nil { - return x.RestartCount + return x.MemoryPod } return 0 } -type ListDetailReq struct { +func (x *CreatePodReq) GetSecurityGroupId() string { + if x != nil { + return x.SecurityGroupId + } + return "" +} + +func (x *CreatePodReq) GetSubnetId() string { + if x != nil { + return x.SubnetId + } + return "" +} + +func (x *CreatePodReq) GetVpcId() string { + if x != nil { + return x.VpcId + } + return "" +} + +func (x *CreatePodReq) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +type CreatePodResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // 云名称 - Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` - // 账户名称,根据config.yaml中的配置,默认为第一个配置的账户 - AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` - // 区域Id,参考 tenant.proto 中的各个云的区域 - RegionId int32 `protobuf:"varint,3,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` - // 分页相关参数,页码 - PageNumber int32 `protobuf:"varint,4,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` - // 分页相关参数,每页数量 - PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // 分页相关参数,下一页的token - NextToken string `protobuf:"bytes,6,opt,name=next_token,json=nextToken,proto3" json:"next_token,omitempty"` - // namespace - Namespace string `protobuf:"bytes,7,opt,name=namespace,proto3" json:"namespace,omitempty"` + // Pod集合 + Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"` + // 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询 + Finished bool `protobuf:"varint,2,opt,name=finished,proto3" json:"finished,omitempty"` + // 请求id,出现问题后提供给云厂商,排查问题 + RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` } -func (x *ListDetailReq) Reset() { - *x = ListDetailReq{} +func (x *CreatePodResp) Reset() { + *x = CreatePodResp{} if protoimpl.UnsafeEnabled { mi := &file_idl_pbpod_pod_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -337,13 +356,13 @@ func (x *ListDetailReq) Reset() { } } -func (x *ListDetailReq) String() string { +func (x *CreatePodResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListDetailReq) ProtoMessage() {} +func (*CreatePodResp) ProtoMessage() {} -func (x *ListDetailReq) ProtoReflect() protoreflect.Message { +func (x *CreatePodResp) ProtoReflect() protoreflect.Message { mi := &file_idl_pbpod_pod_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -355,66 +374,140 @@ func (x *ListDetailReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListDetailReq.ProtoReflect.Descriptor instead. -func (*ListDetailReq) Descriptor() ([]byte, []int) { +// Deprecated: Use CreatePodResp.ProtoReflect.Descriptor instead. +func (*CreatePodResp) Descriptor() ([]byte, []int) { return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{2} } -func (x *ListDetailReq) GetProvider() pbtenant.CloudProvider { +func (x *CreatePodResp) GetPods() []*PodInstance { + if x != nil { + return x.Pods + } + return nil +} + +func (x *CreatePodResp) GetFinished() bool { + if x != nil { + return x.Finished + } + return false +} + +func (x *CreatePodResp) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +type ListPodDetailReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 云名称 + Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` + // 账户名称,根据config.yaml中的配置,默认为第一个配置的账户 + AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` + // 区域Id,参考 tenant.proto 中的各个云的区域 + RegionId int32 `protobuf:"varint,3,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + // podID + PodId int32 `protobuf:"varint,4,opt,name=pod_id,json=podId,proto3" json:"pod_id,omitempty"` + // 分页相关参数,页码 + PageNumber int32 `protobuf:"varint,5,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` + // 分页相关参数,每页数量 + PageSize int32 `protobuf:"varint,6,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // 分页相关参数,下一页的token + NextToken string `protobuf:"bytes,7,opt,name=next_token,json=nextToken,proto3" json:"next_token,omitempty"` +} + +func (x *ListPodDetailReq) Reset() { + *x = ListPodDetailReq{} + if protoimpl.UnsafeEnabled { + mi := &file_idl_pbpod_pod_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPodDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPodDetailReq) ProtoMessage() {} + +func (x *ListPodDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_idl_pbpod_pod_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListPodDetailReq.ProtoReflect.Descriptor instead. +func (*ListPodDetailReq) Descriptor() ([]byte, []int) { + return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{3} +} + +func (x *ListPodDetailReq) GetProvider() pbtenant.CloudProvider { if x != nil { return x.Provider } return pbtenant.CloudProvider(0) } -func (x *ListDetailReq) GetAccountName() string { +func (x *ListPodDetailReq) GetAccountName() string { if x != nil { return x.AccountName } return "" } -func (x *ListDetailReq) GetRegionId() int32 { +func (x *ListPodDetailReq) GetRegionId() int32 { if x != nil { return x.RegionId } return 0 } -func (x *ListDetailReq) GetPageNumber() int32 { +func (x *ListPodDetailReq) GetPodId() int32 { + if x != nil { + return x.PodId + } + return 0 +} + +func (x *ListPodDetailReq) GetPageNumber() int32 { if x != nil { return x.PageNumber } return 0 } -func (x *ListDetailReq) GetPageSize() int32 { +func (x *ListPodDetailReq) GetPageSize() int32 { if x != nil { return x.PageSize } return 0 } -func (x *ListDetailReq) GetNextToken() string { +func (x *ListPodDetailReq) GetNextToken() string { if x != nil { return x.NextToken } return "" } -func (x *ListDetailReq) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -type ListDetailResp struct { +type ListPodDetailResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // pod 容器组集合 + // Pod集合 Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"` // 查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询 Finished bool `protobuf:"varint,2,opt,name=finished,proto3" json:"finished,omitempty"` @@ -428,91 +521,8 @@ type ListDetailResp struct { RequestId string `protobuf:"bytes,6,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` } -func (x *ListDetailResp) Reset() { - *x = ListDetailResp{} - if protoimpl.UnsafeEnabled { - mi := &file_idl_pbpod_pod_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListDetailResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListDetailResp) ProtoMessage() {} - -func (x *ListDetailResp) ProtoReflect() protoreflect.Message { - mi := &file_idl_pbpod_pod_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListDetailResp.ProtoReflect.Descriptor instead. -func (*ListDetailResp) Descriptor() ([]byte, []int) { - return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{3} -} - -func (x *ListDetailResp) GetPods() []*PodInstance { - if x != nil { - return x.Pods - } - return nil -} - -func (x *ListDetailResp) GetFinished() bool { - if x != nil { - return x.Finished - } - return false -} - -func (x *ListDetailResp) GetPageNumber() int32 { - if x != nil { - return x.PageNumber - } - return 0 -} - -func (x *ListDetailResp) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListDetailResp) GetNextToken() string { - if x != nil { - return x.NextToken - } - return "" -} - -func (x *ListDetailResp) GetRequestId() string { - if x != nil { - return x.RequestId - } - return "" -} - -type ListReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // 云名称 - Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` -} - -func (x *ListReq) Reset() { - *x = ListReq{} +func (x *ListPodDetailResp) Reset() { + *x = ListPodDetailResp{} if protoimpl.UnsafeEnabled { mi := &file_idl_pbpod_pod_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -520,13 +530,13 @@ func (x *ListReq) Reset() { } } -func (x *ListReq) String() string { +func (x *ListPodDetailResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListReq) ProtoMessage() {} +func (*ListPodDetailResp) ProtoMessage() {} -func (x *ListReq) ProtoReflect() protoreflect.Message { +func (x *ListPodDetailResp) ProtoReflect() protoreflect.Message { mi := &file_idl_pbpod_pod_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -538,29 +548,64 @@ func (x *ListReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListReq.ProtoReflect.Descriptor instead. -func (*ListReq) Descriptor() ([]byte, []int) { +// Deprecated: Use ListPodDetailResp.ProtoReflect.Descriptor instead. +func (*ListPodDetailResp) Descriptor() ([]byte, []int) { return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{4} } -func (x *ListReq) GetProvider() pbtenant.CloudProvider { +func (x *ListPodDetailResp) GetPods() []*PodInstance { if x != nil { - return x.Provider + return x.Pods } - return pbtenant.CloudProvider(0) + return nil } -type ListResp struct { +func (x *ListPodDetailResp) GetFinished() bool { + if x != nil { + return x.Finished + } + return false +} + +func (x *ListPodDetailResp) GetPageNumber() int32 { + if x != nil { + return x.PageNumber + } + return 0 +} + +func (x *ListPodDetailResp) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListPodDetailResp) GetNextToken() string { + if x != nil { + return x.NextToken + } + return "" +} + +func (x *ListPodDetailResp) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +type ListPodReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Pod 容器组集合 - Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"` + // 云名称 + Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` } -func (x *ListResp) Reset() { - *x = ListResp{} +func (x *ListPodReq) Reset() { + *x = ListPodReq{} if protoimpl.UnsafeEnabled { mi := &file_idl_pbpod_pod_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -568,13 +613,13 @@ func (x *ListResp) Reset() { } } -func (x *ListResp) String() string { +func (x *ListPodReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListResp) ProtoMessage() {} +func (*ListPodReq) ProtoMessage() {} -func (x *ListResp) ProtoReflect() protoreflect.Message { +func (x *ListPodReq) ProtoReflect() protoreflect.Message { mi := &file_idl_pbpod_pod_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -586,51 +631,29 @@ func (x *ListResp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListResp.ProtoReflect.Descriptor instead. -func (*ListResp) Descriptor() ([]byte, []int) { +// Deprecated: Use ListPodReq.ProtoReflect.Descriptor instead. +func (*ListPodReq) Descriptor() ([]byte, []int) { return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{5} } -func (x *ListResp) GetPods() []*PodInstance { +func (x *ListPodReq) GetProvider() pbtenant.CloudProvider { if x != nil { - return x.Pods + return x.Provider } - return nil + return pbtenant.CloudProvider(0) } -type CreateReq struct { +type ListPodResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // 云名称 - Provider pbtenant.CloudProvider `protobuf:"varint,1,opt,name=provider,proto3,enum=pbtenant.CloudProvider" json:"provider,omitempty"` - // 账户名称,根据config.yaml中的配置,默认为第一个配置的账户 - AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` - // 区域Id,参考 tenant.proto 中的各个云的区域 - RegionId int32 `protobuf:"varint,3,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` - // 镜像地址 - ContainerImage string `protobuf:"bytes,4,opt,name=container_image,json=containerImage,proto3" json:"container_image,omitempty"` - // 容器名称 - ContainerName string `protobuf:"bytes,5,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"` - // 容器实例名称 - ContainerGroupName string `protobuf:"bytes,6,opt,name=container_group_name,json=containerGroupName,proto3" json:"container_group_name,omitempty"` - // vcpu数 - Cpu int32 `protobuf:"varint,7,opt,name=cpu,proto3" json:"cpu,omitempty"` - // 内存MB - Memory int32 `protobuf:"varint,8,opt,name=memory,proto3" json:"memory,omitempty"` - // namespace (华为云cci必需) - Namespace string `protobuf:"bytes,9,opt,name=namespace,proto3" json:"namespace,omitempty"` - // 安全组id(腾讯云eks必需) - SecurityGroupId []string `protobuf:"bytes,10,rep,name=security_group_id,json=securityGroupId,proto3" json:"security_group_id,omitempty"` - //subnet_id 子网id (腾讯云eks必需) - SubnetId []string `protobuf:"bytes,11,rep,name=subnet_id,json=subnetId,proto3" json:"subnet_id,omitempty"` - // vpc id (腾讯云eks必需) - VpcId string `protobuf:"bytes,12,opt,name=vpc_id,json=vpcId,proto3" json:"vpc_id,omitempty"` + // pod集合 + Pods []*PodInstance `protobuf:"bytes,1,rep,name=pods,proto3" json:"pods,omitempty"` } -func (x *CreateReq) Reset() { - *x = CreateReq{} +func (x *ListPodResp) Reset() { + *x = ListPodResp{} if protoimpl.UnsafeEnabled { mi := &file_idl_pbpod_pod_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -638,13 +661,13 @@ func (x *CreateReq) Reset() { } } -func (x *CreateReq) String() string { +func (x *ListPodResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateReq) ProtoMessage() {} +func (*ListPodResp) ProtoMessage() {} -func (x *CreateReq) ProtoReflect() protoreflect.Message { +func (x *ListPodResp) ProtoReflect() protoreflect.Message { mi := &file_idl_pbpod_pod_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -656,106 +679,26 @@ func (x *CreateReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateReq.ProtoReflect.Descriptor instead. -func (*CreateReq) Descriptor() ([]byte, []int) { +// Deprecated: Use ListPodResp.ProtoReflect.Descriptor instead. +func (*ListPodResp) Descriptor() ([]byte, []int) { return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{6} } -func (x *CreateReq) GetProvider() pbtenant.CloudProvider { +func (x *ListPodResp) GetPods() []*PodInstance { if x != nil { - return x.Provider - } - return pbtenant.CloudProvider(0) -} - -func (x *CreateReq) GetAccountName() string { - if x != nil { - return x.AccountName - } - return "" -} - -func (x *CreateReq) GetRegionId() int32 { - if x != nil { - return x.RegionId - } - return 0 -} - -func (x *CreateReq) GetContainerImage() string { - if x != nil { - return x.ContainerImage - } - return "" -} - -func (x *CreateReq) GetContainerName() string { - if x != nil { - return x.ContainerName - } - return "" -} - -func (x *CreateReq) GetContainerGroupName() string { - if x != nil { - return x.ContainerGroupName - } - return "" -} - -func (x *CreateReq) GetCpu() int32 { - if x != nil { - return x.Cpu - } - return 0 -} - -func (x *CreateReq) GetMemory() int32 { - if x != nil { - return x.Memory - } - return 0 -} - -func (x *CreateReq) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *CreateReq) GetSecurityGroupId() []string { - if x != nil { - return x.SecurityGroupId + return x.Pods } return nil } -func (x *CreateReq) GetSubnetId() []string { - if x != nil { - return x.SubnetId - } - return nil -} - -func (x *CreateReq) GetVpcId() string { - if x != nil { - return x.VpcId - } - return "" -} - -type CreateRep struct { +type ListPodAllReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Id []string `protobuf:"bytes,1,rep,name=id,proto3" json:"id,omitempty"` - RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` } -func (x *CreateRep) Reset() { - *x = CreateRep{} +func (x *ListPodAllReq) Reset() { + *x = ListPodAllReq{} if protoimpl.UnsafeEnabled { mi := &file_idl_pbpod_pod_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -763,13 +706,13 @@ func (x *CreateRep) Reset() { } } -func (x *CreateRep) String() string { +func (x *ListPodAllReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateRep) ProtoMessage() {} +func (*ListPodAllReq) ProtoMessage() {} -func (x *CreateRep) ProtoReflect() protoreflect.Message { +func (x *ListPodAllReq) ProtoReflect() protoreflect.Message { mi := &file_idl_pbpod_pod_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -781,25 +724,11 @@ func (x *CreateRep) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateRep.ProtoReflect.Descriptor instead. -func (*CreateRep) Descriptor() ([]byte, []int) { +// Deprecated: Use ListPodAllReq.ProtoReflect.Descriptor instead. +func (*ListPodAllReq) Descriptor() ([]byte, []int) { return file_idl_pbpod_pod_proto_rawDescGZIP(), []int{7} } -func (x *CreateRep) GetId() []string { - if x != nil { - return x.Id - } - return nil -} - -func (x *CreateRep) GetRequestId() string { - if x != nil { - return x.RequestId - } - return "" -} - var File_idl_pbpod_pod_proto protoreflect.FileDescriptor var file_idl_pbpod_pod_proto_rawDesc = []byte{ @@ -808,140 +737,133 @@ var file_idl_pbpod_pod_proto_rawDesc = []byte{ 0x6c, 0x2f, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, 0x04, 0x0a, 0x0b, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x03, 0x0a, 0x0b, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, - 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x23, - 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x69, - 0x70, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x49, 0x70, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, - 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, - 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x70, 0x73, 0x18, - 0x0e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x49, 0x70, 0x73, 0x12, - 0x15, 0x0a, 0x06, 0x76, 0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x70, 0x63, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x11, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x2e, - 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x12, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x52, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x84, - 0x01, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, - 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, - 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, - 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xff, 0x01, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, - 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, - 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, + 0x06, 0x70, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, + 0x6f, 0x64, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, + 0x63, 0x70, 0x75, 0x5f, 0x70, 0x6f, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x63, + 0x70, 0x75, 0x50, 0x6f, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, + 0x70, 0x6f, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x6f, 0x72, + 0x79, 0x50, 0x6f, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, + 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, + 0x06, 0x76, 0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x70, 0x63, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x22, 0xbb, 0x03, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, + 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, + 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x70, + 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x64, + 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x70, + 0x75, 0x5f, 0x70, 0x6f, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x63, 0x70, 0x75, + 0x50, 0x6f, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x6f, + 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x50, + 0x6f, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x76, + 0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x70, 0x63, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x22, 0x72, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, + 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, + 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x64, 0x22, 0xfb, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, + 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, + 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x15, + 0x0a, 0x06, 0x70, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x70, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, + 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, + 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0xd3, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x50, + 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, - 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, - 0x78, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x6e, 0x65, 0x78, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, + 0x78, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6e, 0x65, 0x78, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, 0x41, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, + 0x50, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, + 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x35, 0x0a, 0x0b, 0x4c, + 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x50, 0x6f, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x70, 0x6f, - 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1f, - 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, - 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, - 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, 0x3e, 0x0a, 0x07, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, - 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x32, 0x0a, 0x08, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x50, 0x6f, 0x64, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x22, 0xaa, - 0x03, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x33, 0x0a, 0x08, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, - 0x2e, 0x70, 0x62, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, - 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, - 0x6d, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x63, 0x70, 0x75, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, - 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x73, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, - 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, - 0x65, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x70, 0x63, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x09, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x32, 0xf7, 0x01, 0x0a, 0x0a, 0x50, 0x6f, 0x64, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x50, 0x6f, 0x64, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, - 0x10, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x59, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x62, - 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x10, 0x2f, 0x61, 0x70, 0x69, - 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x2f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x3a, 0x01, 0x2a, 0x12, - 0x40, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x70, - 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x70, - 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x0e, 0x22, 0x09, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x3a, 0x01, - 0x2a, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x6f, 0x72, 0x67, - 0x2e, 0x63, 0x6e, 0x2f, 0x4a, 0x43, 0x43, 0x45, 0x2f, 0x50, 0x43, 0x4d, 0x2f, 0x6c, 0x61, 0x6e, - 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x2f, 0x69, 0x64, 0x6c, 0x2f, 0x70, 0x62, 0x70, 0x6f, 0x64, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x41, 0x6c, 0x6c, + 0x52, 0x65, 0x71, 0x32, 0xdc, 0x02, 0x0a, 0x0a, 0x50, 0x6f, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x53, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x12, + 0x13, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, + 0x64, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x15, 0x22, 0x10, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x2f, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x5f, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, + 0x6f, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x71, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, + 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1b, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x15, 0x22, 0x10, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x2f, 0x64, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x3a, 0x01, 0x2a, 0x12, 0x46, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, + 0x50, 0x6f, 0x64, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x50, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x0e, 0x22, 0x09, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x3a, 0x01, 0x2a, + 0x12, 0x50, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x41, 0x6c, 0x6c, 0x12, 0x14, + 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x41, 0x6c, + 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x70, 0x6f, 0x64, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x50, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, + 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x70, 0x6f, 0x64, 0x2f, 0x61, 0x6c, 0x6c, 0x3a, + 0x01, 0x2a, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x6f, 0x72, + 0x67, 0x2e, 0x63, 0x6e, 0x2f, 0x4a, 0x43, 0x43, 0x45, 0x2f, 0x50, 0x43, 0x4d, 0x2f, 0x6c, 0x61, + 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x2f, 0x69, 0x64, 0x6c, 0x2f, 0x70, 0x62, 0x70, 0x6f, + 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -959,31 +881,33 @@ func file_idl_pbpod_pod_proto_rawDescGZIP() []byte { var file_idl_pbpod_pod_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_idl_pbpod_pod_proto_goTypes = []interface{}{ (*PodInstance)(nil), // 0: pbpod.PodInstance - (*Container)(nil), // 1: pbpod.Container - (*ListDetailReq)(nil), // 2: pbpod.ListDetailReq - (*ListDetailResp)(nil), // 3: pbpod.ListDetailResp - (*ListReq)(nil), // 4: pbpod.ListReq - (*ListResp)(nil), // 5: pbpod.ListResp - (*CreateReq)(nil), // 6: pbpod.CreateReq - (*CreateRep)(nil), // 7: pbpod.CreateRep + (*CreatePodReq)(nil), // 1: pbpod.CreatePodReq + (*CreatePodResp)(nil), // 2: pbpod.CreatePodResp + (*ListPodDetailReq)(nil), // 3: pbpod.ListPodDetailReq + (*ListPodDetailResp)(nil), // 4: pbpod.ListPodDetailResp + (*ListPodReq)(nil), // 5: pbpod.ListPodReq + (*ListPodResp)(nil), // 6: pbpod.ListPodResp + (*ListPodAllReq)(nil), // 7: pbpod.ListPodAllReq (pbtenant.CloudProvider)(0), // 8: pbtenant.CloudProvider } var file_idl_pbpod_pod_proto_depIdxs = []int32{ 8, // 0: pbpod.PodInstance.provider:type_name -> pbtenant.CloudProvider - 1, // 1: pbpod.PodInstance.Container:type_name -> pbpod.Container - 8, // 2: pbpod.ListDetailReq.provider:type_name -> pbtenant.CloudProvider - 0, // 3: pbpod.ListDetailResp.pods:type_name -> pbpod.PodInstance - 8, // 4: pbpod.ListReq.provider:type_name -> pbtenant.CloudProvider - 0, // 5: pbpod.ListResp.pods:type_name -> pbpod.PodInstance - 8, // 6: pbpod.CreateReq.provider:type_name -> pbtenant.CloudProvider - 6, // 7: pbpod.PodService.CreatePod:input_type -> pbpod.CreateReq - 2, // 8: pbpod.PodService.ListPodDetail:input_type -> pbpod.ListDetailReq - 4, // 9: pbpod.PodService.ListPod:input_type -> pbpod.ListReq - 7, // 10: pbpod.PodService.CreatePod:output_type -> pbpod.CreateRep - 3, // 11: pbpod.PodService.ListPodDetail:output_type -> pbpod.ListDetailResp - 5, // 12: pbpod.PodService.ListPod:output_type -> pbpod.ListResp - 10, // [10:13] is the sub-list for method output_type - 7, // [7:10] is the sub-list for method input_type + 8, // 1: pbpod.CreatePodReq.provider:type_name -> pbtenant.CloudProvider + 0, // 2: pbpod.CreatePodResp.pods:type_name -> pbpod.PodInstance + 8, // 3: pbpod.ListPodDetailReq.provider:type_name -> pbtenant.CloudProvider + 0, // 4: pbpod.ListPodDetailResp.pods:type_name -> pbpod.PodInstance + 8, // 5: pbpod.ListPodReq.provider:type_name -> pbtenant.CloudProvider + 0, // 6: pbpod.ListPodResp.pods:type_name -> pbpod.PodInstance + 1, // 7: pbpod.PodService.CreatePod:input_type -> pbpod.CreatePodReq + 3, // 8: pbpod.PodService.ListPodDetail:input_type -> pbpod.ListPodDetailReq + 5, // 9: pbpod.PodService.ListPod:input_type -> pbpod.ListPodReq + 7, // 10: pbpod.PodService.ListPodAll:input_type -> pbpod.ListPodAllReq + 2, // 11: pbpod.PodService.CreatePod:output_type -> pbpod.CreatePodResp + 4, // 12: pbpod.PodService.ListPodDetail:output_type -> pbpod.ListPodDetailResp + 6, // 13: pbpod.PodService.ListPod:output_type -> pbpod.ListPodResp + 6, // 14: pbpod.PodService.ListPodAll:output_type -> pbpod.ListPodResp + 11, // [11:15] is the sub-list for method output_type + 7, // [7:11] is the sub-list for method input_type 7, // [7:7] is the sub-list for extension type_name 7, // [7:7] is the sub-list for extension extendee 0, // [0:7] is the sub-list for field type_name @@ -1008,7 +932,7 @@ func file_idl_pbpod_pod_proto_init() { } } file_idl_pbpod_pod_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Container); i { + switch v := v.(*CreatePodReq); i { case 0: return &v.state case 1: @@ -1020,7 +944,7 @@ func file_idl_pbpod_pod_proto_init() { } } file_idl_pbpod_pod_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListDetailReq); i { + switch v := v.(*CreatePodResp); i { case 0: return &v.state case 1: @@ -1032,7 +956,7 @@ func file_idl_pbpod_pod_proto_init() { } } file_idl_pbpod_pod_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListDetailResp); i { + switch v := v.(*ListPodDetailReq); i { case 0: return &v.state case 1: @@ -1044,7 +968,7 @@ func file_idl_pbpod_pod_proto_init() { } } file_idl_pbpod_pod_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListReq); i { + switch v := v.(*ListPodDetailResp); i { case 0: return &v.state case 1: @@ -1056,7 +980,7 @@ func file_idl_pbpod_pod_proto_init() { } } file_idl_pbpod_pod_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResp); i { + switch v := v.(*ListPodReq); i { case 0: return &v.state case 1: @@ -1068,7 +992,7 @@ func file_idl_pbpod_pod_proto_init() { } } file_idl_pbpod_pod_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateReq); i { + switch v := v.(*ListPodResp); i { case 0: return &v.state case 1: @@ -1080,7 +1004,7 @@ func file_idl_pbpod_pod_proto_init() { } } file_idl_pbpod_pod_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateRep); i { + switch v := v.(*ListPodAllReq); i { case 0: return &v.state case 1: diff --git a/lan_trans/idl/pbpod/pod.pb.gw.go b/lan_trans/idl/pbpod/pod.pb.gw.go index 60395a5e..2fbe381a 100644 --- a/lan_trans/idl/pbpod/pod.pb.gw.go +++ b/lan_trans/idl/pbpod/pod.pb.gw.go @@ -32,7 +32,7 @@ var _ = utilities.NewDoubleArray var _ = metadata.Join func request_PodService_CreatePod_0(ctx context.Context, marshaler runtime.Marshaler, client PodServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateReq + var protoReq CreatePodReq var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -49,7 +49,7 @@ func request_PodService_CreatePod_0(ctx context.Context, marshaler runtime.Marsh } func local_request_PodService_CreatePod_0(ctx context.Context, marshaler runtime.Marshaler, server PodServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateReq + var protoReq CreatePodReq var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -66,7 +66,7 @@ func local_request_PodService_CreatePod_0(ctx context.Context, marshaler runtime } func request_PodService_ListPodDetail_0(ctx context.Context, marshaler runtime.Marshaler, client PodServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListDetailReq + var protoReq ListPodDetailReq var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -83,7 +83,7 @@ func request_PodService_ListPodDetail_0(ctx context.Context, marshaler runtime.M } func local_request_PodService_ListPodDetail_0(ctx context.Context, marshaler runtime.Marshaler, server PodServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListDetailReq + var protoReq ListPodDetailReq var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -100,7 +100,7 @@ func local_request_PodService_ListPodDetail_0(ctx context.Context, marshaler run } func request_PodService_ListPod_0(ctx context.Context, marshaler runtime.Marshaler, client PodServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListReq + var protoReq ListPodReq var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -117,7 +117,7 @@ func request_PodService_ListPod_0(ctx context.Context, marshaler runtime.Marshal } func local_request_PodService_ListPod_0(ctx context.Context, marshaler runtime.Marshaler, server PodServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListReq + var protoReq ListPodReq var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -133,6 +133,40 @@ func local_request_PodService_ListPod_0(ctx context.Context, marshaler runtime.M } +func request_PodService_ListPodAll_0(ctx context.Context, marshaler runtime.Marshaler, client PodServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodAllReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListPodAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_PodService_ListPodAll_0(ctx context.Context, marshaler runtime.Marshaler, server PodServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListPodAllReq + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListPodAll(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterPodServiceHandlerServer registers the http handlers for service PodService to "mux". // UnaryRPC :call PodServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -145,12 +179,13 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/CreatePod") + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/CreatePod", runtime.WithHTTPPathPattern("/apis/pod/create")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_PodService_CreatePod_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_PodService_CreatePod_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -168,12 +203,13 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail") + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail", runtime.WithHTTPPathPattern("/apis/pod/detail")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_PodService_ListPodDetail_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_PodService_ListPodDetail_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -191,12 +227,13 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPod") + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPod", runtime.WithHTTPPathPattern("/apis/pod")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_PodService_ListPod_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_PodService_ListPod_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -208,6 +245,30 @@ func RegisterPodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("POST", pattern_PodService_ListPodAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pbpod.PodService/ListPodAll", runtime.WithHTTPPathPattern("/apis/pod/all")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_PodService_ListPodAll_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPodAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -253,12 +314,13 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/CreatePod") + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/CreatePod", runtime.WithHTTPPathPattern("/apis/pod/create")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_PodService_CreatePod_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_PodService_CreatePod_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -273,12 +335,13 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail") + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodDetail", runtime.WithHTTPPathPattern("/apis/pod/detail")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_PodService_ListPodDetail_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_PodService_ListPodDetail_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -293,12 +356,13 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPod") + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPod", runtime.WithHTTPPathPattern("/apis/pod")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_PodService_ListPod_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_PodService_ListPod_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -309,6 +373,27 @@ func RegisterPodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("POST", pattern_PodService_ListPodAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/pbpod.PodService/ListPodAll", runtime.WithHTTPPathPattern("/apis/pod/all")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_PodService_ListPodAll_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_PodService_ListPodAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -318,6 +403,8 @@ var ( pattern_PodService_ListPodDetail_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "pod", "detail"}, "")) pattern_PodService_ListPod_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"apis", "pod"}, "")) + + pattern_PodService_ListPodAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "pod", "all"}, "")) ) var ( @@ -326,4 +413,6 @@ var ( forward_PodService_ListPodDetail_0 = runtime.ForwardResponseMessage forward_PodService_ListPod_0 = runtime.ForwardResponseMessage + + forward_PodService_ListPodAll_0 = runtime.ForwardResponseMessage ) diff --git a/lan_trans/idl/pbpod/pod_grpc.pb.go b/lan_trans/idl/pbpod/pod_grpc.pb.go index d4aeb23a..f68f345a 100644 --- a/lan_trans/idl/pbpod/pod_grpc.pb.go +++ b/lan_trans/idl/pbpod/pod_grpc.pb.go @@ -22,12 +22,14 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type PodServiceClient interface { - // 创建pod - 支持云类型、区域 - CreatePod(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*CreateRep, error) - // 查询Pod明细 - 支持云类型、区域、账户、分页等过滤条件 - ListPodDetail(ctx context.Context, in *ListDetailReq, opts ...grpc.CallOption) (*ListDetailResp, error) - // 查询pod全量 - 根据云类型 - ListPod(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListResp, error) + // 创建Pod + CreatePod(ctx context.Context, in *CreatePodReq, opts ...grpc.CallOption) (*CreatePodResp, error) + // 查询Pod明细 + ListPodDetail(ctx context.Context, in *ListPodDetailReq, opts ...grpc.CallOption) (*ListPodDetailResp, error) + // 查询Pod全量 - 根据云类型 + ListPod(ctx context.Context, in *ListPodReq, opts ...grpc.CallOption) (*ListPodResp, error) + // 查询所有云的Pod + ListPodAll(ctx context.Context, in *ListPodAllReq, opts ...grpc.CallOption) (*ListPodResp, error) } type podServiceClient struct { @@ -38,8 +40,8 @@ func NewPodServiceClient(cc grpc.ClientConnInterface) PodServiceClient { return &podServiceClient{cc} } -func (c *podServiceClient) CreatePod(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*CreateRep, error) { - out := new(CreateRep) +func (c *podServiceClient) CreatePod(ctx context.Context, in *CreatePodReq, opts ...grpc.CallOption) (*CreatePodResp, error) { + out := new(CreatePodResp) err := c.cc.Invoke(ctx, "/pbpod.PodService/CreatePod", in, out, opts...) if err != nil { return nil, err @@ -47,8 +49,8 @@ func (c *podServiceClient) CreatePod(ctx context.Context, in *CreateReq, opts .. return out, nil } -func (c *podServiceClient) ListPodDetail(ctx context.Context, in *ListDetailReq, opts ...grpc.CallOption) (*ListDetailResp, error) { - out := new(ListDetailResp) +func (c *podServiceClient) ListPodDetail(ctx context.Context, in *ListPodDetailReq, opts ...grpc.CallOption) (*ListPodDetailResp, error) { + out := new(ListPodDetailResp) err := c.cc.Invoke(ctx, "/pbpod.PodService/ListPodDetail", in, out, opts...) if err != nil { return nil, err @@ -56,8 +58,8 @@ func (c *podServiceClient) ListPodDetail(ctx context.Context, in *ListDetailReq, return out, nil } -func (c *podServiceClient) ListPod(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListResp, error) { - out := new(ListResp) +func (c *podServiceClient) ListPod(ctx context.Context, in *ListPodReq, opts ...grpc.CallOption) (*ListPodResp, error) { + out := new(ListPodResp) err := c.cc.Invoke(ctx, "/pbpod.PodService/ListPod", in, out, opts...) if err != nil { return nil, err @@ -65,16 +67,27 @@ func (c *podServiceClient) ListPod(ctx context.Context, in *ListReq, opts ...grp return out, nil } +func (c *podServiceClient) ListPodAll(ctx context.Context, in *ListPodAllReq, opts ...grpc.CallOption) (*ListPodResp, error) { + out := new(ListPodResp) + err := c.cc.Invoke(ctx, "/pbpod.PodService/ListPodAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // PodServiceServer is the server API for PodService service. // All implementations must embed UnimplementedPodServiceServer // for forward compatibility type PodServiceServer interface { - // 创建pod - 支持云类型、区域 - CreatePod(context.Context, *CreateReq) (*CreateRep, error) - // 查询Pod明细 - 支持云类型、区域、账户、分页等过滤条件 - ListPodDetail(context.Context, *ListDetailReq) (*ListDetailResp, error) - // 查询pod全量 - 根据云类型 - ListPod(context.Context, *ListReq) (*ListResp, error) + // 创建Pod + CreatePod(context.Context, *CreatePodReq) (*CreatePodResp, error) + // 查询Pod明细 + ListPodDetail(context.Context, *ListPodDetailReq) (*ListPodDetailResp, error) + // 查询Pod全量 - 根据云类型 + ListPod(context.Context, *ListPodReq) (*ListPodResp, error) + // 查询所有云的Pod + ListPodAll(context.Context, *ListPodAllReq) (*ListPodResp, error) mustEmbedUnimplementedPodServiceServer() } @@ -82,15 +95,18 @@ type PodServiceServer interface { type UnimplementedPodServiceServer struct { } -func (UnimplementedPodServiceServer) CreatePod(context.Context, *CreateReq) (*CreateRep, error) { +func (UnimplementedPodServiceServer) CreatePod(context.Context, *CreatePodReq) (*CreatePodResp, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePod not implemented") } -func (UnimplementedPodServiceServer) ListPodDetail(context.Context, *ListDetailReq) (*ListDetailResp, error) { +func (UnimplementedPodServiceServer) ListPodDetail(context.Context, *ListPodDetailReq) (*ListPodDetailResp, error) { return nil, status.Errorf(codes.Unimplemented, "method ListPodDetail not implemented") } -func (UnimplementedPodServiceServer) ListPod(context.Context, *ListReq) (*ListResp, error) { +func (UnimplementedPodServiceServer) ListPod(context.Context, *ListPodReq) (*ListPodResp, error) { return nil, status.Errorf(codes.Unimplemented, "method ListPod not implemented") } +func (UnimplementedPodServiceServer) ListPodAll(context.Context, *ListPodAllReq) (*ListPodResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListPodAll not implemented") +} func (UnimplementedPodServiceServer) mustEmbedUnimplementedPodServiceServer() {} // UnsafePodServiceServer may be embedded to opt out of forward compatibility for this service. @@ -105,7 +121,7 @@ func RegisterPodServiceServer(s grpc.ServiceRegistrar, srv PodServiceServer) { } func _PodService_CreatePod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateReq) + in := new(CreatePodReq) if err := dec(in); err != nil { return nil, err } @@ -117,13 +133,13 @@ func _PodService_CreatePod_Handler(srv interface{}, ctx context.Context, dec fun FullMethod: "/pbpod.PodService/CreatePod", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PodServiceServer).CreatePod(ctx, req.(*CreateReq)) + return srv.(PodServiceServer).CreatePod(ctx, req.(*CreatePodReq)) } return interceptor(ctx, in, info, handler) } func _PodService_ListPodDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListDetailReq) + in := new(ListPodDetailReq) if err := dec(in); err != nil { return nil, err } @@ -135,13 +151,13 @@ func _PodService_ListPodDetail_Handler(srv interface{}, ctx context.Context, dec FullMethod: "/pbpod.PodService/ListPodDetail", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PodServiceServer).ListPodDetail(ctx, req.(*ListDetailReq)) + return srv.(PodServiceServer).ListPodDetail(ctx, req.(*ListPodDetailReq)) } return interceptor(ctx, in, info, handler) } func _PodService_ListPod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListReq) + in := new(ListPodReq) if err := dec(in); err != nil { return nil, err } @@ -153,7 +169,25 @@ func _PodService_ListPod_Handler(srv interface{}, ctx context.Context, dec func( FullMethod: "/pbpod.PodService/ListPod", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PodServiceServer).ListPod(ctx, req.(*ListReq)) + return srv.(PodServiceServer).ListPod(ctx, req.(*ListPodReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PodService_ListPodAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPodAllReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PodServiceServer).ListPodAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pbpod.PodService/ListPodAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PodServiceServer).ListPodAll(ctx, req.(*ListPodAllReq)) } return interceptor(ctx, in, info, handler) } @@ -177,6 +211,10 @@ var PodService_ServiceDesc = grpc.ServiceDesc{ MethodName: "ListPod", Handler: _PodService_ListPod_Handler, }, + { + MethodName: "ListPodAll", + Handler: _PodService_ListPodAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "idl/pbpod/pod.proto", diff --git a/lan_trans/openapiv2/idl/demo/demo.swagger.json b/lan_trans/openapiv2/idl/demo/demo.swagger.json index a969e31b..d7db3be6 100644 --- a/lan_trans/openapiv2/idl/demo/demo.swagger.json +++ b/lan_trans/openapiv2/idl/demo/demo.swagger.json @@ -68,14 +68,11 @@ "protobufAny": { "type": "object", "properties": { - "typeUrl": { + "@type": { "type": "string" - }, - "value": { - "type": "string", - "format": "byte" } - } + }, + "additionalProperties": {} }, "rpcStatus": { "type": "object", diff --git a/lan_trans/openapiv2/idl/pbecs/ecs.swagger.json b/lan_trans/openapiv2/idl/pbecs/ecs.swagger.json index 6e80824e..84a423e2 100644 --- a/lan_trans/openapiv2/idl/pbecs/ecs.swagger.json +++ b/lan_trans/openapiv2/idl/pbecs/ecs.swagger.json @@ -186,7 +186,7 @@ }, "vpcId": { "type": "string", - "title": "vpc id" + "title": "vcp id" }, "resourceGroupId": { "type": "string", @@ -303,14 +303,11 @@ "protobufAny": { "type": "object", "properties": { - "typeUrl": { + "@type": { "type": "string" - }, - "value": { - "type": "string", - "format": "byte" } - } + }, + "additionalProperties": {} }, "rpcStatus": { "type": "object", diff --git a/lan_trans/openapiv2/idl/pbpod/pod.swagger.json b/lan_trans/openapiv2/idl/pbpod/pod.swagger.json index 0aec6131..22339bfe 100644 --- a/lan_trans/openapiv2/idl/pbpod/pod.swagger.json +++ b/lan_trans/openapiv2/idl/pbpod/pod.swagger.json @@ -18,13 +18,13 @@ "paths": { "/apis/pod": { "post": { - "summary": "查询pod全量 - 根据云类型", + "summary": "查询Pod全量 - 根据云类型", "operationId": "PodService_ListPod", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/pbpodListResp" + "$ref": "#/definitions/pbpodListPodResp" } }, "default": { @@ -40,7 +40,40 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/pbpodListReq" + "$ref": "#/definitions/pbpodListPodReq" + } + } + ], + "tags": [ + "PodService" + ] + } + }, + "/apis/pod/all": { + "post": { + "summary": "查询所有云的Pod", + "operationId": "PodService_ListPodAll", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/pbpodListPodResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/pbpodListPodAllReq" } } ], @@ -51,13 +84,13 @@ }, "/apis/pod/create": { "post": { - "summary": "创建pod - 支持云类型、区域", + "summary": "创建Pod", "operationId": "PodService_CreatePod", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/pbpodCreateRep" + "$ref": "#/definitions/pbpodCreatePodResp" } }, "default": { @@ -73,7 +106,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/pbpodCreateReq" + "$ref": "#/definitions/pbpodCreatePodReq" } } ], @@ -84,13 +117,13 @@ }, "/apis/pod/detail": { "post": { - "summary": "查询Pod明细 - 支持云类型、区域、账户、分页等过滤条件", + "summary": "查询Pod明细", "operationId": "PodService_ListPodDetail", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/pbpodListDetailResp" + "$ref": "#/definitions/pbpodListPodDetailResp" } }, "default": { @@ -106,7 +139,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/pbpodListDetailReq" + "$ref": "#/definitions/pbpodListPodDetailReq" } } ], @@ -117,111 +150,90 @@ } }, "definitions": { - "pbpodContainer": { - "type": "object", - "properties": { - "image": { - "type": "string", - "title": "容器镜像" - }, - "name": { - "type": "string", - "title": "容器名称" - }, - "cpu": { - "type": "integer", - "format": "int32", - "title": "vcpu数" - }, - "memory": { - "type": "integer", - "format": "int32", - "title": "内存MB" - }, - "restartCount": { - "type": "integer", - "format": "int32", - "title": "重启次数" - } - } - }, - "pbpodCreateRep": { - "type": "object", - "properties": { - "id": { - "type": "array", - "items": { - "type": "string" - } - }, - "requestId": { - "type": "string" - } - } - }, - "pbpodCreateReq": { + "pbpodCreatePodReq": { "type": "object", "properties": { "provider": { "$ref": "#/definitions/pbtenantCloudProvider", - "title": "云名称" + "title": "云类型" }, "accountName": { "type": "string", - "title": "账户名称,根据config.yaml中的配置,默认为第一个配置的账户" + "title": "账号名称" + }, + "podId": { + "type": "string", + "title": "实例id" + }, + "podName": { + "type": "string", + "title": "实例名称" }, "regionId": { "type": "integer", "format": "int32", - "title": "区域Id,参考 tenant.proto 中的各个云的区域" + "title": "地域,数据中心" }, "containerImage": { "type": "string", - "title": "镜像地址" + "title": "镜像" }, "containerName": { "type": "string", "title": "容器名称" }, - "containerGroupName": { - "type": "string", - "title": "容器实例名称" + "cpuPod": { + "type": "number", + "format": "float", + "title": "v cpu数" }, - "cpu": { - "type": "integer", - "format": "int32", - "title": "vcpu数" - }, - "memory": { - "type": "integer", - "format": "int32", + "memoryPod": { + "type": "number", + "format": "float", "title": "内存MB" }, - "namespace": { - "type": "string", - "title": "namespace (华为云cci必需)" - }, "securityGroupId": { - "type": "array", - "items": { - "type": "string" - }, - "title": "安全组id(腾讯云eks必需)" + "type": "string", + "title": "安全组ID 对应腾讯 SecurityGroupIds(腾讯必需)" }, "subnetId": { - "type": "array", - "items": { - "type": "string" - }, - "title": "subnet_id 子网id (腾讯云eks必需)" + "type": "string", + "title": "子网ID 对应腾讯 SubnetId(腾讯必需)" }, "vpcId": { "type": "string", - "title": "vpc id (腾讯云eks必需)" + "title": "VPC ID 对应腾讯 VpcId(腾讯必需)" + }, + "namespace": { + "type": "string", + "title": "名空间" } } }, - "pbpodListDetailReq": { + "pbpodCreatePodResp": { + "type": "object", + "properties": { + "pods": { + "type": "array", + "items": { + "$ref": "#/definitions/pbpodPodInstance" + }, + "title": "Pod集合" + }, + "finished": { + "type": "boolean", + "title": "查询是否完成,如果为否-false,则可以将下面三个分页参数填入到请求中,继续查询" + }, + "requestId": { + "type": "string", + "title": "请求id,出现问题后提供给云厂商,排查问题" + } + } + }, + "pbpodListPodAllReq": { + "type": "object" + }, + "pbpodListPodDetailReq": { "type": "object", "properties": { "provider": { @@ -237,6 +249,11 @@ "format": "int32", "title": "区域Id,参考 tenant.proto 中的各个云的区域" }, + "podId": { + "type": "integer", + "format": "int32", + "title": "podID" + }, "pageNumber": { "type": "integer", "format": "int32", @@ -250,14 +267,10 @@ "nextToken": { "type": "string", "title": "分页相关参数,下一页的token" - }, - "namespace": { - "type": "string", - "title": "namespace" } } }, - "pbpodListDetailResp": { + "pbpodListPodDetailResp": { "type": "object", "properties": { "pods": { @@ -265,7 +278,7 @@ "items": { "$ref": "#/definitions/pbpodPodInstance" }, - "title": "pod 容器组集合" + "title": "Pod集合" }, "finished": { "type": "boolean", @@ -291,7 +304,7 @@ } } }, - "pbpodListReq": { + "pbpodListPodReq": { "type": "object", "properties": { "provider": { @@ -300,7 +313,7 @@ } } }, - "pbpodListResp": { + "pbpodListPodResp": { "type": "object", "properties": { "pods": { @@ -308,7 +321,7 @@ "items": { "$ref": "#/definitions/pbpodPodInstance" }, - "title": "Pod 容器组集合" + "title": "pod集合" } } }, @@ -323,74 +336,52 @@ "type": "string", "title": "账号名称" }, - "instanceId": { + "podId": { "type": "string", "title": "实例id" }, - "instanceName": { + "podName": { "type": "string", "title": "实例名称" }, - "regionName": { - "type": "string", + "regionId": { + "type": "integer", + "format": "int32", "title": "地域,数据中心" }, - "publicIps": { + "containerImage": { "type": "string", - "title": "公网ip" + "title": "镜像" }, - "instanceType": { + "containerName": { "type": "string", - "title": "实例类型" + "title": "容器名称" }, - "cpu": { - "type": "integer", - "format": "int32", + "cpuPod": { + "type": "number", + "format": "float", "title": "vcpu数" }, - "memory": { - "type": "integer", - "format": "int32", + "memoryPod": { + "type": "number", + "format": "float", "title": "内存MB" }, - "description": { - "type": "string", - "title": "实例描述" - }, - "status": { - "type": "string", - "title": "状态" - }, - "creationTime": { - "type": "string", - "title": "创建时间,ISO8601" - }, - "expireTime": { - "type": "string", - "title": "过期时间" - }, - "innerIps": { - "type": "array", - "items": { - "type": "string" - }, - "title": "内网ip" - }, - "vpcId": { - "type": "string", - "title": "vpc id" - }, "securityGroupId": { "type": "string", - "title": "安全组id" + "title": "安全组ID 对应腾讯 SecurityGroupIds(腾讯必需)" }, - "SubnetId": { + "subnetId": { "type": "string", - "title": "子网Id" + "title": "子网ID 对应腾讯 SubnetId(腾讯必需)" }, - "Container": { - "$ref": "#/definitions/pbpodContainer", - "title": "容器实例" + "vpcId": { + "type": "string", + "title": "VPC ID 对应腾讯 VpcId(腾讯必需)" + }, + "namespace": { + "type": "string", + "title": "名空间" } } }, @@ -409,14 +400,11 @@ "protobufAny": { "type": "object", "properties": { - "typeUrl": { + "@type": { "type": "string" - }, - "value": { - "type": "string", - "format": "byte" } - } + }, + "additionalProperties": {} }, "rpcStatus": { "type": "object", diff --git a/lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json b/lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json index 636ce737..0a73b355 100644 --- a/lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json +++ b/lan_trans/openapiv2/idl/pbtenant/tenant.swagger.json @@ -15,14 +15,11 @@ "protobufAny": { "type": "object", "properties": { - "typeUrl": { + "@type": { "type": "string" - }, - "value": { - "type": "string", - "format": "byte" } - } + }, + "additionalProperties": {} }, "rpcStatus": { "type": "object", diff --git a/main.go b/main.go index efb3eae6..d5ceec95 100644 --- a/main.go +++ b/main.go @@ -3,17 +3,17 @@ package main import ( "context" "flag" + "gitlink.org.cn/JCCE/PCM/common/server" + "gitlink.org.cn/JCCE/PCM/common/tenanter" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/demo" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs" + "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" "net" "net/http" "github.com/golang/glog" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/pkg/errors" - "gitlink.org.cn/JCCE/PCM/common/server" - "gitlink.org.cn/JCCE/PCM/common/tenanter" - "gitlink.org.cn/JCCE/PCM/lan_trans/idl/demo" - "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs" - "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod" "google.golang.org/grpc" ) @@ -37,7 +37,7 @@ func run() error { } else if err = pbecs.RegisterEcsServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts); err != nil { return errors.Wrap(err, "RegisterEcsServiceHandlerFromEndpoint error") } else if err = pbpod.RegisterPodServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts); err != nil { - return errors.Wrap(err, "RegisterPoderviceHandlerFromEndpoint error") + return errors.Wrap(err, "RegisterPodServiceHandlerFromEndpoint error") } // Start HTTP server (and proxy calls to gRPC server endpoint)