entity

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeploymentCollectionName is a const string
	DeploymentCollectionName string = "deployments"
	// DeploymentHostNetwork is the network type for the Deployment
	// host means the deployment use the hostNetwork (share the network with the host machine)
	DeploymentHostNetwork = "host"
	// DeploymentClusterNetwork is cluster which means use the cluster Network, maybe the flannel network
	DeploymentClusterNetwork = "cluster"
	// DeploymentCustomNetwork is custom which means the custom netwokr we created before, it support the OVS and DPDK network for additional network interface card
	DeploymentCustomNetwork = "custom"
)
View Source
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"
)
View Source
const (
	NFSStorageType  = "nfs"
	FakeStorageType = "fake"
)

The const for storage type

View Source
const (
	UserCollectionName string = "users"
	// access control role
	RootRole string = "root"
	UserRole string = "user"
	// view only
	GuestRole string = "guest"
)

UserCollectionName's const

View Source
const (
	VolumeCollectionName string = "volumes"
	PVCNamePrefix        string = "pvc-"
)

The const for volume & PVC

View Source
const (
	ConfigMapCollectionName string = "configmaps"
)

the const for ConfigMapCollectionName

View Source
const (
	NamespaceCollectionName string = "namespaces"
)

the const for NamespaceCollectionName

View Source
const (
	NetworkCollectionName string = "networks"
)

The const for NetworkCollectionName

View Source
const (
	ServiceCollectionName string = "services"
)

the const for ServiceCollectionName

View Source
const (
	StorageCollectionName string = "storage"
)

The const for StorageCollectionName

Variables

This section is empty.

Functions

This section is empty.

Types

type Application added in v0.1.17

type Application struct {
	Deployment Deployment `bson:"deployment" json:"deployment" validate:"required"`
	Service    Service    `bson:"service" json:"service" validate:"required"`
}

Deployment is the structure for deployment info

type AutoscalerInfo added in v0.2.9

type AutoscalerInfo struct {
	Name      string `bson:"name" json:"name" validate:"required,k8sname"`
	Namespace string `bson:"namespace" json:"namespace" validate:"required"`
	// ScaleTargetRef is deployment name
	ScaleTargetRefName          string              `bson:"scaleTargetRefName" json:"scaleTargetRefName" validate:"required,k8sname"`
	IsCapableAutoscaleResources [2]string           `bson:"isCapableAutoscaleResources" json:"isCapableAutoscaleResources" validate:"-"`
	ResourceName                corev1.ResourceName `bson:"resourceName" json:"resourceName" validate:"required,eq=cpu|eq=memory"`
	MinReplicas                 int32               `bson:"minReplicas" json:"minReplicas" validate:"required,numeric"`
	MaxReplicas                 int32               `bson:"maxReplicas" json:"maxReplicas" validate:"required,numeric"`
	TargetAverageUtilization    int32               `bson:"targetAverageUtilization" json:"targetAverageUtilization" validate:"required,numeric"`
}

AutoscalerInfo is the structure for deploying a autoscaler with a deployment

type ConfigMap added in v0.2.9

type ConfigMap struct {
	ID        bson.ObjectId     `bson:"_id,omitempty" json:"id" validate:"-"`
	OwnerID   bson.ObjectId     `bson:"ownerID,omitempty" json:"ownerID" validate:"-"`
	Name      string            `bson:"name" json:"name" validate:"required,k8sname"`
	Namespace string            `bson:"namespace" json:"namespace" validate:"required"`
	Data      map[string]string `bson:"data,omitempty" json:"data,omitempty" validate:"-"`
	CreatedAt *time.Time        `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"`
	CreatedBy User              `json:"createdBy" validate:"-"`
}

ConfigMap is the structure for namespace info

func (ConfigMap) GetCollection added in v0.2.9

func (m ConfigMap) GetCollection() string

GetCollection - get model mongo collection name.

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"`
	ResourceRequestCPU    int      `bson:"resourceRequestCPU" json:"resourceRequestCPU" validate:"-"`
	ResourceRequestMemory int      `bson:"resourceRequestMemory" json:"resourceRequestMemory" validate:"-"`
}

Container is the structure for init Container info

type ContainerDetailMetrics

type ContainerDetailMetrics struct {
	ContainerName string   `json:"containerName"`
	CreatedAt     int      `json:"createAt"`
	Status        string   `json:"status"`
	RestartCount  int      `json:"restartCount"`
	Pod           string   `json:"pod"`
	Namespace     string   `json:"namespace"`
	Node          string   `json:"node"`
	Image         string   `json:"image"`
	Command       []string `json:"command"`
}

ContainerDetailMetrics is the structure for Container Detail Metrics

type ContainerMetrics

type ContainerMetrics struct {
	Detail   ContainerDetailMetrics   `json:"detail"`
	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 structure for Container Resource 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"`
	Pods           []string          `json:"pods"`
	Labels         map[string]string `json:"labels"`
}

ControllerMetrics is the structure for Controller Metrics

type Deployment added in v0.1.16

type Deployment struct {
	ID                bson.ObjectId       `bson:"_id,omitempty" json:"id" validate:"-"`
	OwnerID           bson.ObjectId       `bson:"ownerID,omitempty" json:"ownerID" 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,printascii,endkeys,required,printascii"`
	EnvVars           map[string]string   `bson:"envVars,omitempty" json:"envVars" validate:"required,dive,keys,printascii,endkeys,required,printascii"`
	Containers        []Container         `bson:"containers" json:"containers" validate:"required,dive,required"`
	Volumes           []DeploymentVolume  `bson:"volumes,omitempty" json:"volumes" validate:"required,dive,required"`
	ConfigMaps        []DeploymentConfig  `bson:"configMaps,omitempty" json:"configMaps" validate:"required,dive,required"`
	Networks          []DeploymentNetwork `bson:"networks,omitempty" json:"networks" validate:"required,dive,required"`
	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"`
	IsEnableAutoscale bool                `bson:"isEnableAutoscale" json:"isEnableAutoscale" validate:"-"`
	AutoscalerInfo    AutoscalerInfo      `bson:"autoscalerInfo" json:"autoscalerInfo" validate:"-"`
	CreatedBy         User                `json:"createdBy" validate:"-"`
	CreatedAt         *time.Time          `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"`

	Replicas int32 `bson:"replicas" json:"replicas" validate:"required"`
}

Deployment is the structure for deployment info

func (Deployment) GetCollection added in v0.1.16

func (m Deployment) GetCollection() string

GetCollection - get model mongo collection name.

type DeploymentConfig added in v0.2.9

type DeploymentConfig struct {
	Name      string `bson:"name" json:"name" validate:"required,k8sname"`
	MountPath string `bson:"mountPath" json:"mountPath" validate:"required"`
}

DeploymentConfig is the structure for configMap volume info

type DeploymentNetwork added in v0.1.16

type DeploymentNetwork 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"`
	RoutesGw   []DeploymentRouteGw   `bson:"routesGw,omitempty" json:"routesGw" validate:"required,dive,required"`
	RoutesIntf []DeploymentRouteIntf `bson:"routesIntf,omitempty" json:"routesIntf" validate:"required,dive,required"`

	// It's from the entity.Network entity
	BridgeName string `bson:"bridgeName" json:"bridgeName" validate:"-"`
}

DeploymentNetwork is the structure for deployment network info

type DeploymentRouteGw added in v0.1.16

type DeploymentRouteGw struct {
	DstCIDR string `bson:"dstCIDR" json:"dstCIDR" validate:"required,cidrv4"`
	Gateway string `bson:"gateway" json:"gateway" validate:"required,ipv4"`
}

DeploymentRouteGw is the structure for add IP routing table

type DeploymentRouteIntf added in v0.1.16

type DeploymentRouteIntf struct {
	DstCIDR string `bson:"dstCIDR" json:"dstCIDR" validate:"required,cidrv4"`
}

DeploymentRouteIntf is the structure for add IP routing table via interface

type DeploymentVolume added in v0.1.16

type DeploymentVolume struct {
	Name      string `bson:"name" json:"name" validate:"required,k8sname"`
	MountPath string `bson:"mountPath" json:"mountPath" validate:"required"`
}

DeploymentVolume is the structure for deployment volume info

type FakeStorage

type FakeStorage struct {
	FakeParameter string
	IWantFail     bool
}

FakeStorage is the structure for Fake Storage

type LoginCredential added in v0.1.7

type LoginCredential struct {
	Username string `bson:"username" json:"username" 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 Namespace added in v0.1.13

type Namespace struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"`
	OwnerID   bson.ObjectId `bson:"ownerID,omitempty" json:"ownerID" validate:"-"`
	Name      string        `bson:"name" json:"name" validate:"required,k8sname"`
	CreatedAt *time.Time    `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"`
	CreatedBy User          `json:"createdBy" validate:"-"`
}

Namespace is the structure for namespace info

func (Namespace) GetCollection added in v0.1.13

func (m Namespace) GetCollection() string

GetCollection - get model mongo collection name.

type Network

type Network struct {
	ID         bson.ObjectId `bson:"_id,omitempty" json:"id" validate:"-"`
	OwnerID    bson.ObjectId `bson:"ownerID,omitempty" json:"ownerID" 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"`
	CreatedBy  User          `json:"createdBy" validate:"-"`
	CreatedAt  *time.Time    `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"`
}

Network is the structure for Network info

func (Network) GetCollection

func (m Network) GetCollection() string

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"`
	DockerVersion     string            `json:"dockerVersion"`
	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"`
	MemoryTotalHugepages float32 `json:"memoryTotalHugepages"`
	MemoryFreeHugepages  float32 `json:"memoryFreeHugepages"`
	MemoryHugepageSize   float32 `json:"memoryHugepagesSize"`
	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 OVSPortInfo added in v0.2.3

type OVSPortInfo struct {
	PortID        int32        `json:"portID"`
	Name          string       `json:"name"`
	PodName       string       `json:"podName"`
	InterfaceName string       `json:"interfaceName"`
	MacAddress    string       `json:"macAddress"`
	Received      OVSPortStats `json:"received"`
	Transmitted   OVSPortStats `json:"traansmitted"`
}

type OVSPortStats added in v0.2.3

type OVSPortStats struct {
	Packets uint64 `json:"packets"`
	Bytes   uint64 `json:"bytes"`
	Dropped uint64 `json:"dropped"`
	Errors  uint64 `json:"errors"`
}

PortStatsTransmit contains information regarding the number of transmitted packets, bytes, etc.

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:"-"`
	OwnerID       bson.ObjectId     `bson:"ownerID,omitempty" json:"ownerID" 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,printascii,endkeys,required,printascii"`
	EnvVars       map[string]string `bson:"envVars,omitempty" json:"envVars" validate:"required,dive,keys,printascii,endkeys,required,printascii"`
	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"`
	HostNetwork   bool              `bson:"hostNetwork" json:"hostNetwork" validate:"-"`
	CreatedBy     User              `json:"createdBy" validate:"-"`
	CreatedAt     *time.Time        `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"`
}

Pod is the structure for pod info

func (Pod) GetCollection

func (m Pod) GetCollection() string

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"`
	Phase        string                     `json:"phase"`
	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"`
	RoutesGw   []PodRouteGw   `bson:"routesGw,omitempty" json:"routesGw" validate:"required,dive,required"`
	RoutesIntf []PodRouteIntf `bson:"routesIntf,omitempty" json:"routesIntf" 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 PodRouteGw added in v0.1.16

type PodRouteGw struct {
	DstCIDR string `bson:"dstCIDR" json:"dstCIDR" validate:"required,cidrv4"`
	Gateway string `bson:"gateway" json:"gateway" validate:"required,ipv4"`
}

PodRouteGw is the structure for add IP routing table with gateway

type PodRouteIntf added in v0.1.16

type PodRouteIntf struct {
	DstCIDR string `bson:"dstCIDR" json:"dstCIDR" validate:"required,cidrv4"`
}

PodRouteIntf is the structure for add IP routing table via interface

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:"-"`
	OwnerID   bson.ObjectId     `bson:"ownerID,omitempty" json:"ownerID" 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"`
	CreatedBy User              `json:"createdBy" validate:"-"`
	CreatedAt *time.Time        `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"`
}

Service is the structure for service

func (Service) GetCollection

func (m Service) GetCollection() string

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:"-"`
	OwnerID          bson.ObjectId `bson:"ownerID,omitempty" json:"ownerID" 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.
	CreatedBy        User          `json:"createdBy" validate:"-"`
	CreatedAt        *time.Time    `bson:"createdAt,omitempty" json:"createdAt,omitempty" validate:"-"`
}

Storage is the Storage info

func (Storage) GetCollection

func (m Storage) GetCollection() string

GetCollection - get model mongo collection name.

type StorageType

type StorageType string

StorageType is string

type User

type User struct {
	ID              bson.ObjectId   `bson:"_id,omitempty" json:"id" validate:"-"`
	LoginCredential LoginCredential `bson:"loginCredential" json:"loginCredential" validate:"required"`
	DisplayName     string          `bson:"displayName" json:"displayName" 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

func (u User) GetCollection() string

GetCollection - get model mongo collection name.

type Volume

type Volume struct {
	ID          bson.ObjectId                     `bson:"_id,omitempty" json:"id" validate:"-"`
	OwnerID     bson.ObjectId                     `bson:"ownerID,omitempty" json:"ownerID" validate:"-"`
	Name        string                            `bson:"name" json:"name" validate:"required"`
	Namespace   string                            `bson:"namespace" json:"namespace" 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"`
	CreatedBy   User                              `json:"createdBy" validate:"-"`
	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

func (m Volume) GetCollection() string

GetCollection - get model mongo collection name.

func (Volume) GetPVCName

func (m Volume) GetPVCName() string

GetPVCName will get pvc name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL