修改mod地址,Huawei SDK 修改和查询功能更新

This commit is contained in:
zhouqunjie 2022-05-16 15:53:12 +08:00
parent 771d105af0
commit a1ba5e96ef
44 changed files with 2148 additions and 196 deletions

View File

@ -1,15 +1,15 @@
package ali
import (
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"errors"
"flag"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"github.com/golang/glog"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"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"
"strconv"
)
@ -45,8 +45,8 @@ func CreateContainerGroup(request *CreateContainerGroupRequest) (response *Creat
regionId, _ = tenanter.GetAliRegionId(request.RegionId)
case 1:
regionId, _ = tenanter.GetTencentRegionId(request.RegionId)
case 2:
//华为的CPU和内存数量要进行转换
regionId, _ = tenanter.GetHuaweiRegionId(request.RegionId)
cpuPod = strconv.FormatFloat(cpuPodFloat*1000, 'f', 0, 64)
memoryPod = strconv.FormatFloat(memoryPodFloat, 'f', 0, 64)

View File

@ -16,15 +16,15 @@
package ali
import (
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"errors"
"flag"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"github.com/golang/glog"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"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"
)
// DeleteContainerGroup invokes the eci.DeleteContainerGroup API synchronously

View File

@ -1,11 +1,11 @@
package ali
import (
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
)
// DescribeContainerGroups invokes the eci.DescribeContainerGroups API synchronously

View File

@ -16,15 +16,15 @@
package ali
import (
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"errors"
"flag"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"github.com/golang/glog"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"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"
)
// UpdateContainerGroup invokes the eci.UpdateContainerGroup API synchronously

View File

@ -299,7 +299,7 @@ const (
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PersistentVolume (PV) is a storage resource provisioned by an administrator.
// It is analogous to a node.
@ -415,7 +415,7 @@ type PersistentVolumeStatus struct {
Reason string `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PersistentVolumeList is a list of PersistentVolume items.
type PersistentVolumeList struct {
@ -430,7 +430,7 @@ type PersistentVolumeList struct {
}
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
type PersistentVolumeClaim struct {
@ -452,7 +452,7 @@ type PersistentVolumeClaim struct {
Status PersistentVolumeClaimStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PersistentVolumeClaimList is a list of PersistentVolumeClaim items.
type PersistentVolumeClaimList struct {
@ -3664,7 +3664,7 @@ type PodStatus struct {
EphemeralContainerStatuses []ContainerStatus `json:"ephemeralContainerStatuses,omitempty" protobuf:"bytes,13,rep,name=ephemeralContainerStatuses"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
type PodStatusResult struct {
@ -3685,7 +3685,7 @@ type PodStatusResult struct {
// +genclient
// +genclient:method=GetEphemeralContainers,verb=get,subresource=ephemeralcontainers,result=EphemeralContainers
// +genclient:method=UpdateEphemeralContainers,verb=update,subresource=ephemeralcontainers,input=EphemeralContainers,result=EphemeralContainers
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Pod is a collection of containers that can run on a host. This resource is created
// by clients and scheduled onto hosts.
@ -3710,7 +3710,7 @@ type Pod struct {
Status PodStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodList is a list of Pods.
type PodList struct {
@ -3739,7 +3739,7 @@ type PodTemplateSpec struct {
}
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodTemplate describes a template for creating copies of a predefined pod.
type PodTemplate struct {
@ -3755,7 +3755,7 @@ type PodTemplate struct {
Template PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodTemplateList is a list of PodTemplates.
type PodTemplateList struct {
@ -3863,9 +3863,9 @@ type ReplicationControllerCondition struct {
}
// +genclient
// +genclient:method=GetScale,verb=get,subresource=scale,result=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/autoscaling/v1.Scale
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/autoscaling/v1.Scale,result=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/autoscaling/v1.Scale
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +genclient:method=GetScale,verb=get,subresource=scale,result=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/autoscaling/v1.Scale
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/autoscaling/v1.Scale,result=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/autoscaling/v1.Scale
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ReplicationController represents the configuration of a replication controller.
type ReplicationController struct {
@ -3891,7 +3891,7 @@ type ReplicationController struct {
Status ReplicationControllerStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ReplicationControllerList is a collection of replication controllers.
type ReplicationControllerList struct {
@ -4374,7 +4374,7 @@ type ServicePort struct {
// +genclient
// +genclient:skipVerbs=deleteCollection
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Service is a named abstraction of software service (for example, mysql) consisting of local port
// (for example 3306) that the proxy listens on, and the selector that determines which pods
@ -4405,7 +4405,7 @@ const (
ClusterIPNone = "None"
)
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ServiceList holds a list of services.
type ServiceList struct {
@ -4420,8 +4420,8 @@ type ServiceList struct {
}
// +genclient
// +genclient:method=CreateToken,verb=create,subresource=token,input=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/authentication/v1.TokenRequest,result=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/authentication/v1.TokenRequest
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +genclient:method=CreateToken,verb=create,subresource=token,input=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/authentication/v1.TokenRequest,result=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/authentication/v1.TokenRequest
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ServiceAccount binds together:
// * a name, understood by users, and perhaps by peripheral systems, for an identity
@ -4454,7 +4454,7 @@ type ServiceAccount struct {
AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty" protobuf:"varint,4,opt,name=automountServiceAccountToken"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ServiceAccountList is a list of ServiceAccount objects
type ServiceAccountList struct {
@ -4470,7 +4470,7 @@ type ServiceAccountList struct {
}
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Endpoints is a collection of endpoints that implement the actual service. Example:
// Name: "mysvc",
@ -4577,7 +4577,7 @@ type EndpointPort struct {
AppProtocol *string `json:"appProtocol,omitempty" protobuf:"bytes,4,opt,name=appProtocol"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// EndpointsList is a list of endpoints.
type EndpointsList struct {
@ -4970,7 +4970,7 @@ type ResourceList map[ResourceName]resource.Quantity
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Node is a worker node in Kubernetes.
// Each node will have a unique identifier in the cache (i.e. in etcd).
@ -4994,7 +4994,7 @@ type Node struct {
Status NodeStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// NodeList is the whole list of all Nodes which have been registered with master.
type NodeList struct {
@ -5088,7 +5088,7 @@ type NamespaceCondition struct {
// +genclient
// +genclient:nonNamespaced
// +genclient:skipVerbs=deleteCollection
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Namespace provides a scope for Names.
// Use of multiple namespaces is optional.
@ -5110,7 +5110,7 @@ type Namespace struct {
Status NamespaceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// NamespaceList is a list of Namespaces.
type NamespaceList struct {
@ -5125,7 +5125,7 @@ type NamespaceList struct {
Items []Namespace `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Binding ties one object to another; for example, a pod is bound to a node by a scheduler.
// Deprecated in 1.7, please use the bindings subresource of pods instead.
@ -5140,7 +5140,7 @@ type Binding struct {
Target ObjectReference `json:"target" protobuf:"bytes,2,opt,name=target"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// A list of ephemeral containers used with the Pod ephemeralcontainers subresource.
type EphemeralContainers struct {
@ -5161,11 +5161,11 @@ type EphemeralContainers struct {
type Preconditions struct {
// Specifies the target UID.
// +optional
UID *types.UID `json:"uid,omitempty" protobuf:"bytes,1,opt,name=uid,casttype=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/types.UID"`
UID *types.UID `json:"uid,omitempty" protobuf:"bytes,1,opt,name=uid,casttype=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/types.UID"`
}
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodLogOptions is the query options for a Pod's logs REST call.
type PodLogOptions struct {
@ -5217,7 +5217,7 @@ type PodLogOptions struct {
}
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodAttachOptions is the query options to a Pod's remote attach call.
// ---
@ -5255,7 +5255,7 @@ type PodAttachOptions struct {
}
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodExecOptions is the query options to a Pod's remote exec call.
// ---
@ -5294,7 +5294,7 @@ type PodExecOptions struct {
}
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodPortForwardOptions is the query options to a Pod's port forward call
// when using WebSockets.
@ -5312,7 +5312,7 @@ type PodPortForwardOptions struct {
}
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// PodProxyOptions is the query options to a Pod's proxy call.
type PodProxyOptions struct {
@ -5324,7 +5324,7 @@ type PodProxyOptions struct {
}
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// NodeProxyOptions is the query options to a Node's proxy call.
type NodeProxyOptions struct {
@ -5336,7 +5336,7 @@ type NodeProxyOptions struct {
}
// +k8s:conversion-gen:explicit-from=net/url.Values
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ServiceProxyOptions is the query options to a Service's proxy call.
type ServiceProxyOptions struct {
@ -5366,7 +5366,7 @@ type ServiceProxyOptions struct {
// will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control.
// Instead of using this type, create a locally provided and used type that is well-focused on your reference.
// For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 .
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
type ObjectReference struct {
// Kind of the referent.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
@ -5383,7 +5383,7 @@ type ObjectReference struct {
// UID of the referent.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
// +optional
UID types.UID `json:"uid,omitempty" protobuf:"bytes,4,opt,name=uid,casttype=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/types.UID"`
UID types.UID `json:"uid,omitempty" protobuf:"bytes,4,opt,name=uid,casttype=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/types.UID"`
// API version of the referent.
// +optional
APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,5,opt,name=apiVersion"`
@ -5428,7 +5428,7 @@ type TypedLocalObjectReference struct {
Name string `json:"name" protobuf:"bytes,3,opt,name=name"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// SerializedReference is a reference to serialized object.
type SerializedReference struct {
@ -5457,7 +5457,7 @@ const (
)
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Event is a report of an event somewhere in the cluster. Events
// have a limited retention time and triggers and messages may evolve
@ -5541,7 +5541,7 @@ type EventSeries struct {
// +k8s:deprecated=state,protobuf=3
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// EventList is a list of events.
type EventList struct {
@ -5555,7 +5555,7 @@ type EventList struct {
Items []Event `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// List holds a list of objects, which may not be known by the server.
type List metav1.List
@ -5600,7 +5600,7 @@ type LimitRangeSpec struct {
}
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// LimitRange sets resource usage limits for each kind of resource in a Namespace.
type LimitRange struct {
@ -5616,7 +5616,7 @@ type LimitRange struct {
Spec LimitRangeSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// LimitRangeList is a list of LimitRange items.
type LimitRangeList struct {
@ -5759,7 +5759,7 @@ type ResourceQuotaStatus struct {
}
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ResourceQuota sets aggregate quota restrictions enforced per namespace
type ResourceQuota struct {
@ -5780,7 +5780,7 @@ type ResourceQuota struct {
Status ResourceQuotaStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ResourceQuotaList is a list of ResourceQuota items.
type ResourceQuotaList struct {
@ -5796,7 +5796,7 @@ type ResourceQuotaList struct {
}
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Secret holds secret data of a certain type. The total bytes of the values in
// the Data field must be less than MaxSecretSize bytes.
@ -5921,7 +5921,7 @@ const (
SecretTypeBootstrapToken SecretType = "bootstrap.kubernetes.io/token"
)
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// SecretList is a list of Secret.
type SecretList struct {
@ -5937,7 +5937,7 @@ type SecretList struct {
}
// +genclient
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ConfigMap holds configuration data for pods to consume.
type ConfigMap struct {
@ -5973,7 +5973,7 @@ type ConfigMap struct {
BinaryData map[string][]byte `json:"binaryData,omitempty" protobuf:"bytes,3,rep,name=binaryData"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ConfigMapList is a resource containing a list of ConfigMap objects.
type ConfigMapList struct {
@ -6015,7 +6015,7 @@ type ComponentCondition struct {
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
// Deprecated: This API is deprecated in v1.19+
@ -6033,7 +6033,7 @@ type ComponentStatus struct {
Conditions []ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// Status of all the conditions for the component as a list of ComponentStatus objects.
// Deprecated: This API is deprecated in v1.19+
@ -6219,7 +6219,7 @@ type WindowsSecurityContextOptions struct {
RunAsUserName *string `json:"runAsUserName,omitempty" protobuf:"bytes,3,opt,name=runAsUserName"`
}
// +k8s:deepcopy-gen:interfaces=gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/apimachinery/pkg/runtime.Object
// RangeAllocation is not a public type.
type RangeAllocation struct {

View File

@ -0,0 +1,181 @@
/*
Copyright 2016 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 v1
import (
"encoding/json"
"time"
)
const RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00"
// MicroTime is version of Time with microsecond level precision.
//
// +protobuf.options.marshal=false
// +protobuf.as=Timestamp
// +protobuf.options.(gogoproto.goproto_stringer)=false
type MicroTime struct {
time.Time `protobuf:"-"`
}
// DeepCopy returns a deep-copy of the MicroTime value. The underlying time.Time
// type is effectively immutable in the time API, so it is safe to
// copy-by-assign, despite the presence of (unexported) Pointer fields.
func (t *MicroTime) DeepCopyInto(out *MicroTime) {
*out = *t
}
// NewMicroTime returns a wrapped instance of the provided time
func NewMicroTime(time time.Time) MicroTime {
return MicroTime{time}
}
// DateMicro returns the MicroTime corresponding to the supplied parameters
// by wrapping time.Date.
func DateMicro(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) MicroTime {
return MicroTime{time.Date(year, month, day, hour, min, sec, nsec, loc)}
}
// NowMicro returns the current local time.
func NowMicro() MicroTime {
return MicroTime{time.Now()}
}
// IsZero returns true if the value is nil or time is zero.
func (t *MicroTime) IsZero() bool {
if t == nil {
return true
}
return t.Time.IsZero()
}
// Before reports whether the time instant t is before u.
func (t *MicroTime) Before(u *MicroTime) bool {
if t != nil && u != nil {
return t.Time.Before(u.Time)
}
return false
}
// Equal reports whether the time instant t is equal to u.
func (t *MicroTime) Equal(u *MicroTime) bool {
if t == nil && u == nil {
return true
}
if t != nil && u != nil {
return t.Time.Equal(u.Time)
}
return false
}
// BeforeTime reports whether the time instant t is before second-lever precision u.
func (t *MicroTime) BeforeTime(u *Time) bool {
if t != nil && u != nil {
return t.Time.Before(u.Time)
}
return false
}
// EqualTime reports whether the time instant t is equal to second-lever precision u.
func (t *MicroTime) EqualTime(u *Time) bool {
if t == nil && u == nil {
return true
}
if t != nil && u != nil {
return t.Time.Equal(u.Time)
}
return false
}
// UnixMicro returns the local time corresponding to the given Unix time
// by wrapping time.Unix.
func UnixMicro(sec int64, nsec int64) MicroTime {
return MicroTime{time.Unix(sec, nsec)}
}
// UnmarshalJSON implements the json.Unmarshaller interface.
func (t *MicroTime) UnmarshalJSON(b []byte) error {
if len(b) == 4 && string(b) == "null" {
t.Time = time.Time{}
return nil
}
var str string
err := json.Unmarshal(b, &str)
if err != nil {
return err
}
pt, err := time.Parse(RFC3339Micro, str)
if err != nil {
return err
}
t.Time = pt.Local()
return nil
}
// UnmarshalQueryParameter converts from a URL query parameter value to an object
func (t *MicroTime) UnmarshalQueryParameter(str string) error {
if len(str) == 0 {
t.Time = time.Time{}
return nil
}
// Tolerate requests from older clients that used JSON serialization to build query params
if len(str) == 4 && str == "null" {
t.Time = time.Time{}
return nil
}
pt, err := time.Parse(RFC3339Micro, str)
if err != nil {
return err
}
t.Time = pt.Local()
return nil
}
// MarshalJSON implements the json.Marshaler interface.
func (t MicroTime) MarshalJSON() ([]byte, error) {
if t.IsZero() {
// Encode unset/nil objects as JSON's "null".
return []byte("null"), nil
}
return json.Marshal(t.UTC().Format(RFC3339Micro))
}
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
func (_ MicroTime) OpenAPISchemaType() []string { return []string{"string"} }
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
func (_ MicroTime) OpenAPISchemaFormat() string { return "date-time" }
// MarshalQueryParameter converts to a URL query parameter value
func (t MicroTime) MarshalQueryParameter() (string, error) {
if t.IsZero() {
// Encode unset/nil objects as an empty string
return "", nil
}
return t.UTC().Format(RFC3339Micro), nil
}

View File

@ -0,0 +1,182 @@
/*
Copyright 2014 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 v1
import (
"encoding/json"
"time"
)
// Time is a wrapper around time.Time which supports correct
// marshaling to YAML and JSON. Wrappers are provided for many
// of the factory methods that the time package offers.
//
// +protobuf.options.marshal=false
// +protobuf.as=Timestamp
// +protobuf.options.(gogoproto.goproto_stringer)=false
type Time struct {
time.Time `protobuf:"-"`
}
// DeepCopyInto creates a deep-copy of the Time value. The underlying time.Time
// type is effectively immutable in the time API, so it is safe to
// copy-by-assign, despite the presence of (unexported) Pointer fields.
func (t *Time) DeepCopyInto(out *Time) {
*out = *t
}
// NewTime returns a wrapped instance of the provided time
func NewTime(time time.Time) Time {
return Time{time}
}
// Date returns the Time corresponding to the supplied parameters
// by wrapping time.Date.
func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time {
return Time{time.Date(year, month, day, hour, min, sec, nsec, loc)}
}
// Now returns the current local time.
func Now() Time {
return Time{time.Now()}
}
// IsZero returns true if the value is nil or time is zero.
func (t *Time) IsZero() bool {
if t == nil {
return true
}
return t.Time.IsZero()
}
// Before reports whether the time instant t is before u.
func (t *Time) Before(u *Time) bool {
if t != nil && u != nil {
return t.Time.Before(u.Time)
}
return false
}
// Equal reports whether the time instant t is equal to u.
func (t *Time) Equal(u *Time) bool {
if t == nil && u == nil {
return true
}
if t != nil && u != nil {
return t.Time.Equal(u.Time)
}
return false
}
// Unix returns the local time corresponding to the given Unix time
// by wrapping time.Unix.
func Unix(sec int64, nsec int64) Time {
return Time{time.Unix(sec, nsec)}
}
// Rfc3339Copy returns a copy of the Time at second-level precision.
func (t Time) Rfc3339Copy() Time {
copied, _ := time.Parse(time.RFC3339, t.Format(time.RFC3339))
return Time{copied}
}
// UnmarshalJSON implements the json.Unmarshaller interface.
func (t *Time) UnmarshalJSON(b []byte) error {
if len(b) == 4 && string(b) == "null" {
t.Time = time.Time{}
return nil
}
var str string
err := json.Unmarshal(b, &str)
if err != nil {
return err
}
pt, err := time.Parse(time.RFC3339, str)
if err != nil {
return err
}
t.Time = pt.Local()
return nil
}
// UnmarshalQueryParameter converts from a URL query parameter value to an object
func (t *Time) UnmarshalQueryParameter(str string) error {
if len(str) == 0 {
t.Time = time.Time{}
return nil
}
// Tolerate requests from older clients that used JSON serialization to build query params
if len(str) == 4 && str == "null" {
t.Time = time.Time{}
return nil
}
pt, err := time.Parse(time.RFC3339, str)
if err != nil {
return err
}
t.Time = pt.Local()
return nil
}
// MarshalJSON implements the json.Marshaler interface.
func (t Time) MarshalJSON() ([]byte, error) {
if t.IsZero() {
// Encode unset/nil objects as JSON's "null".
return []byte("null"), nil
}
buf := make([]byte, 0, len(time.RFC3339)+2)
buf = append(buf, '"')
// time cannot contain non escapable JSON characters
buf = t.UTC().AppendFormat(buf, time.RFC3339)
buf = append(buf, '"')
return buf, nil
}
// ToUnstructured implements the value.UnstructuredConverter interface.
func (t Time) ToUnstructured() interface{} {
if t.IsZero() {
return nil
}
buf := make([]byte, 0, len(time.RFC3339))
buf = t.UTC().AppendFormat(buf, time.RFC3339)
return string(buf)
}
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
func (_ Time) OpenAPISchemaType() []string { return []string{"string"} }
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
func (_ Time) OpenAPISchemaFormat() string { return "date-time" }
// MarshalQueryParameter converts to a URL query parameter value
func (t Time) MarshalQueryParameter() (string, error) {
if t.IsZero() {
// Encode unset/nil objects as an empty string
return "", nil
}
return t.UTC().Format(time.RFC3339), nil
}

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ package kubernetes
import (
"fmt"
corev1 "gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/client-go/kubernetes/typed/core/v1"
corev1 "code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/client-go/kubernetes/typed/core/v1"
discovery "k8s.io/client-go/discovery"
admissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1"
admissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1"

View File

@ -1,21 +1,21 @@
package v1
import (
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"context"
json "encoding/json"
"errors"
"flag"
"fmt"
"github.com/golang/glog"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"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"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strconv"
"time"
v1 "gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/core/v1"
v1 "code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/core/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/applyconfigurations/core/v1"
@ -37,7 +37,7 @@ type PodInterface interface {
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Pod, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.PodList, error)
List(ctx context.Context, pod *v1.Pod, opts metav1.ListOptions) (*v1.PodList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error)
Apply(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error)
@ -76,19 +76,54 @@ func (c *pods) Get(ctx context.Context, name string, options metav1.GetOptions)
}
// List takes label and field selectors, and returns the list of Pods that match those selectors.
func (c *pods) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
func (c *pods) List(ctx context.Context, pod *v1.Pod, opts metav1.ListOptions) (result *v1.PodList, err error) {
providerId := pod.Spec.ProviderId
regionId := pod.Spec.RegionId
accountName := pod.Spec.AccountName
provider := pbtenant.CloudProvider(providerId)
requestPCM := &pbpod.ListPodReq{
RequestSource: "huawei",
Provider: provider,
Namespace: "pcm",
}
resp, err := server.ListPod(nil, requestPCM)
//trans PCM response pod set to Ali ContainerGroup set
var pods = make([]v1.Pod, len(resp.Pods))
for k := range resp.Pods {
podId := resp.Pods[k].PodId
containerName := resp.Pods[k].ContainerName
containerImage := resp.Pods[k].ContainerImage
podName := resp.Pods[k].PodName
container := v1.Container{
Name: containerName,
Image: containerImage,
}
var containers []v1.Container
containers = append(containers, container)
podSpec := v1.PodSpec{
ProviderId: providerId,
RegionId: regionId,
AccountName: accountName,
Containers: containers,
}
pod := v1.Pod{
TypeMeta: metav1.TypeMeta{APIVersion: "core/V1", Kind: "Pod"},
ObjectMeta: metav1.ObjectMeta{Name: podName, Namespace: "pcm", UID: types.UID(podId)},
Spec: podSpec,
Status: v1.PodStatus{},
}
pods[k] = pod
}
result = &v1.PodList{
TypeMeta: metav1.TypeMeta{},
ListMeta: metav1.ListMeta{},
Items: pods,
}
result = &v1.PodList{}
err = c.client.Get().
Namespace(c.ns).
Resource("pods").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
@ -234,14 +269,122 @@ func (c *pods) Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOption
// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
func (c *pods) Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
result = &v1.Pod{}
err = c.client.Put().
Namespace(c.ns).
Resource("pods").
Name(pod.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(pod).
Do(ctx).
Into(result)
provider := pbtenant.CloudProvider(pod.Spec.ProviderId)
var configFile string
flag.StringVar(&configFile, "confHuawei", "configs/config.yaml", "config.yaml")
flag.Parse()
defer glog.Flush()
if err := tenanter.LoadCloudConfigsFromFile(configFile); err != nil {
if !errors.Is(err, tenanter.ErrLoadTenanterFileEmpty) {
glog.Fatalf("tenanter.LoadCloudConfigsFromFile error %+v", err)
}
glog.Warningf("tenanter.LoadCloudConfigsFromFile empty file path %s", configFile)
}
glog.Infof("load tenant from file finished")
tenanters, err := tenanter.GetTenanters(provider)
var regionId int32
var cpuPod string
var memoryPod string
//华为(K8S)与其他厂商的CPU单位和格式有区别
switch pod.Spec.ProviderId {
case 0:
regionId, _ = tenanter.GetAliRegionId(pod.Spec.RegionId)
cpuPod = strconv.FormatInt(pod.Spec.Containers[0].Resources.Limits.Cpu().MilliValue()/1000, 10)
memoryPod = strconv.FormatInt(pod.Spec.Containers[0].Resources.Limits.Memory().MilliValue()/1024/1024/1024/1000, 10)
case 1:
regionId, _ = tenanter.GetTencentRegionId(pod.Spec.RegionId)
cpuPod = strconv.FormatInt(pod.Spec.Containers[0].Resources.Limits.Cpu().MilliValue()/1000, 10)
memoryPod = strconv.FormatInt(pod.Spec.Containers[0].Resources.Limits.Memory().MilliValue()/1024/1024/1024/1000, 10)
case 2:
regionId, _ = tenanter.GetHuaweiRegionId(pod.Spec.RegionId)
cpuPod = pod.Spec.Containers[0].Resources.Limits.Cpu().String()
memoryPod = pod.Spec.Containers[0].Resources.Limits.Memory().String()
case 3:
regionId, _ = tenanter.GetK8SRegionId(pod.Spec.RegionId)
cpuPod = strconv.FormatInt(pod.Spec.Containers[0].Resources.Limits.Cpu().MilliValue()/1000, 10)
memoryPod = strconv.FormatInt(pod.Spec.Containers[0].Resources.Limits.Memory().MilliValue()/1024/1024/1024/1000, 10)
}
requestPCM := &pbpod.UpdatePodReq{
RequestSource: "huawei",
Provider: provider,
PcmId: string(pod.ObjectMeta.UID),
PodId: string(pod.ObjectMeta.UID),
AccountName: tenanters[0].AccountName(),
PodName: pod.Name,
RegionId: regionId,
ContainerImage: pod.Spec.Containers[0].Image,
ContainerName: pod.Spec.Containers[0].Name,
CpuPod: cpuPod,
MemoryPod: memoryPod,
Namespace: pod.ObjectMeta.Namespace,
}
server.UpdatePod(nil, requestPCM)
result = &v1.Pod{
TypeMeta: metav1.TypeMeta{},
ObjectMeta: metav1.ObjectMeta{},
Spec: v1.PodSpec{
ProviderId: pod.Spec.ProviderId,
RegionId: pod.Spec.RegionId,
AccountName: pod.Spec.AccountName,
Volumes: nil,
InitContainers: nil,
Containers: pod.Spec.Containers,
EphemeralContainers: nil,
RestartPolicy: "",
TerminationGracePeriodSeconds: nil,
ActiveDeadlineSeconds: nil,
DNSPolicy: "",
NodeSelector: nil,
ServiceAccountName: "",
DeprecatedServiceAccount: "",
AutomountServiceAccountToken: nil,
NodeName: "",
HostNetwork: false,
HostPID: false,
HostIPC: false,
ShareProcessNamespace: nil,
SecurityContext: nil,
ImagePullSecrets: nil,
Hostname: "",
Subdomain: "",
Affinity: nil,
SchedulerName: "",
Tolerations: nil,
HostAliases: nil,
PriorityClassName: "",
Priority: nil,
DNSConfig: nil,
ReadinessGates: nil,
RuntimeClassName: nil,
EnableServiceLinks: nil,
PreemptionPolicy: nil,
Overhead: nil,
TopologySpreadConstraints: nil,
SetHostnameAsFQDN: nil,
},
Status: v1.PodStatus{
Phase: "",
Conditions: nil,
Message: "",
Reason: "",
NominatedNodeName: "",
HostIP: "",
PodIP: "",
PodIPs: nil,
StartTime: nil,
InitContainerStatuses: nil,
ContainerStatuses: nil,
QOSClass: "",
EphemeralContainerStatuses: nil,
},
}
return
}

View File

@ -6,10 +6,10 @@ import (
"fmt"
"sync"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/service"
"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"
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/service"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"github.com/golang/glog"
"github.com/pkg/errors"

View File

@ -9,10 +9,10 @@ import (
"strconv"
"sync"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"github.com/pkg/errors"
"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"
)
var aliClientMutex sync.Mutex

View File

@ -12,16 +12,16 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
corev1 "k8s.io/api/core/v1"
huaweicci "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/clientcmd/api"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"github.com/pkg/errors"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
)
var huaweiClientMutex sync.Mutex

View File

@ -1,13 +1,13 @@
package poder
import (
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"context"
"fmt"
"github.com/golang/glog"
"github.com/pkg/errors"
"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"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -1,10 +1,10 @@
package poder
import (
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"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"
"github.com/golang/glog"
"github.com/pkg/errors"

View File

@ -7,14 +7,14 @@ import (
"github.com/golang/glog"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"github.com/pkg/errors"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
tencenteks "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
)
var tencentClientMutex sync.Mutex

View File

@ -4,12 +4,12 @@ import (
"context"
"sync"
"code.gitlink.org.cn/JCCE/PCM/adaptor/vm/service/ecser"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"github.com/golang/glog"
"github.com/pkg/errors"
"gitlink.org.cn/JCCE/PCM/adaptor/vm/service/ecser"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
)
//CreateMultipleEcs 创建多云ECS

View File

@ -1,9 +1,9 @@
package ecs
import (
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"context"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"testing"
)

View File

@ -1,8 +1,8 @@
package ecs
import (
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"os"
"testing"
)

View File

@ -4,6 +4,9 @@ import (
"context"
"sync"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
string_ "github.com/alibabacloud-go/darabonba-string/client"
aliecs "github.com/alibabacloud-go/ecs-20140526/v2/client"
@ -11,9 +14,6 @@ import (
"github.com/alibabacloud-go/tea/tea"
"github.com/golang/glog"
"github.com/pkg/errors"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
)
var aliClientMutex sync.Mutex

View File

@ -10,10 +10,10 @@ package ecser
// awsec2 "github.com/aws/aws-sdk-go-v2/service/ec2"
// "github.com/pkg/errors"
//
// "gitlink.org.cn/JCCE/PCM/common/tenanter"
// "code.gitlink.org.cn/JCCE/PCM/common/tenanter"
//
// "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
// "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
// "code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
// "code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
//)
//
//type AwsEcs struct {

View File

@ -3,9 +3,9 @@ package ecser
import (
"context"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"github.com/golang/glog"
"github.com/pkg/errors"

View File

@ -1,10 +1,10 @@
package ecser
import (
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"context"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"testing"
)

View File

@ -1,6 +1,9 @@
package ecser
import (
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"context"
"fmt"
"github.com/harvester/harvester/pkg/apis/harvesterhci.io/v1beta1"
@ -8,9 +11,6 @@ import (
"github.com/longhorn/longhorn-manager/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -4,6 +4,9 @@ import (
"context"
"strconv"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
string_ "github.com/alibabacloud-go/darabonba-string/client"
util "github.com/alibabacloud-go/tea-utils/service"
"github.com/alibabacloud-go/tea/tea"
@ -16,9 +19,6 @@ import (
iammodel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iam/v3/model"
iamregion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iam/v3/region"
"github.com/pkg/errors"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
)
type HuaweiEcs struct {

View File

@ -1,8 +1,8 @@
package ecser
import (
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"os"
"testing"
)

View File

@ -4,6 +4,9 @@ import (
"context"
"strconv"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
string_ "github.com/alibabacloud-go/darabonba-string/client"
util "github.com/alibabacloud-go/tea-utils/service"
"github.com/alibabacloud-go/tea/tea"
@ -12,9 +15,6 @@ import (
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
"gitlink.org.cn/JCCE/PCM/common/tenanter"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
)
type TencentCvm struct {

View File

@ -1,10 +1,10 @@
package server
import (
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/demo"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"context"
"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 {

View File

@ -3,8 +3,8 @@ package server
import (
"context"
"gitlink.org.cn/JCCE/PCM/adaptor/vm/server/ecs"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/adaptor/vm/server/ecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"github.com/golang/glog"
"google.golang.org/grpc/codes"

View File

@ -1,10 +1,10 @@
package server
import (
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"context"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/server"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"github.com/golang/glog"
"google.golang.org/grpc/codes"

View File

@ -1,7 +1,7 @@
package tenanter
import (
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"os"
"testing"
)

View File

@ -3,7 +3,7 @@ package tenanter
import (
"strings"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"github.com/pkg/errors"
)

View File

@ -3,7 +3,7 @@ package tenanter
import (
"testing"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
)
func TestGetAllRegionIds(t *testing.T) {

View File

@ -1,10 +1,10 @@
package tenanter
import (
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"encoding/json"
"flag"
"github.com/golang/glog"
"gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
"io/ioutil"
"os"
"sync"

View File

@ -1,8 +1,8 @@
package main
import (
pcm_pod_ali "code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/ali"
"github.com/alibabacloud-go/tea/tea"
pcm_pod_ali "gitlink.org.cn/JCCE/PCM/adaptor/pod/server/ali"
"os"
)

View File

@ -1,11 +1,11 @@
package main
import (
corev1 "code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/core/v1"
"code.gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/client-go/kubernetes"
"context"
"fmt"
"github.com/pkg/errors"
corev1 "gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/api/core/v1"
"gitlink.org.cn/JCCE/PCM/adaptor/pod/server/kubernetes/client-go/kubernetes"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/clientcmd"
@ -55,19 +55,19 @@ func CreatePod(client *kubernetes.Clientset) (*corev1.Pod, error) {
Kind: "Pod",
},
ObjectMeta: metav1.ObjectMeta{
Name: "hw-sdk-hwk8s",
Name: "hw-sdk-hwk8s01",
Namespace: "pcm",
Labels: map[string]string{"name": "test_api"},
},
Spec: corev1.PodSpec{
ProviderId: 3,
ProviderId: 0,
//ali:cn-hangzhou tc:ap-guangzhou hw: cn-east-3
RegionId: "ap-guangzhou",
RegionId: "cn-hangzhou",
RestartPolicy: corev1.RestartPolicyAlways,
Containers: []corev1.Container{
{
Name: "sdk-hwk8s-container",
Image: "library/nginx:stable-alpine-perl",
Name: "sdk-hwk8s01-container",
Image: "registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/alpine:3.5",
Resources: corev1.ResourceRequirements{
Limits: map[corev1.ResourceName]resource.Quantity{
corev1.ResourceCPU: resource.MustParse("1000m"),
@ -101,19 +101,23 @@ func UpdatePod(client *kubernetes.Clientset) error {
Kind: "Pod",
},
ObjectMeta: metav1.ObjectMeta{
Name: "hw-sdk-test",
Name: "hw-sdk-test002",
Namespace: "pcm",
UID: "eci-bp123wba1qv9xymntd24",
Labels: map[string]string{"name": "test_api222"},
},
Spec: corev1.PodSpec{
ProviderId: 0,
//ali:cn-hangzhou tc:ap-guangzhou hw: cn-east-3
RegionId: "cn-hangzhou",
RestartPolicy: corev1.RestartPolicyAlways,
Containers: []corev1.Container{
{
Name: "pcm-sdk-huawei-container2",
Name: "pcm-sdk-huawei-contai",
Image: "nginx:latest",
Resources: corev1.ResourceRequirements{
Limits: map[corev1.ResourceName]resource.Quantity{
corev1.ResourceCPU: resource.MustParse("500m"),
corev1.ResourceCPU: resource.MustParse("2000m"),
corev1.ResourceMemory: resource.MustParse("1Gi"),
},
},
@ -134,9 +138,15 @@ func DeletePod(client *kubernetes.Clientset) error {
// ListPod 查询Pod
func ListPod(client *kubernetes.Clientset) (*corev1.PodList, error) {
pod := corev1.Pod{
Spec: corev1.PodSpec{
ProviderId: 0,
//ali:cn-hangzhou tc:ap-guangzhou hw: cn-east-3
//RegionId: "ap-guangzhou",
},
}
podList, _ := client.CoreV1().Pods("pcm").List(context.TODO(), metav1.ListOptions{})
println(podList.Items[0].Name)
podList, _ := client.CoreV1().Pods("pcm").List(context.TODO(), &pod, metav1.ListOptions{})
return podList, nil
}
func main() {
@ -156,26 +166,26 @@ func main() {
}
cs, err := kubernetes.NewForConfig(cciConfig)
fmt.Println("start to create Pod")
_, err = CreatePod(cs)
if err != nil {
panic(err)
}
fmt.Println("Pod created")
//
//fmt.Println("start to create Pod")
//_, err = CreatePod(cs)
//if err != nil {
// panic(err)
//}
//fmt.Println("Pod created")
//fmt.Println("start to get Pod details")
//_, err = ListPod(cs)
//if err != nil {
// panic(err)
//}
//fmt.Println("Pod details got")
//
//fmt.Println("start to update Pod")
//err = UpdatePod(cs)
//if err != nil {
// panic(err)
//}
//fmt.Println("Pod updated")
fmt.Println("start to update Pod")
err = UpdatePod(cs)
if err != nil {
panic(err)
}
fmt.Println("Pod updated")
//
//fmt.Println("start to delete Pod")
//err = DeletePod(cs)

4
go.mod
View File

@ -1,4 +1,4 @@
module gitlink.org.cn/JCCE/PCM
module code.gitlink.org.cn/JCCE/PCM
go 1.17
@ -12,7 +12,6 @@ require (
github.com/bitly/go-simplejson v0.5.0
github.com/docker/docker v20.10.6+incompatible
github.com/go-yaml/yaml v2.1.0+incompatible
github.com/gogo/protobuf v1.3.2
github.com/golang/glog v1.0.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0
github.com/harvester/harvester v1.0.0
@ -58,6 +57,7 @@ require (
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package demo;
option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/gen/idl/demo";
option go_package = "code.gitlink.org.cn/JCCE/PCM/lan_trans/gen/idl/demo";
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package pbecs;
option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs";
option go_package = "code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs";
import "idl/pbtenant/tenant.proto";
import "google/api/annotations.proto";

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package pbpod;
option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod";
option go_package = "code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod";
import "idl/pbtenant/tenant.proto";
import "google/api/annotations.proto";

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package pbtenant;
option go_package = "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant";
option go_package = "code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant";
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
@ -173,7 +173,7 @@ service TenantService {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {
description : "所有云租户的认证服务"
external_docs : {
url : "https://gitlink.org.cn/JCCE/PCM"
url : "https://code.gitlink.org.cn/JCCE/PCM"
description: "Find out more about PCM"
}
};

View File

@ -7,7 +7,7 @@
package pbecs
import (
pbtenant "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
pbtenant "code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"

View File

@ -7,7 +7,7 @@
package pbpod
import (
pbtenant "gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
pbtenant "code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbtenant"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"

10
main.go
View File

@ -1,13 +1,13 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM/common/server"
"code.gitlink.org.cn/JCCE/PCM/common/tenanter"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/demo"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbecs"
"code.gitlink.org.cn/JCCE/PCM/lan_trans/idl/pbpod"
"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"