v1

package
v0.0.1-dev-fe9d83c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Tokens = "tokens"
	Logout = "logout"
)
View Source
const (
	Summary = "summary"
	Metrics = "metrics"
)
View Source
const (
	Nodes             = "nodes"
	DataCenterHelpUrl = "https://www.bigstack.co/contact-us"
)
View Source
const (
	RoleControl          = "control"
	RoleCompute          = "compute"
	RoleStorage          = "storage"
	RoleControlConverged = "control-converged"
	RoleModerator        = "moderator"
	RoleEdgeCore         = "edge-core"
)
View Source
const (
	ISO8601  = "2006-01-02T15:04:05"
	ISO8601Z = "2006-01-02T15:04:05+00:00"
	RFC3339  = time.RFC3339
	RFC3339Z = "2006-01-02T15:04:05Z07:00"
)
View Source
const (
	Tunings         = "tunings"
	TuningRecordTTL = 3600
)
View Source
const (
	ApiDoc = "api-doc"
)
View Source
const (
	DataCenters = "datacenters"
)
View Source
const (
	Events = "events"
)
View Source
const (
	Grafana = "grafana"
)
View Source
const (
	Healths = "healths"
)
View Source
const (
	Integrations = "integrations"
)
View Source
const (
	Licenses = "licenses"
)
View Source
const (
	Me = "me"
)
View Source
const (
	NetMajorInterface = "eth0"
)
View Source
const (
	RadosGatewayPort = 8888
)
View Source
const (
	RegionAuto = "auto"
)
View Source
const (
	Services = "services"
)
View Source
const (
	Settings = "settings"
)
View Source
const (
	Triggers = "triggers"
)

Variables

View Source
var (
	DefaultKeycloakRealm       = "master"
	DefaultIdpSamlMetadataPath = fmt.Sprintf("/auth/realms/%s/protocol/saml/descriptor", DefaultKeycloakRealm)
	DefaultSpSamlMetadataPath  = "/saml/metadata"
	DefaultApiServerKey        = "/var/www/certs/server.key"
	DefaultApiServerCert       = "/var/www/certs/server.cert"
	DefaultIdentifierFormat    = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"

	DefaultOidcClientId     = "token-connect"
	DefaultOidcClientSecret = ""
	DefaultOidcClientOpts   = gocloak.Client{
		ClientID:                  gocloak.StringP(DefaultOidcClientId),
		Protocol:                  gocloak.StringP("openid-connect"),
		PublicClient:              gocloak.BoolP(false),
		ClientAuthenticatorType:   gocloak.StringP("client-secret"),
		StandardFlowEnabled:       gocloak.BoolP(true),
		DirectAccessGrantsEnabled: gocloak.BoolP(true),
		Attributes: &map[string]string{
			"access.token.lifespan": "7200",
		},
	}

	DefaultNodeToken  = ""
	LogoutRedirectUrl = ""
)
View Source
var (
	HostID                   string
	Hostname                 string
	DataCenterName           string
	DataCenterVersion        string
	DataCenterNumericVersion string
	DataCenterVip            string
	ListenIp                 string
	ListenAddr               string
	ListenPort               int
	AdvertiseIp              string
	AdvertiseAddr            string
	AdvertisePort            int
	MgmtNet                  string
	MgmtIP                   string
	IsHaEnabled              bool
	IsGpuEnabled             bool
)
View Source
var (
	CurrentRole string
	Roles       = []string{RoleControl, RoleCompute, RoleStorage, RoleControlConverged, RoleModerator, RoleEdgeCore}

	ControlRole          = newControlRole()
	ComputeRole          = newComputeRole()
	StorageRole          = newStorageRole()
	ControlConvergedRole = newControlConvergeRole()
	ModeratorRole        = newModeratorRole()
	EdgeCoreRole         = newEdgeCoreRole()

	AllRoles = []*Role{
		ControlRole,
		ComputeRole,
		StorageRole,
		ControlConvergedRole,
		ModeratorRole,
		EdgeCoreRole,
	}

	AllGeneralRoles = []*Role{
		ControlRole,
		ComputeRole,
		StorageRole,
		ControlConvergedRole,
	}

	ControlRoles = []*Role{
		ControlRole,
		ControlConvergedRole,
	}

	ComputeRoles = []*Role{
		ComputeRole,
		ControlConvergedRole,
		EdgeCoreRole,
	}
)
View Source
var (
	Day                  = 24 * time.Hour
	LocalTimeZone        = "+00:00"
	LocalTimeZoneSeconds = 0
	LocalTimeFixedZone   = time.FixedZone("", LocalTimeZoneSeconds)
)
View Source
var (
	CreateRecordIfNotExist = options.Update().SetUpsert(true)
)
View Source
var (
	SerialNumber = ""
)
View Source
var (
	V1ApiDocUrl = ""
)

Functions

func CapturePanic

func CapturePanic()

func CheckTuningSpec

func CheckTuningSpec(tuning Tuning) error

func GenNodeToken

func GenNodeToken(hostname, advertiseAddr string) string

func GenerateNodeHashByMacAddr

func GenerateNodeHashByMacAddr() (string, error)

func GetEmailRecipients

func GetEmailRecipients() ([]email.Recipient, error)

func GetEmailSenders

func GetEmailSenders() ([]email.Sender, error)

func GetLicenseSearcher

func GetLicenseSearcher() bleve.Index

func GetLocalTunings

func GetLocalTunings() *sync.Map

func GetMacAddr

func GetMacAddr(interfaceName string) (string, error)

func GetNodeSearcher

func GetNodeSearcher() bleve.Index

func GetRadosGatewayUrl

func GetRadosGatewayUrl() string

func GetSlackChannels

func GetSlackChannels() ([]slack.Channel, error)

func GetSystemSerial

func GetSystemSerial() (string, error)

func GetTuningSearcher

func GetTuningSearcher() bleve.Index

func GetTuningSpecs

func GetTuningSpecs() *sync.Map

func HealthDB

func HealthDB() string

func HostnameNodeMap

func HostnameNodeMap() (map[string]Node, error)

func InitLicenseSearchIndex

func InitLicenseSearchIndex() error

func InitNodeSearchIndex

func InitNodeSearchIndex() error

func InitTuningSearchIndex

func InitTuningSearchIndex() error

func IsLocalNode

func IsLocalNode(hostname string) bool

func IsPageRequired

func IsPageRequired(pageNum, pageSize string) bool

func RepairCollection

func RepairCollection() string

func SetLocalTuning

func SetLocalTuning(tuning Tuning)

func SetTuningSpec

func SetTuningSpec(name string, spec *TuningSpec)

func SettingsDB

func SettingsDB() string

func SeverityFullName

func SeverityFullName(severity string) string

func SeverityShortName

func SeverityShortName(severity string) string

func ShouldIHandleTheTuning

func ShouldIHandleTheTuning(name string) bool

func SyncRoleNodes

func SyncRoleNodes()

func TimPastRFC3339

func TimPastRFC3339(duration time.Duration) string

func TimeISO8601Z

func TimeISO8601Z(t time.Time) string

func TimeLocal

func TimeLocal() string

func TimeLocalISO8601

func TimeLocalISO8601(t time.Time) string

func TimeLocalRFC3339

func TimeLocalRFC3339(t time.Time) string

func TimeNowRFC3339

func TimeNowRFC3339() string

func TimeNowRFC3339Z

func TimeNowRFC3339Z() string

func TimePastRFC3339Z

func TimePastRFC3339Z(duration time.Duration) string

func TimeRFC3339

func TimeRFC3339(duration time.Duration) string

func TimeRFC3339Z

func TimeRFC3339Z(t time.Time) string

func TimeUTC

func TimeUTC(t time.Time) string

func TitlePrefixCollection

func TitlePrefixCollection() string

func TuningCollection

func TuningCollection(name string) string

func TuningDB

func TuningDB() string

func TuningReqCollection

func TuningReqCollection() string

Types

type Additional

type Additional struct {
	HelpUrl     string `json:"helpUrl,omitempty" bson:"helpUrl"`
	V1ApiDocUrl string `json:"v1ApiDoc,omitempty" bson:"v1ApiDoc"`
}

type BlockDevice

type BlockDevice struct {
	Name    string  `json:"device" yaml:"device" bson:"device"`
	Type    string  `json:"type" yaml:"type" bson:"type"`
	SizeMiB float64 `json:"sizeMiB" yaml:"sizeMiB" bson:"sizeMiB"`
	Status  string  `json:"status" yaml:"status" bson:"status"`
}

type ComputeStatistic

type ComputeStatistic struct {
	TotalCores  float64 `json:"totalCores"`
	UsedCores   float64 `json:"usedCores"`
	UsedPercent float64 `json:"usedPercent"`
	FreeCores   float64 `json:"freeCores"`
	FreePercent float64 `json:"freePercent"`
}

type Dashboard

type Dashboard struct {
	Link    string `json:"link"`
	Enabled bool   `json:"enabled"`
}

type DataCenter

type DataCenter struct {
	Id          string `json:"id,omitempty" bson:"id"`
	Name        string `json:"name" bson:"name"`
	Version     string `json:"version" bson:"version"`
	VirtualIp   string `json:"virtualIp" bson:"virtualIp"`
	IsLocal     bool   `json:"isLocal" bson:"isLocal"`
	IsHaEnabled bool   `json:"isHaEnabled" bson:"isHaEnabled"`
	UtcTimeZone string `json:"utcTimeZone,omitempty" bson:"utcTimeZone"`
	Additional  `json:"additional,omitempty" bson:"additional"`
}

func (*DataCenter) SetDetailsByInitedInfo

func (d *DataCenter) SetDetailsByInitedInfo()

M1 TODO: have to think about if we 1). need to add the Id of datacenter 2). if (1) is true, then what's factor to generate the Id

type DataCenterUsage

type DataCenterUsage struct {
	Cpu    ComputeStatistic `json:"cpu"`
	Memory SpaceStatistic   `json:"memory"`
}

type Event

type Event struct {
	Type        string         `json:"type"`
	Severity    string         `json:"severity"`
	Id          string         `json:"id"`
	Description string         `json:"description"`
	Host        string         `json:"host"`
	Category    string         `json:"category"`
	Service     string         `json:"service"`
	Metadata    map[string]any `json:"metadata"`
	Time        string         `json:"time"`
}

type EventFilter

type EventFilter struct {
	System   SystemFilter   `json:"system"`
	Instance InstanceFilter `json:"instance"`
	Host     HostFilter     `json:"host"`
}

type EventStat

type EventStat struct {
	Id      string  `json:"id"`
	Percent float64 `json:"percent"`
	Number  int64   `json:"number"`
	Query   string  `json:"query"`
}

type Expiry

type Expiry struct {
	Date string `json:"date" yaml:"date" bson:"date"`
	Days int    `json:"days" yaml:"days" bson:"days"`
}

type Health

type Health struct {
	Category string         `json:"category"`
	Service  string         `json:"service"`
	Status   status.Details `json:"status,omitempty" yaml:"status,omitempty" bson:"status,omitempty"`
	Modules  []Module       `json:"modules"`
}

type Host

type Host struct {
	Role string `json:"role,omitzero"`
	Name string `json:"name"`
	Ip   string `json:"ip,omitzero"`
}

func (*Host) GetNode

func (h *Host) GetNode() *Node

type HostFilter

type HostFilter struct {
	Names      []string `json:"names"`
	Categories []string `json:"categories"`
}

type HostNetworkPacket

type HostNetworkPacket struct {
	Id      string             `json:"id"`
	Name    string             `json:"name"`
	Packets float64            `json:"packets"`
	History []TimePacketsPoint `json:"history"`
}

type HostPercentageUsage

type HostPercentageUsage struct {
	Id          string            `json:"id"`
	Name        string            `json:"name"`
	UsedPercent float64           `json:"usedPercent"`
	History     []TimeUsedPercent `json:"history"`
}

type HostUsage

type HostUsage struct {
	Cpu    ComputeStatistic `json:"cpu"`
	Memory SpaceStatistic   `json:"memory"`
}

type InstanceFilter

type InstanceFilter struct {
	Ids        []string `json:"ids"`
	Categories []string `json:"categories"`
}

type Integration

type Integration struct {
	Name                    string `json:"name"`
	IsHeaderShortcutEnabled bool   `json:"isHeaderShortcutEnabled"`
	Description             string `json:"description"`
	IsBuiltIn               bool   `json:"isBuiltIn"`
	Url                     string `json:"url"`
}

type Issue

type Issue struct {
	By       string `json:"by" yaml:"by" bson:"by"`
	To       string `json:"to" yaml:"to" bson:"to"`
	Hardware string `json:"hardware" yaml:"hardware" bson:"hardware"`
	Date     string `json:"date" yaml:"date" bson:"date"`
}

type Label

type Label struct {
	Key   string `json:"key" yaml:"key"`
	Value string `json:"value" yaml:"value"`
}

type License

type License struct {
	Type                  string   `json:"type" yaml:"type" bson:"type"`
	Hostname              string   `json:"hostname,omitzero" yaml:"hostname" bson:"hostname"`
	Hosts                 []string `json:"hosts,omitempty" yaml:"hosts" bson:"hosts"`
	Serial                string   `json:"serial" yaml:"serial" bson:"serial"`
	Product               `json:"product" yaml:"product" bson:"product"`
	Issue                 `json:"issue" yaml:"issue" bson:"issue"`
	Quantity              `json:"quantity" yaml:"quantity" bson:"quantity"`
	ServiceLevelAgreement `json:"serviceLevelAgreement" yaml:"sla" bson:"serviceLevelAgreement"`
	Expiry                `json:"expiry" yaml:"expiry" bson:"expiry"`
	Status                status.License `json:"status" yaml:"status" bson:"status"`
}

func (*License) Key

func (l *License) Key() string

type Limit

type Limit struct {
	Number      int    `json:"number"`
	Description string `json:"description"`
}

type ListTuningOptions

type ListTuningOptions struct {
	AllNodes bool
}

type MetricRank

type MetricRank struct {
	Unit string      `json:"unit"`
	Rank []RankPoint `json:"rank"`
}

type Module

type Module struct {
	Name         string          `json:"name" bson:"name"`
	Status       *status.Details `json:"status,omitempty" bson:"status,omitempty"`
	IsRepairable bool            `json:"-" bson:"isRepairable"`
	Description  string          `json:"description,omitempty" bson:"description"`
}

type NetworkInterface

type NetworkInterface struct {
	Label       string `json:"label" yaml:"label" bson:"label"`
	BusIdSlaves string `json:"busIdSlaves" yaml:"busIdSlaves" bson:"busIdSlaves"`
	Driver      string `json:"driver" yaml:"driver" bson:"driver"`
	State       string `json:"state" yaml:"state" bson:"state"`
	Speed       string `json:"speed" yaml:"speed" bson:"speed"`
}

type Node

type Node struct {
	Id                string `json:"id" yaml:"id"`
	SerialNumber      string `json:"serialNumber" yaml:"serialNumber"`
	DataCenter        string `json:"dataCenter" yaml:"dataCenter"`
	Hostname          string `json:"hostname" yaml:"hostname"`
	Role              string `json:"role" yaml:"role"`
	Protocol          string `json:"protocol,omitempty" yaml:"protocol,omitempty" bson:"protocol,omitempty"`
	Address           string `json:"address" yaml:"address"`
	Ip                string `json:"ip" yaml:"ip"`
	ManagementIP      string `json:"managementIP" yaml:"managementIP"`
	License           `json:"license" yaml:"license,omitempty" bson:"license,omitempty"`
	Status            string             `json:"status" yaml:"status"`
	CpuSpec           string             `json:"cpuSpec" yaml:"cpuSpec" bson:"cpuSpec"`
	NetworkInterfaces []NetworkInterface `json:"networkInterfaces" yaml:"networkInterfaces" bson:"networkInterfaces"`
	BlockDevices      []BlockDevice      `json:"blockDevices" yaml:"blockDevices" bson:"blockDevices"`
	Vcpu              ComputeStatistic   `json:"vcpu" yaml:"vcpu" bson:"vcpu"`
	Memory            SpaceStatistic     `json:"memory" yaml:"memory" bson:"memory"`
	Storage           SpaceStatistic     `json:"storage" yaml:"storage" bson:"storage"`
	UptimeSeconds     float64            `json:"uptimeSeconds" yaml:"uptimeSeconds" bson:"uptimeSeconds"`
	Token             string             `json:"-" yaml:"-" bson:"-"`
	Labels            map[string]string  `json:"labels,omitempty" yaml:"labels,omitempty" bson:"labels,omitempty"`
}

func GetControllerNodes

func GetControllerNodes() ([]*Node, error)

func GetNodeByHostname

func GetNodeByHostname(hostname string) (*Node, error)

func GetNodesByRole

func GetNodesByRole(roleName string) ([]*Node, error)

func GetOneOfControllerNode

func GetOneOfControllerNode() (*Node, error)

func ListNodes

func ListNodes() ([]*Node, error)

func (*Node) CreateSupportFileUrl

func (n *Node) CreateSupportFileUrl(file support.File) string

func (*Node) GenAuthHeader

func (n *Node) GenAuthHeader() (string, string)

func (*Node) GetBearerToken

func (n *Node) GetBearerToken() string

func (*Node) GetMetricUrl

func (n *Node) GetMetricUrl(metric, view string) string

func (*Node) GetNodeDetailsUrl

func (n *Node) GetNodeDetailsUrl() string

func (*Node) GetSupportFileUrl

func (n *Node) GetSupportFileUrl() string

func (*Node) GetTuningUrl

func (n *Node) GetTuningUrl() string

func (*Node) IsLocal

func (n *Node) IsLocal() bool

func (*Node) PatchSupportFileTaskUrl

func (n *Node) PatchSupportFileTaskUrl(file support.File) string

func (*Node) PatchTriggerTaskUrl

func (n *Node) PatchTriggerTaskUrl(trigger trigger.Options) string

func (*Node) PatchTuningTaskUrl

func (n *Node) PatchTuningTaskUrl(tuning Tuning) string

func (*Node) PatchTuningUrl

func (n *Node) PatchTuningUrl(tuning Tuning) string

type Page

type Page struct {
	Total          int64 `json:"total"`
	Number         int   `json:"number"`
	Size           int   `json:"size"`
	TotalItemCount int64 `json:"totalItemCount"`
}

func (Page) IsRequired

func (p Page) IsRequired() bool

type Period

type Period struct {
	Start string
	Stop  string
	Past  string
}

type Product

type Product struct {
	Name     string   `json:"name" yaml:"name" bson:"name"`
	Features []string `json:"features" yaml:"features" bson:"features"`
}

type Quantity

type Quantity struct {
	Type  string `json:"type" yaml:"type" bson:"type"`
	Value int    `json:"value" yaml:"vcpu" bson:"value"`
}

type RankPoint

type RankPoint struct {
	Id      string      `json:"id"`
	Name    string      `json:"name"`
	Device  string      `json:"device,omitempty"`
	Value   any         `json:"value"`
	History []TimeValue `json:"history"`
}

type RawBlockDevice

type RawBlockDevice struct {
	Name        string   `json:"name"`
	MajMin      string   `json:"maj:min"`
	Rm          bool     `json:"rm"`
	Size        string   `json:"size"`
	Ro          bool     `json:"ro"`
	Type        string   `json:"type"`
	MountPoints []string `json:"mountpoints"`
}

type RawLicense

type RawLicense struct {
	Type                  string `json:"type" yaml:"type" bson:"type"`
	Hostname              string `json:"hostname" yaml:"hostname" bson:"hostname"`
	Product               `json:"product" yaml:"product" bson:"product"`
	Quantity              `json:"quantity" yaml:"quantity" bson:"quantity"`
	ServiceLevelAgreement `json:"serviceLevelAgreement" yaml:"sla" bson:"serviceLevelAgreement"`
	Serial                string `json:"serial" yaml:"serial" bson:"serial"`
	Check                 int    `json:"check" yaml:"check" bson:"check"`
	IssueBy               string `json:"issueby" yaml:"issueby" bson:"issueby"`
	IssueTo               string `json:"issueto" yaml:"issueto" bson:"issueto"`
	Hardware              string `json:"hardware" yaml:"hardware" bson:"hardware"`
	Expiry                string `json:"expiry" yaml:"expiry" bson:"expiry"`
	Date                  string `json:"date" yaml:"date" bson:"date"`
	Days                  int    `json:"days" yaml:"days" bson:"days"`
}

type Role

type Role struct {
	Name  string  `json:"name" bson:"name"`
	Hosts []Host  `json:"hosts" bson:"hosts"`
	Nodes []*Node `json:"-"`
}

func GetComputeRole

func GetComputeRole() *Role

func GetControlConvergeRole

func GetControlConvergeRole() *Role

func GetControlRole

func GetControlRole() *Role

func GetControlRoles

func GetControlRoles() []*Role

func GetEdgeCoreRole

func GetEdgeCoreRole() *Role

func GetModeratorRole

func GetModeratorRole() *Role

func GetRolesToHandleTuning

func GetRolesToHandleTuning(tuningName string) ([]*Role, bool)

func GetStorageRole

func GetStorageRole() *Role

func (*Role) IsNodeEmpty

func (r *Role) IsNodeEmpty() bool

type Selector

type Selector struct {
	Enabled bool              `json:"enabled" yaml:"enabled"`
	Labels  map[string]string `json:"labels" yaml:"labels"`
}

type Service

type Service struct {
	Name               string          `json:"name" bson:"name"`
	Category           string          `json:"category" bson:"category"`
	Status             *status.Details `json:"status,omitempty" bson:"status,omitempty"`
	Modules            []Module        `json:"modules" bson:"modules"`
	IsInternalViewOnly bool            `json:"-" bson:"isInternalViewOnly"`
}

func (Service) CopyModuleEmptyStruct

func (s Service) CopyModuleEmptyStruct() Service

type ServiceLevelAgreement

type ServiceLevelAgreement struct {
	Uptime                 float32 `json:"uptime" yaml:"uptime" bson:"uptime"`
	Period                 string  `json:"period" yaml:"period" bson:"period"`
	MeanTimeBetweenFailure string  `json:"meanTimeBetweenFailure" yaml:"meanTimeBetweenFailure" bson:"meanTimeBetweenFailure"`
	MeanTimeToRecovery     string  `json:"meanTimeToRecovery" yaml:"meanTimeToRecovery" bson:"meanTimeToRecovery"`
}

type Setting

type Setting struct {
	TitlePrefix string        `json:"titlePrefix" bson:"titlePrefix"`
	Email       email.Options `json:"email" bson:"email"`
	Slack       slack.Options `json:"slack" bson:"slack"`
}

type SpaceStatistic

type SpaceStatistic struct {
	TotalMiB    float64 `json:"totalMiB"`
	UsedMiB     float64 `json:"usedMiB"`
	UsedPercent float64 `json:"usedPercent"`
	FreeMiB     float64 `json:"freeMiB"`
	FreePercent float64 `json:"freePercent"`
}

type StorageIopsSeries

type StorageIopsSeries struct {
	Unit  string         `json:"unit"`
	Read  []TimeOpsPoint `json:"read"`
	Write []TimeOpsPoint `json:"write"`
}

type StorageLatencySeries

type StorageLatencySeries struct {
	Read  []TimeMillisecondPoint `json:"read"`
	Write []TimeMillisecondPoint `json:"write"`
}

type StorageTimeSeries

type StorageTimeSeries struct {
	Unit  string      `json:"unit"`
	Read  []TimeValue `json:"read"`
	Write []TimeValue `json:"write"`
}

type SystemFilter

type SystemFilter struct {
	Severities []string `json:"severities"`
	Categories []string `json:"categories"`
}

type TimeBytesPoint

type TimeBytesPoint struct {
	Time  string  `json:"time"`
	Bytes float64 `json:"bytes"`
}

type TimeMillisecondPoint

type TimeMillisecondPoint struct {
	Time        string  `json:"time"`
	Millisecond float64 `json:"millisecond"`
}

type TimeOpsPoint

type TimeOpsPoint struct {
	Time string  `json:"time"`
	Ops  float64 `json:"ops"`
}

type TimePacketsPoint

type TimePacketsPoint struct {
	Time    string  `json:"time"`
	Packets float64 `json:"packets"`
}

type TimeUsedPercent

type TimeUsedPercent struct {
	Time        string  `json:"time"`
	UsedPercent float64 `json:"usedPercent"`
}

type TimeValue

type TimeValue struct {
	Time  string `json:"time"`
	Value any    `json:"value"`
}

type TitlePrefix

type TitlePrefix struct {
	Value string `json:"value" bson:"value"`
}

type TrafficStatistic

type TrafficStatistic struct {
	Ingress float64 `json:"ingress"`
	Egress  float64 `json:"egress"`
}

type Tuning

type Tuning struct {
	Id          string           `json:"id,omitempty" yaml:"-" bson:"id"`
	Name        string           `json:"name" yaml:"name" bson:"name"`
	Value       any              `json:"value" yaml:"value" bson:"value"`
	Description string           `json:"description" yaml:"-" bson:"-"`
	Enabled     bool             `json:"enabled" yaml:"enabled" bson:"enabled"`
	IsModified  bool             `json:"isModified" yaml:"-" bson:"-"`
	Limitation  TuningLimitation `json:"limitation" yaml:"-" bson:"-"`

	*Node  `json:"node,omitempty" yaml:"-" bson:"-"`
	Hosts  []Host         `json:"hosts" yaml:"-" bson:"-"`
	Roles  []Role         `json:"roles,omitempty" yaml:"-" bson:"-"`
	Status *status.Tuning `json:"status,omitempty" yaml:"-" bson:"status,omitempty"`
}

func GetLocalTuning

func GetLocalTuning(name string) Tuning

func ListLocalTunings

func ListLocalTunings() []Tuning

func (*Tuning) Bytes

func (t *Tuning) Bytes() ([]byte, error)

func (*Tuning) CopyAndOverrideHost

func (t *Tuning) CopyAndOverrideHost(node Node) Tuning

func (*Tuning) GenTaskUpdate

func (t *Tuning) GenTaskUpdate() Tuning

func (*Tuning) GenerateId

func (t *Tuning) GenerateId() string

func (*Tuning) IncludeHost

func (t *Tuning) IncludeHost(hostname string) bool

func (*Tuning) IncludeHosts

func (t *Tuning) IncludeHosts(hosts []string) bool

func (*Tuning) InitHosts

func (t *Tuning) InitHosts(hosts []string)

func (*Tuning) InitOkStatus

func (t *Tuning) InitOkStatus()

func (*Tuning) InitResetStatus

func (t *Tuning) InitResetStatus()

func (*Tuning) InitStatus

func (t *Tuning) InitStatus(current, desired string)

func (*Tuning) InitUpdateStatus

func (t *Tuning) InitUpdateStatus()

func (*Tuning) JoinHosts

func (t *Tuning) JoinHosts() string

func (*Tuning) SearchKey

func (t *Tuning) SearchKey() string

func (*Tuning) SetCompleted

func (t *Tuning) SetCompleted()

func (*Tuning) SetDesired

func (t *Tuning) SetDesired(status string)

func (*Tuning) SetError

func (t *Tuning) SetError()

func (*Tuning) SetNodeInfo

func (t *Tuning) SetNodeInfo(role, address string)

func (*Tuning) SetUpdated

func (t *Tuning) SetUpdated()

func (*Tuning) SetUpdating

func (t *Tuning) SetUpdating()

func (*Tuning) StrValue

func (t *Tuning) StrValue() string

type TuningLimitation

type TuningLimitation struct {
	Type    string `json:"type"`
	Default any    `json:"default"`
	Min     int    `json:"min,omitempty"`
	Max     int    `json:"max,omitempty"`
	Regex   string `json:"regex,omitempty"`
}

type TuningPolicy

type TuningPolicy struct {
	Name    string   `json:"name" yaml:"name"`
	Version string   `json:"version" yaml:"version"`
	Enabled bool     `json:"enabled" yaml:"enabled"`
	Tunings []Tuning `json:"tunings" yaml:"tunings"`
}

func (*TuningPolicy) AppendTuning

func (t *TuningPolicy) AppendTuning(tuning Tuning)

func (*TuningPolicy) AppendTunings

func (t *TuningPolicy) AppendTunings(tunings []Tuning)

func (*TuningPolicy) DeleteTuning

func (t *TuningPolicy) DeleteTuning(name string)

func (*TuningPolicy) HasMatchedTuning

func (t *TuningPolicy) HasMatchedTuning(tuning Tuning) bool

func (*TuningPolicy) UpdateOrAppendTuning

func (t *TuningPolicy) UpdateOrAppendTuning(tuning Tuning)

type TuningReset

type TuningReset struct {
	Hosts []string `json:"hosts"`
}

type TuningSpec

type TuningSpec struct {
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Limitation  TuningLimitation `json:"limitation"`
	Roles       []*Role          `json:"roles"`
	Selector    `json:"-"`
}

func GetTuningSpec

func GetTuningSpec(name string) (*TuningSpec, error)

func ListTuningSpecs

func ListTuningSpecs() []TuningSpec

func (*TuningSpec) IsInLimitedRange

func (t *TuningSpec) IsInLimitedRange(value int) bool

type TuningToggle

type TuningToggle struct {
	Enable bool     `json:"enable"`
	Hosts  []string `json:"hosts"`
}

type TuningUpdate

type TuningUpdate struct {
	Value any      `json:"value"`
	Hosts []string `json:"hosts"`
}

type User

type User struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

func (User) IsNameEmpty

func (u User) IsNameEmpty() bool

func (User) IsPasswordEmpty

func (u User) IsPasswordEmpty() bool

type VmDiskIopsUsage

type VmDiskIopsUsage struct {
	Id      string         `json:"id"`
	Name    string         `json:"name"`
	Device  string         `json:"device,omitempty"`
	Ops     float64        `json:"ops"`
	History []TimeOpsPoint `json:"history"`
}

type VmMetricsUsage

type VmMetricsUsage struct {
	Id          string            `json:"id"`
	Name        string            `json:"name"`
	Device      string            `json:"device,omitempty"`
	UsedPercent float64           `json:"usedPercent"`
	History     []TimeUsedPercent `json:"history"`
}

type VmNetworkTrafficUsage

type VmNetworkTrafficUsage struct {
	Id      string             `json:"id"`
	Name    string             `json:"name"`
	Device  string             `json:"device,omitempty"`
	Packets float64            `json:"packets"`
	History []TimePacketsPoint `json:"history"`
}

type VmPercentageUsage

type VmPercentageUsage struct {
	Id          string            `json:"id"`
	Name        string            `json:"name"`
	UsedPercent float64           `json:"usedPercent"`
	History     []TimeUsedPercent `json:"history"`
}

type VmUsage

type VmUsage struct {
	Vcpu    ComputeStatistic `json:"vcpu"`
	Memory  SpaceStatistic   `json:"memory"`
	Storage SpaceStatistic   `json:"storage"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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