Documentation ¶
Index ¶
- Constants
- func GetDiffPods(oldPodMap map[string]*Pod, newPodMap map[string]*Pod) (adds []*Pod, updates []*Pod, deletes []*Pod)
- func GetResTypeByClusterType(clusterType string) string
- type Annotations
- type Cluster
- type ContainerData
- type EventType
- type K8SContainer
- type K8SContainerPort
- type K8SContainerStatus
- type K8SPod
- type K8SPodSpec
- type K8SPodStatus
- type Labels
- type ListStorageResourceResult
- type MesosContainerPort
- type MesosContainerStatus
- type Pod
- type PodUpdateInfo
- type StorageEvent
- type StorageResource
Constants ¶
const ( // BCS_BKCMDB_SYNC_DIR zk path for synchronizer BCS_BKCMDB_SYNC_DIR = "/bcs/services/bkcmdb-synchronizer" // BCS_BKCMDB_SYNC_DIR_CLUSTER cluster dir for synchronizer BCS_BKCMDB_SYNC_DIR_CLUSTER = BCS_BKCMDB_SYNC_DIR + "/cluster" // BCS_BKCMDB_SYNC_DIR_WORKER synchronizer worker instance dir BCS_BKCMDB_SYNC_DIR_WORKER = BCS_BKCMDB_SYNC_DIR + "/worker" // BCS_BKCMDB_DEFAULT_SET_NAME bcs default set name in bk cmdb BCS_BKCMDB_DEFAULT_SET_NAME = "bkbcs" // BCS_BKCMDB_DEFAULT_MODLUE_NAME bcs default module name in bk cmdb BCS_BKCMDB_DEFAULT_MODLUE_NAME = "bkbcs" // BCS_BKCMDB_ANNOTATIONS_SET_KEY key of bcs annotations for bk cmdb BCS_BKCMDB_ANNOTATIONS_SET_KEY = "set.bkcmdb.bkbcs.tencent.com" // BCS_BKCMDB_ANNOTATIONS_MODULE_KEY key of bcs annotations for bk cmdb BCS_BKCMDB_ANNOTATIONS_MODULE_KEY = "module.bkcmdb.bkbcs.tencent.com" )
const ( // ClusterTypeK8S k8s type cluster ClusterTypeK8S = "k8s" // ClusterTypeMesos mesos type cluster ClusterTypeMesos = "mesos" // K8SNetworkTypeCni network type for k8s K8SNetworkTypeCni = "cni" // K8SNetworkModeCni network mode for k8s K8SNetworkModeCni = "cni" // K8SNetworkModeHost network mode for host K8SNetworkModeHost = "host" // MesosNetworkModeBridge bridge mode for mesos network MesosNetworkModeBridge = "bridge" // MesosNetworkModeHost host mode for mesos network MesosNetworkModeHost = "host" // MesosNetworkTypeCnm cnm network MesosNetworkTypeCnm = "cnm" // MesosNetworkTypeCni cni network MesosNetworkTypeCni = "cni" )
const ( ResourceTypeTaskgroup = "taskgroup" ResourceTypePod = "Pod" )
Variables ¶
This section is empty.
Functions ¶
func GetDiffPods ¶
func GetDiffPods(oldPodMap map[string]*Pod, newPodMap map[string]*Pod) (adds []*Pod, updates []*Pod, deletes []*Pod)
GetDiffPods get different pods between two pods maps
func GetResTypeByClusterType ¶
GetResTypeByClusterType get resource type by cluster type
Types ¶
type Cluster ¶
type Cluster struct { ProjectID string `json:"projectid"` ClusterID string `json:"clusterid"` BizID int64 `json:"bk_biz_id"` DefaultModuleID int64 `json:"bk_module_id"` }
Cluster struct for cluster
type ContainerData ¶
type ContainerData struct { Data []string `json:"containers"` Status []string `json:"containerStatuses"` }
ContainerData container data
type K8SContainer ¶
type K8SContainer struct { Name string `json:"name"` Image string `json:"image"` Ports []K8SContainerPort `json:"ports,omitempty"` Resources k8scorev1.ResourceRequirements `json:"resources,omitempty"` }
K8SContainer simplified data for k8s container
type K8SContainerPort ¶
type K8SContainerPort struct { Name string `json:"name"` HostPort int32 `json:"hostPort"` ContainerPort int32 `json:"containerPort"` Protocol string `json:"protocol"` HostIP string `json:"hostIP"` }
K8SContainerPort simplified for k8s container port
type K8SContainerStatus ¶
type K8SContainerStatus struct { Name string `json:"name"` Ready bool `json:"ready"` RestartCount int32 `json:"restartCount"` ContainerID string `json:"containerID"` }
K8SContainerStatus simplified data of container status
type K8SPod ¶
type K8SPod struct { ID string `json:"id"` k8smetav1.ObjectMeta `json:"metadata"` Spec K8SPodSpec `json:"spec"` Status K8SPodStatus `json:"status"` }
K8SPod k8s pod in storage
func (*K8SPod) GetCreationTimestamp ¶
GetCreationTimestamp get creation timestamp
func (*K8SPod) SetCreationTimestamp ¶
SetCreationTimestamp set creation timestamp
type K8SPodSpec ¶
type K8SPodSpec struct { Containers []K8SContainer `json:"containers,omitempty"` DNSPolicy k8scorev1.DNSPolicy `json:"dnsPolicy,omitempty"` NodeSelector map[string]string `json:"nodeSelector"` NodeName string `json:"nodeName"` HostNetwork bool `json:"hostNetwork"` Hostname string `json:"hostname"` }
K8SPodSpec simplified data of k8s pod spec
type K8SPodStatus ¶
type K8SPodStatus struct { Phase string `json:"phase"` Reason string `json:"reason"` HostIP string `json:"hostIP"` PodIP string `json:"podIP"` StartTime *k8smetav1.Time `json:"startTime"` ContainerStatuses []K8SContainerStatus `json:"containerStatuses"` }
K8SPodStatus simplified data of k8s pod status
type ListStorageResourceResult ¶
type ListStorageResourceResult struct { Code int64 `json:"code"` Data []*StorageResource `json:"data"` Message string `json:"message"` Result bool `json:"result"` }
ListStorageResourceResult result for list storage resource
type MesosContainerPort ¶
type MesosContainerPort struct { Name string `json:"name"` HostPort int `json:"hostPort"` ContainerPort int `json:"containerPort"` HostIP string `json:"hostIP"` Protocol string `json:"protocol"` }
MesosContainerPort simplied data of mesos container por
type MesosContainerStatus ¶
type MesosContainerStatus struct { Name string `json:"name"` ContainerID string `json:"containerID"` Status string `json:"status"` LastStatus string `json:"lastStatus"` Image string `json:"image"` Ports []MesosContainerPort `json:"containerPort"` }
MesosContainerStatus simplied data of mesos container stats
type Pod ¶
type Pod struct { BizID int64 `json:"bk_biz_id" mapstructure:"bk_biz_id"` ModuleID int64 `json:"bk_module_id" mapstructure:"bk_module_id"` CloudID int64 `json:"bk_cloud_id" mapstructure:"bk_cloud_id"` HostInnerIP string `json:"bk_host_innerip" mapstructure:"bk_host_innerip"` PodName string `json:"bk_pod_name" mapstructure:"bk_pod_name"` PodNamespace string `json:"bk_pod_namespace" mapstructure:"bk_pod_namespace"` PodCluster string `json:"bk_pod_cluster" mapstructure:"bk_pod_cluster"` PodClusterType string `json:"bk_pod_clustertype" mapstructure:"bk_pod_clustertype"` PodUUID string `json:"bk_pod_uuid" mapstructure:"bk_pod_uuid"` WorkloadType string `json:"bk_pod_workloadtype" mapstructure:"bk_pod_workloadtype"` WorkloadName string `json:"bk_pod_workloadname" mapstructure:"bk_pod_workloadname"` PodLabels string `json:"bk_pod_labels" mapstructure:"bk_pod_labels"` PodAnnotations string `json:"bk_pod_annotations" mapstructure:"bk_pod_annotations"` PodIP string `json:"bk_pod_ip" mapstructure:"bk_pod_ip"` PodNetworkMode string `json:"bk_pod_networkmode" mapstructure:"bk_pod_networkmode"` PodNetworkType string `json:"bk_pod_networktype" mapstructure:"bk_pod_networktype"` PodContainers string `json:"bk_pod_containers" mapstructure:"bk_pod_containers"` PodVolumes string `json:"bk_pod_volumes" mapstructure:"bk_pod_volumes"` PodStatus string `json:"bk_pod_status" mapstructure:"bk_pod_status"` PodCreateTime string `json:"bk_pod_create_time" mapstructure:"bk_pod_create_time"` PodStartTime string `json:"bk_pod_start_time" mapstructure:"bk_pod_start_time"` }
Pod struct for both mesos taskgroup and k8s pod
func ConvertK8SPod ¶
ConvertK8SPod convert k8s pod to bk cmdb pod
func ConvertMesosPod ¶
func ConvertMesosPod(mesosPod *commtypes.BcsPodStatus) (*Pod, error)
ConvertMesosPod convert mesos pod to bk cmdb pod
func (*Pod) GetUpdatedField ¶
GetUpdatedField get updated field
func (*Pod) MetadataString ¶
MetadataString string for metadata
func (*Pod) ToMapInterface ¶
ToMapInterface to format map[string]interface{}
type PodUpdateInfo ¶
PodUpdateInfo info to update a pod
type StorageEvent ¶
type StorageEvent struct { Type EventType `json:"type"` Value *StorageResource `json:"value"` }
StorageEvent event for storage
type StorageResource ¶
type StorageResource struct { ID string `json:"_id"` ClusterID string `json:"clusterId"` CreateTime string `json:"createTime"` UpdateTime string `json:"updateTime"` Data json.RawMessage `json:"data"` Namespace string `json:"namespace"` ResourceType string `json:"resourceType"` ResourceName string `json:"resourceName"` }
StorageResource storage resource