multitenant

package
v0.0.0-...-414c732 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasModel

type AliasModel struct {
	Alias   string `gorm:"primaryKey" json:"name"`
	Cluster string `gorm:"index:idx_cluster_alias_cluster" json:"cluster"`
}

func (AliasModel) TableName

func (AliasModel) TableName() string

type ClusterModel

type ClusterModel struct {
	Name           string       `gorm:"primaryKey" json:"name"`
	CreatedAt      time.Time    `gorm:"autoCreateTime" json:"create_at"`
	UpdatedAt      time.Time    `gorm:"autoUpdateTime" json:"update_at"`
	Provider       ProviderEnum `json:"provider"`
	Metadata       string       `json:"metadata"`
	Kubeconfig     string       `json:"kubeconfig"`
	Expire         int64        `json:"expired_time"`
	Infrastructure string       `json:"infrastructure"`
	Readable       bool         `json:"readable"`
	Writeable      bool         `json:"writeable"`
}

func (ClusterModel) TableName

func (ClusterModel) TableName() string

type ContainerModel

type ContainerModel struct {
	platform.BaseModel

	Pod           string              `gorm:"primaryKey" json:"pod"`
	Cluster       string              `gorm:"primaryKey" json:"cluster"`
	Namespace     string              `gorm:"primaryKey" json:"namespace"`
	Version       string              `json:"version"`
	Status        ContainerStatusEnum `json:"status"`
	RestartCount  int32               `json:"restart_count"`
	CpuUsage      int64               `json:"cpu_usage"`
	MemoryUsage   int64               `json:"memory_usage"`
	CpuLimit      int64               `gorm:"index:idx_cluster_container_cpu_limit" json:"cpu_limit"`
	MemoryLimit   int64               `gorm:"index:idx_cluster_container_memory_limit" json:"memory_limit"`
	CpuRequest    int64               `gorm:"index:idx_cluster_container_cpu_request" json:"cpu_request"`
	MemoryRequest int64               `gorm:"index:idx_cluster_container_memory_request" json:"memory_request"`
}

func (ContainerModel) TableName

func (ContainerModel) TableName() string

type ContainerStatusEnum

type ContainerStatusEnum int
const (
	UnknownContainerStatus ContainerStatusEnum = iota
	WaitingContainerStatus
	RunningContainerStatus
	TerminatedContainerStatus
)

type ContainerUsageModel

type ContainerUsageModel struct {
	platform.BaseModel

	Pod            string `gorm:"primaryKey" json:"pod"`
	Cluster        string `gorm:"primaryKey" json:"cluster"`
	Namespace      string `gorm:"primaryKey" json:"namespace"`
	Version        string `gorm:"primaryKey" json:"version"`
	CpuUsageMin    int64  `json:"cpu_usage_min"`
	CpuUsageMax    int64  `json:"cpu_usage_max"`
	MemoryUsageMin int64  `json:"memory_usage_min"`
	MemoryUsageMax int64  `json:"memory_usage_max"`
}

func (ContainerUsageModel) TableName

func (ContainerUsageModel) TableName() string

type DeploymentModel

type DeploymentModel struct {
	Name      string `gorm:"primaryKey" json:"name"`
	Cluster   string `gorm:"primaryKey,index:idx_cluster_deployment_cluster" json:"cluster"`
	Kind      string `gorm:"index:idx_cluster_deployment_kind" json:"kind"`
	Namespace string `json:"namespace"`
}

func (DeploymentModel) TableName

func (DeploymentModel) TableName() string

type DeploymentSelectorModel

type DeploymentSelectorModel struct {
	Label      string `gorm:"primaryKey,index:idx_cluster_deployment_selector_label" json:"label"`
	Cluster    string `gorm:"primaryKey,index:idx_cluster_deployment_selector_cluster" json:"cluster"`
	Deployment string `gorm:"primaryKey,index:idx_cluster_deployment_selector_deployment" json:"deployment"`
}

func (DeploymentSelectorModel) TableName

func (DeploymentSelectorModel) TableName() string

type Multitenant

type Multitenant interface {
	GetTenant(name string) (kubernetes.Tenant, error)
	GetAliases(tenant string) ([]string, error)
	GetChilds() ([]string, error)

	Update(tenant kubernetes.Tenant, quick ...bool) error
	Scan(tenant kubernetes.Tenant) error
	Delete(tenant kubernetes.Tenant) error
}

func NewMultitenant

func NewMultitenant(
	database, provider, cache string,
	timeout time.Duration,
) (Multitenant, error)

type PodCycleModel

type PodCycleModel struct {
	platform.BaseModel

	Restart   int32  `gorm:"primaryKey" json:"restart"`
	Cluster   string `gorm:"primaryKey" json:"cluster"`
	Namespace string `gorm:"primaryKey" json:"namespace"`
	Ip        string `json:"ip"`
}

func (PodCycleModel) TableName

func (PodCycleModel) TableName() string

type PodModel

type PodModel struct {
	platform.BaseModel

	Status    PodStatusEnum `gorm:"index:idx_cluster_pod_status" json:"status"`
	Cluster   string        `gorm:"primaryKey" json:"cluster"`
	Namespace string        `gorm:"primaryKey" json:"namespace"`
}

func (PodModel) TableName

func (PodModel) TableName() string

type PodStatusEnum

type PodStatusEnum int
const (
	UnknownPodStatus PodStatusEnum = iota
	DeadPodStatus
	CrashPodStatus
	ErrorPodStatus
	EvictedPodStatus
	RunningPodStatus
	PendingPodStatus
)

type ProviderEnum

type ProviderEnum string
const (
	BizflyProvider ProviderEnum = "bizfly"
	GcpProvider    ProviderEnum = "gcp"
)

func (ProviderEnum) ConvertMetadataToTenant

func (p ProviderEnum) ConvertMetadataToTenant(
	metadata string,
	database string,
	timeout time.Duration,
) (kubernetes.Tenant, error)

type VolumeModel

type VolumeModel struct {
	platform.BaseModel

	Cluster  string `gorm:"index:idx_cluster_volume_cluster" json:"cluster"`
	Usage    int64  `gorm:"index:idx_cluster_volume_usage" json:"usage"`
	Capacity int64  `json:"capacity"`
}

func (VolumeModel) TableName

func (VolumeModel) TableName() string

type VolumePodModel

type VolumePodModel struct {
	Pod     string `gorm:"index:idx_cluster_volume_pod_pod" json:"pod"`
	Volume  string `gorm:"index:idx_cluster_volume_pod_volume" json:"volume"`
	Cluster string `gorm:"index:idx_cluster_volume_pod_cluster" json:"cluster"`
}

func (VolumePodModel) TableName

func (VolumePodModel) TableName() string

type VolumeSnapshotModel

type VolumeSnapshotModel struct {
	platform.BaseModel

	Volume  string `gorm:"index:idx_volume_snapshot_volume" json:"volume"`
	Version int    `gorm:"index:idx_volume_snapshot_version" json:"version"`
}

func (VolumeSnapshotModel) TableName

func (VolumeSnapshotModel) TableName() string

Jump to

Keyboard shortcuts

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