Documentation ¶
Index ¶
- Constants
- func ValidateVLANTags(vlanTags []int32) error
- type Container
- type ContainerDetailMetrics
- type ContainerMetrics
- type ContainerResourceMetrics
- type ContainerStatusMetrics
- type ControllerMetrics
- type FakeStorage
- type LoginCredential
- type NICMetrics
- type NICNetworkTrafficMetrics
- type NICOverviewMetrics
- type NICShortMetrics
- type Network
- type NetworkType
- type Node
- type NodeDetailMetrics
- type NodeMetrics
- type NodeNICsMetrics
- type NodeResourceMetrics
- type PhyInterface
- type Pod
- type PodMetrics
- type PodNetwork
- type PodRoute
- type PodVolume
- type RegistryBasicAuthCredential
- type Response
- type SamplePair
- type Service
- type ServiceMetrics
- type ServicePort
- type Storage
- type StorageType
- type User
- type Volume
Constants ¶
const ( // PodCollectionName is a const string PodCollectionName string = "pods" // PodHostNetwork is the network type for the Pod // host means the pod use the hostNetwork (share the network with the host machine) PodHostNetwork = "host" // PodClusterNetwork is cluster which means use the cluster Network, maybe the flannel network PodClusterNetwork = "cluster" // PodCustomNetwork is custom which means the custom netwokr we created before, it support the OVS and DPDK network for additional network interface card PodCustomNetwork = "custom" )
const ( NFSStorageType = "nfs" FakeStorageType = "fake" )
The const for storage type
const ( VolumeCollectionName string = "volume" PVCNamePrefix string = "pvc-" )
The const for volume & PVC
const (
NetworkCollectionName string = "networks"
)
The const for NetworkCollectionName
const (
ServiceCollectionName string = "services"
)
the const for ServiceCollectionName
const (
StorageCollectionName string = "storage"
)
The const for StorageCollectionName
const (
UserCollectionName string = "users"
)
UserCollectionName's const
Variables ¶
This section is empty.
Functions ¶
func ValidateVLANTags ¶
ValidateVLANTags will validate VLAN tags
Types ¶
type Container ¶
type Container struct { Name string `bson:"name" json:"name" validate:"required,k8sname"` Image string `bson:"image" json:"image" validate:"required"` Command []string `bson:"command" json:"command" validate:"required,dive,required"` }
Container is the structure for init Container info
type ContainerDetailMetrics ¶
type ContainerDetailMetrics struct { ContainerName string `json:"containerName"` CreatedAt int `json:"createAt"` Pod string `json:"pod"` Namespace string `json:"namespace"` Node string `json:"node"` Image string `json:"image"` Command []string `json:"command"` VNIC string `json:"vNic"` }
ContainerDetailMetrics is the sructure for Container Detail Metrics
type ContainerMetrics ¶
type ContainerMetrics struct { Detail ContainerDetailMetrics `json:"detail"` Status ContainerStatusMetrics `json:"status"` Resource ContainerResourceMetrics `json:"resource"` }
ContainerMetrics is the structure for Container Metrics
type ContainerResourceMetrics ¶
type ContainerResourceMetrics struct { CPUUsagePercentage []SamplePair `json:"cpuUsagePercentage"` MemoryUsageBytes []SamplePair `json:"memoryUsageBytes"` }
ContainerResourceMetrics is the sructure for Container Resource Metrics
type ContainerStatusMetrics ¶
type ContainerStatusMetrics struct { Status string `json:"status"` WaitingReason string `json:"waitingReason"` TerminatedReason string `json:"terminatedReason"` RestartTime int `json:"restartTime"` }
ContainerStatusMetrics is the sructure for Container Status Metrics
type ControllerMetrics ¶
type ControllerMetrics struct { ControllerName string `json:"controllerName"` Type string `json:"type"` Namespace string `json:"namespace"` Strategy string `json:"strategy"` CreateAt int `json:"createAt"` DesiredPod int `json:"desiredPod"` CurrentPod int `json:"currentPod"` AvailablePod int `json:"availablePod"` Labels map[string]string `json:"labels"` }
ControllerMetrics is the structure for Controller Metrics
type FakeStorage ¶
FakeStorage is the structure for Fake Storage
type LoginCredential ¶ added in v0.1.7
type LoginCredential struct { Email string `bson:"email" json:"email" validate:"required,email"` Password string `bson:"password" json:"password" validate:"required"` }
LoginCredential is the structure for a user login credential
type NICMetrics ¶
type NICMetrics struct { Default bool `json:"default"` DPDK bool `json:"dpdk"` Type string `json:"type"` IP string `json:"ip"` PCIID string `json:"pciID"` NICNetworkTraffic NICNetworkTrafficMetrics `json:"nicNetworkTraffic"` }
NICMetrics is the structure for NIC metrics
type NICNetworkTrafficMetrics ¶
type NICNetworkTrafficMetrics struct { ReceiveBytesTotal []SamplePair `json:"receiveBytesTotal"` TransmitBytesTotal []SamplePair `json:"transmitBytesTotal"` ReceivePacketsTotal []SamplePair `json:"receivePacketsTotal"` TransmitPacketsTotal []SamplePair `json:"transmitPacketsTotal"` }
NICNetworkTrafficMetrics is the structure for NIC metwork traffic metrics
type NICOverviewMetrics ¶
type NICOverviewMetrics struct { Name string `json:"name"` Default bool `json:"default"` DPDK bool `json:"dpdk"` Type string `json:"type"` PCIID string `json:"pciID"` }
NICOverviewMetrics is the structure for NIC overview metrics
type NICShortMetrics ¶
type NICShortMetrics struct {
NICNetworkTraffic NICNetworkTrafficMetrics `json:"nicNetworkTraffic"`
}
NICShortMetrics is the structure for NIC metrics
type Network ¶
type Network struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"` Type NetworkType `bson:"type" json:"type" validate:"required"` IsDPDKPort bool `bson:"isDPDKPort" json:"isDPDKPort" validate:"-"` Name string `bson:"name" json:"name" validate:"required"` VlanTags []int32 `bson:"vlanTags" json:"vlanTags" validate:"required,dive,max=4095,min=0"` BridgeName string `bson:"bridgeName" json:"bridgeName" validate:"-"` Nodes []Node `bson:"nodes" json:"nodes" validate:"required,dive,required"` CreatedAt *time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"` }
Network is the structure for Network info
func (Network) GetCollection ¶
GetCollection - get model mongo collection name.
type NetworkType ¶
type NetworkType string
NetworkType is the string for network type
const ( OVSKernelspaceNetworkType NetworkType = "system" OVSUserspaceNetworkType NetworkType = "netdev" FakeNetworkType NetworkType = "fake" )
These are const
type Node ¶
type Node struct { Name string `bson:"name" json:"name" validate:"required"` PhyInterfaces []PhyInterface `bson:"physicalInterfaces" json:"physicalInterfaces" validate:"required,dive,required"` }
Node is the structure for node info
type NodeDetailMetrics ¶
type NodeDetailMetrics struct { Hostname string `json:"hostname"` CreatedAt int `json:"createAt"` Status string `json:"status"` OS string `json:"os"` KernelVersion string `json:"kernelVersion"` KubeproxyVersion string `json:"kubeproxyVersion"` KubernetesVersion string `json:"kubernetesVersion"` Labels map[string]string `json:"labels"` }
NodeDetailMetrics is the structure for node detail metrics
type NodeMetrics ¶
type NodeMetrics struct { Detail NodeDetailMetrics `json:"detail"` Resource NodeResourceMetrics `json:"resource"` NICs map[string]NICMetrics `json:"nics"` }
NodeMetrics is the structure for node metrics
type NodeNICsMetrics ¶
type NodeNICsMetrics struct {
NICs []NICOverviewMetrics `json:"nics"`
}
NodeNICsMetrics is the structure for node NICs metrics
type NodeResourceMetrics ¶
type NodeResourceMetrics struct { CPURequests float32 `json:"cpuRequests"` CPULimits float32 `json:"cpuLimits"` MemoryRequests float32 `json:"memoryRequests"` MemoryLimits float32 `json:"memoryLimits"` AllocatableCPU float32 `json:"allocatableCPU"` AllocatableMemory float32 `json:"allocatableMemory"` AllocatablePods float32 `json:"allocatablePods"` CapacityCPU float32 `json:"capacityCPU"` CapacityMemory float32 `json:"capacityMemory"` CapacityPods float32 `json:"capacityPods"` }
NodeResourceMetrics is the structure for node resource metrics
type PhyInterface ¶
type PhyInterface struct { Name string `bson:"name" json:"name" validate:"required"` PCIID string `bson:"pciID" json:"pciID" validate:"-"` }
PhyInterface is the structure for physical interface
type Pod ¶
type Pod struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"` Name string `bson:"name" json:"name" validate:"required,k8sname"` Namespace string `bson:"namespace" json:"namespace" validate:"required"` Labels map[string]string `bson:"labels,omitempty" json:"labels" validate:"required,dive,keys,alphanum,endkeys,required,alphanum"` Containers []Container `bson:"containers" json:"containers" validate:"required,dive,required"` Volumes []PodVolume `bson:"volumes,omitempty" json:"volumes" validate:"required,dive,required"` Networks []PodNetwork `bson:"networks,omitempty" json:"networks" validate:"required,dive,required"` RestartPolicy string `bson:"restartPolicy" json:"restartPolicy" validate:"required,eq=Always|eq=OnFailure|eq=Never"` Capability bool `bson:"capability" json:"capability" validate:"-"` NetworkType string `bson:"networkType" json:"networkType" validate:"required,eq=host|eq=cluster|eq=custom"` NodeAffinity []string `bson:"nodeAffinity" json:"nodeAffinity" validate:"required"` CreatedAt *time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"` }
Pod is the structure for pod info
func (Pod) GetCollection ¶
GetCollection - get model mongo collection name.
type PodMetrics ¶
type PodMetrics struct { PodName string `json:"podName"` Namespace string `json:"namespace"` Node string `json:"node"` Status string `json:"status"` CreateAt int `json:"createAt"` CreateByKind string `json:"createByKind"` CreateByName string `json:"createByName"` IP string `json:"ip"` Labels map[string]string `json:"labels"` RestartCount int `json:"restartCount"` Containers []string `json:"containers"` NICs map[string]NICShortMetrics `json:"nics"` }
PodMetrics is the structure for Pod metrics
type PodNetwork ¶
type PodNetwork struct { Name string `bson:"name" json:"name" validate:"required"` IfName string `bson:"ifName" json:"ifName" validate:"required"` // can not validate nil VlanTag *int32 `bson:"vlanTag" json:"vlanTag" validate:"-"` IPAddress string `bson:"ipAddress" json:"ipAddress" validate:"required,ipv4"` Netmask string `bson:"netmask" json:"netmask" validate:"required,ipv4"` Routes []PodRoute `bson:"routes,omitempty" json:"routes" validate:"required,dive,required"` // It's from the entity.Network entity BridgeName string `bson:"bridgeName" json:"bridgeName" validate:"-"` }
PodNetwork is the structure for pod network info
type PodRoute ¶
type PodRoute struct { DstCIDR string `bson:"dstCIDR" json:"dstCIDR" validate:"required,cidrv4"` Gateway string `bson:"gateway" json:"gateway" validate:"omitempty,ipv4"` }
PodRoute is the structure for add IP routing table
type PodVolume ¶
type PodVolume struct { Name string `bson:"name" json:"name" validate:"required"` MountPath string `bson:"mountPath" json:"mountPath" validate:"required"` }
PodVolume is the structure for pod volume info
type RegistryBasicAuthCredential ¶ added in v0.1.9
type RegistryBasicAuthCredential struct { Username string `bson:"username" json:"username" validate:"required"` Password string `bson:"password" json:"password" validate:"required"` }
RegistryBasicAuthCredential is the structure for a user login credential
type Response ¶
type Response struct { Status string `json:"status"` Info interface{} `json:"info"` }
Response is the structure for Response
type SamplePair ¶ added in v0.1.7
type SamplePair struct { Timestamp model.Time `json:"timestamp"` Value model.SampleValue `json:"value"` }
SamplePair pairs a SampleValue with a Timestamp.
type Service ¶
type Service struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"` Name string `bson:"name" json:"name" validate:"required,k8sname"` Namespace string `bson:"namespace" json:"namespace" validate:"required"` Type string `bson:"type" json:"type" validate:"oneof=ClusterIP NodePort"` Selector map[string]string `bson:"selector" json:"selector" validate:"required"` Ports []ServicePort `bson:"ports" json:"ports" validate:"required"` CreatedAt *time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"` }
Service is the structure for service
func (Service) GetCollection ¶
GetCollection - get model mongo collection name.
type ServiceMetrics ¶
type ServiceMetrics struct { ServiceName string `json:"serviceName"` Namespace string `json:"namespace"` Type string `json:"type"` CreateAt int `json:"createAt"` ClusterIP string `json:"clusterIP"` Ports []v1.ServicePort `json:"ports"` Labels map[string]string `json:"labels"` }
ServiceMetrics is the structure for Service Metrics
type ServicePort ¶
type ServicePort struct { Name string `bson:"name" json:"name" validate:"required,k8sname"` Port int32 `bson:"port" json:"port" validate:"required"` TargetPort int `bson:"targetPort" json:"targetPort" validate:"required,max=65535,min=1"` NodePort int32 `bson:"nodePort" json:"nodePort" validate:"max=32767,min=30000"` }
ServicePort is the structure for service port
type Storage ¶
type Storage struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"` Type StorageType `bson:"type" json:"type" validate:"required"` Name string `bson:"name" json:"name" validate:"required"` StorageClassName string `bson:"storageClassName" json:"storageClassName" validate:"-"` IP string `bson:"ip" json:"ip" validate:"required,ipv4"` PATH string `bson:"path" json:"path" validate:"required"` Fake *FakeStorage `bson:"fake,omitempty" json:"fake,omitempty" validate:"-"` //FakeStorage, for restful testing. CreatedAt *time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"` }
Storage is the Storage info
func (Storage) GetCollection ¶
GetCollection - get model mongo collection name.
type User ¶
type User struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"` UUID string `bson:"uuid" json:"uuid" validate:"required,uuid4"` JWT string `bson:"jwt" json:"jwt" validate:"-"` LoginCredential LoginCredential `bson:"loginCredential" json:"loginCredential" validate:"required"` Username string `bson:"username" json:"username" validate:"required"` Role string `bson:"role" json:"role" validate:"required,eq=root|eq=user|eq=guest"` FirstName string `bson:"firstname" json:"firstName" validate:"required"` LastName string `bson:"lastName" json:"lastName" validate:"required"` PhoneNumber string `bson:"phoneNumber" json:"phoneNumber" validate:"required,numeric"` CreatedAt *time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"` }
User is the structure for user info
func (User) GetCollection ¶
GetCollection - get model mongo collection name.
type Volume ¶
type Volume struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"` Name string `bson:"name" json:"name" validate:"required"` StorageName string `bson:"storageName" json:"storageName" validate:"required"` AccessMode corev1.PersistentVolumeAccessMode `bson:"accessMode" json:"accessMode" validate:"required"` Capacity string `bson:"capacity" json:"capacity" validate:"required"` CreatedAt *time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"` }
Volume is the structure. Users will create the Volume from the storage and they can use those volumes in their containers. In the kubernetes implementation, it's PVC So the Volume will create a PVC type and connect to a known StorageClass
func (Volume) GetCollection ¶
GetCollection - get model mongo collection name.