Versions in this module Expand all Collapse all v1 v1.0.0 Oct 15, 2021 Changes in this version + var ContainerNotReadyErrors = []string + var PodManagerNotInitError = errors.New("pod manager not init.") + func BuildAndRefVolumeInfo(pvcName, insId string, pod *v1.Pod) + func BuildEngineContainer(logger logr.Logger, dbCluster *domain.SharedStorageDbClusterBase, ...) corev1.Container + func BuildManagerContainer(dbCluster *domain.SharedStorageDbClusterBase, conf *SysResourceConfig) corev1.Container + func BuildNodeAvailableInfo(logger logr.Logger) ([]string, error) + func BuildPfsdContainer(dbCluster *domain.SharedStorageDbClusterBase, conf *SysResourceConfig) corev1.Container + func BuildPfsdToolsContainer(dbCluster *domain.SharedStorageDbClusterBase, conf *SysResourceConfig) corev1.Container + func BuildPodNodeAffinity(taintNodeList []string, targetNode string, logger logr.Logger) (*corev1.NodeAffinity, error) + func BuildPodObjectMeta(ins domain.DbIns, cluster domain.SharedStorageDbClusterBase, insType string) metav1.ObjectMeta + func CheckConditionAvailable(nodeName string, cond *corev1.NodeCondition, logger logr.Logger) bool + func CheckHwStatusByNodeCondition(nodes []corev1.Node, logger logr.Logger) (unAvailableNode []corev1.Node, availableNode []corev1.Node) + func CheckHwStatusBySshNode(nodes []corev1.Node, logger logr.Logger) (unAvailableNode []corev1.Node, availableNode []corev1.Node) + func ExecCommand(runCmdNode string, logger logr.Logger, ...) error + func GetCmDeployment(dbClusterName string, dbClusterNamespace string) (*appsv1.Deployment, error) + func GetNetworkCardName(logger logr.Logger, key string) string + func GetNodeName(nodes []corev1.Node) []string + func GetNodeStatus(resultChan chan NodeAvailable, node *corev1.Node, logger logr.Logger) + func GetUnAvailableNode(logger logr.Logger) ([]string, error) + func GetUnAvailableNodes(logger logr.Logger) ([]corev1.Node, []corev1.Node, error) + type Account struct + Account string + Password string + PriviledgeType int + type AccountRepository struct + GetKubeResourceFunc GetKubeResourceFunc + Logger logr.Logger + func (r *AccountRepository) EnsureAccountMeta(cluster *domain.DbClusterBase, account *domain.Account) error + func (r *AccountRepository) GetAccounts(clusterName, namespace string) (accounts map[string]*domain.Account, err error) + type ClassQuery struct + func NewClassQuery(logger logr.Logger) *ClassQuery + func (q *ClassQuery) GetClasses(engineType domain.EngineType, classKey string) (classList []*domain.EngineClass, err error) + type ClusterManagerClient struct + DbClusterName string + DbClusterNamespace string + IP string + Port string + func NewClusterManagerClient(logger logr.Logger) *ClusterManagerClient + func (m *ClusterManagerClient) AddCluster(ctx context.Context, id, ip string, port int, isClientIP bool) error + func (m *ClusterManagerClient) AddDataMax(ctx context.Context, id, ip, podName string, port int) error + func (m *ClusterManagerClient) AddIns(ctx context.Context, id, ip, role, sync, hostName string, port int, ...) error + func (m *ClusterManagerClient) AddTopologyEdge(ctx context.Context, upStreamId, downStreamId string, copyType domain.CopyType) error + func (m *ClusterManagerClient) DeleteCluster(ctx context.Context, id string) error + func (m *ClusterManagerClient) DeleteDataMax(ctx context.Context, id string) error + func (m *ClusterManagerClient) DeleteTopologyEdge(ctx context.Context, upStreamId, downStreamId string) error + func (m *ClusterManagerClient) DemoteStandby(ctx context.Context, id, ip string, port int, copyType domain.CopyType, ...) error + func (m *ClusterManagerClient) DisableHA(ctx context.Context) error + func (m *ClusterManagerClient) DoActionCommon(ctx context.Context, requestUrl string, method string, requestContent string, ...) (string, error) + func (m *ClusterManagerClient) EnableHA(ctx context.Context) error + func (m *ClusterManagerClient) EnsureAffinity(ctx context.Context, clusterNamespace, clusterName, rwHostName string) error + func (m *ClusterManagerClient) GetClusterStatus(ctx context.Context) (*domain.ClusterStatus, error) + func (m *ClusterManagerClient) InitWithLocalDbCluster(ctx context.Context, dbClusterNamespace, dbClusterName string, ...) error + func (m *ClusterManagerClient) PromoteStandby(ctx context.Context) error + func (m *ClusterManagerClient) RemoveIns(ctx context.Context, id, ip, role, sync, hostName string, port int, ...) error + func (m *ClusterManagerClient) SetFollower(ctx context.Context) error + func (m *ClusterManagerClient) SetLeader(ctx context.Context) error + func (m *ClusterManagerClient) Switchover(ctx context.Context, oriRwIp, oriRoIp, port string, isClientIP bool) error + func (m *ClusterManagerClient) UpdateCluster(ctx context.Context, id, ip string, port int, isClientIP bool) error + func (m *ClusterManagerClient) UpdateDataMax(ctx context.Context, id, ip, podName string, port int) error + func (m *ClusterManagerClient) UpgradeVersion(ctx context.Context, clusterNamespace, clusterName, image string) error + func (m *ClusterManagerClient) WaitForStartingCompleted(ctx context.Context, clientIp, port string, timeout time.Duration) (insStatus *domain.InsStatus, err error) + type ClusterManagerCreator struct + ClusterManagerImage string + ConsensusPort int + LogicInsId string + Port int + RwID string + WorkModel domain.CmWorkMode + func NewClusterManagerCreator(logger logr.Logger, accountRepository domain.IAccountRepository) *ClusterManagerCreator + func (m *ClusterManagerCreator) CreateClusterManager(ctx context.Context, kubeObj metav1.Object, workMode domain.CmWorkMode, ...) error + type ClusterManagerRemover struct + func NewClusterManagerRemover(logger logr.Logger) *ClusterManagerRemover + func (m *ClusterManagerRemover) Remove(dbClusterName, dbClusterNamespace string, ctx context.Context) error + type CmRequestRetry struct + func (r *CmRequestRetry) ConditionFunc() (bool, error) + type CmResponse struct + Code int + Msg string + type EngineParamsClassQuery struct + func NewEngineParamsClassQuery(logger logr.Logger) *EngineParamsClassQuery + func (q *EngineParamsClassQuery) GetClassParams(engineType domain.EngineType, classKey string) (params map[string]string, err error) + type EngineParamsRepository struct + GetKubeResourceFunc GetKubeResourceFunc + Logger logr.Logger + func (repo *EngineParamsRepository) GetRunningParams(engine *domain.DbClusterBase) (map[string]*domain.ParamItem, error) + func (repo *EngineParamsRepository) GetUserParams(engine *domain.DbClusterBase) (map[string]*domain.ParamItem, string, error) + func (repo *EngineParamsRepository) SaveLatestFlushTime(engine *domain.DbClusterBase) error + func (repo *EngineParamsRepository) SaveRunningParams(engine *domain.DbClusterBase, initParams map[string]string) error + func (repo *EngineParamsRepository) SaveUserParams(engine *domain.DbClusterBase, initParams map[string]string) error + func (repo *EngineParamsRepository) UpdateUserParams(engine *domain.DbClusterBase, ...) error + type EngineParamsTemplateQuery struct + func NewEngineParamsTemplateQuery(logger logr.Logger) *EngineParamsTemplateQuery + func (q *EngineParamsTemplateQuery) GetTemplateParams(engineType domain.EngineType) (params []*domain.ParamTemplateItem, err error) + type EnvClusterInfo struct + DataMaxClusterInfo map[string]*PhysicalCustInstance + RoClusterInfo map[string]*PhysicalCustInstance + RwClusterInfo map[string]*PhysicalCustInstance + StandbyClusterInfo map[string]*PhysicalCustInstance + func (r *EnvClusterInfo) ToString() (string, error) + type EnvGetStrategyBase struct + AccountRepository domain.IAccountRepository + GetClusterName func() string + GetFlushEnvConfigMap func() (*v1.ConfigMap, error) + Ins *domain.DbIns + Logger logr.Logger + func (d *EnvGetStrategyBase) GetCheckHealthEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetCreateEngineAccountEnvirons() ([]string, error) + func (d *EnvGetStrategyBase) GetCreateReplicationSlotEnvirons(roResourceName string) (string, error) + func (d *EnvGetStrategyBase) GetEnvConfigMap() (*v1.ConfigMap, error) + func (d *EnvGetStrategyBase) GetGracefulStopEngineEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetGrowStorageEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetInstallationProgressEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetLockEngineEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetPodName() (string, string) + func (d *EnvGetStrategyBase) GetPrimarySystemIdentifier() (string, error) + func (d *EnvGetStrategyBase) GetSetupLogAgentEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetStartEngineEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetUnLockEngineEnvirons() (string, error) + func (d *EnvGetStrategyBase) GetUpdateEngineParamsEnvirons(engineParams map[string]string) (string, error) + func (d EnvGetStrategyBase) GetAccountsFromMeta() (accounts map[string]*Account, err error) + func (d EnvGetStrategyBase) GetCommonEnv(operatorType string, operatorAction string, allFields bool, fields ...string) (string, error) + func (d EnvGetStrategyBase) GetEnvPort() (*EnvPort, error) + func (d EnvGetStrategyBase) GetPhysicalAndInsId(resourceName string) (string, string, error) + func (d EnvGetStrategyBase) GetPhysicalCustInstanceEnv(accounts map[string]*Account, insId, hostIP string, port int, pbd *Pbd, ...) (physicalCustInstance *PhysicalCustInstance) + func (d EnvGetStrategyBase) GetUniqueId(resourceName string) (string, error) + func (d EnvGetStrategyBase) TranslateEnvMap2String(envMap map[string]string) string + func (d EnvGetStrategyBase) TranslateEnvMap2StringWithBase(envMap map[string]string, baseString string) string + type EnvPort map[string]*Port + func (r *EnvPort) ToString() (string, error) + type GetKubeResourceFunc func(name, namespace string, clusterType domain.DbClusterType) (metav1.Object, error) + type GoSet struct + func NewGoSet() *GoSet + func (set *GoSet) Add(val ...int32) bool + func (set *GoSet) ClearAll() *[]int32 + func (set *GoSet) Contains(val ...int32) bool + func (set *GoSet) GetAll() *[]int32 + func (set *GoSet) Remove(val ...int32) *[]int32 + type HostIns struct + InsIp string + Port int + Role string + type IEnvGetStrategy interface + GetCheckHealthEnvirons func() (string, error) + GetCreateEngineAccountEnvirons func() ([]string, error) + GetCreateReplicationSlotEnvirons func(string) (string, error) + GetGracefulStopEngineEnvirons func() (string, error) + GetGrowStorageEnvirons func() (string, error) + GetInstallEngineEnvirons func(ctx context.Context) (string, error) + GetInstallationProgressEnvirons func() (string, error) + GetLockEngineEnvirons func() (string, error) + GetPodName func() (string, string) + GetPrimarySystemIdentifier func() (string, error) + GetSetupLogAgentEnvirons func() (string, error) + GetStartEngineEnvirons func() (string, error) + GetUnLockEngineEnvirons func() (string, error) + GetUpdateEngineParamsEnvirons func(engineParams map[string]string) (string, error) + Load func(domainModel interface{}, ins *domain.DbIns) error + type IdGenerator struct + func NewIdGenerator(logger logr.Logger) *IdGenerator + func (g *IdGenerator) GetNextClusterScopeHostInsIds(n int) ([]int, error) + type ManagerClient struct + EnvGetStrategy IEnvGetStrategy + PodName string + PodNamespace string + func NewManagerClient(strategy IEnvGetStrategy, logger logr.Logger) *ManagerClient + func (m *ManagerClient) CheckHealth(ctx context.Context) *domain.HealthCheckError + func (m *ManagerClient) CheckInstallIsReady(ctx context.Context) (bool, error) + func (m *ManagerClient) CreateEngineAccount(ctx context.Context) error + func (m *ManagerClient) CreateReplicationSlot(ctx context.Context, roResourceName string) error + func (m *ManagerClient) ExecCmdInPod(ctx context.Context, envs string) error + func (m *ManagerClient) ExecCmdInPodBase(ctx context.Context, envs string, waitContainer bool, ...) (stdout string, stderr string, err error) + func (m *ManagerClient) ForceStopEngine(ctx context.Context) error + func (m *ManagerClient) GetPrimarySystemIdentifier(ctx context.Context) (string, error) + func (m *ManagerClient) GracefulStopEngine(ctx context.Context) error + func (m *ManagerClient) GrowStorage(ctx context.Context) error + func (m *ManagerClient) Init(domainModel interface{}) + func (m *ManagerClient) InstallEngine(ctx context.Context) error + func (m *ManagerClient) LockEngine(ctx context.Context) error + func (m *ManagerClient) RestartEngine(ctx context.Context) error + func (m *ManagerClient) SetIns(ins *domain.DbIns) error + func (m *ManagerClient) SetupLogAgent(ctx context.Context) error + func (m *ManagerClient) StartEngine(ctx context.Context) error + func (m *ManagerClient) UpdateEngineParams(ctx context.Context, engineParams map[string]string) error + type MinorVersionQuery struct + func NewMinorVersionQuery(logger logr.Logger) *MinorVersionQuery + func (q *MinorVersionQuery) GetLatestMinorVersion(engineType domain.EngineType) (version *domain.MinorVersion, err error) + func (q *MinorVersionQuery) GetMinorVersion(engineType domain.EngineType, versionName string) (version *domain.MinorVersion, err error) + func (q *MinorVersionQuery) GetMinorVersions(engineType domain.EngineType) (latestVersion string, versionList []*domain.MinorVersion, err error) + type NodeAvailable struct + Available bool + Node *corev1.Node + type Pbd struct + CustinsId int + DataVersion int64 + EngineType string + Label string + PbdName string + PbdNumber int64 + type PfsdToolClient struct + func NewPfsdToolClient(logger logr.Logger) *PfsdToolClient + func (m *PfsdToolClient) Init(ins *domain.DbIns, resources map[string]*domain.InstanceResource, ...) + func (m *PfsdToolClient) StartPfsd(ctx context.Context) error + type PhysicalCustInstance struct + Accounts map[string]*Account + HostIns map[string]*HostIns + InsType int + PbdList []*Pbd + type PodManagerBase struct + Inited bool + Ins *domain.DbIns + Logger logr.Logger + func (q *PodManagerBase) CleanDataFiles() error + func (q *PodManagerBase) DeletePod(ctx context.Context) error + func (q *PodManagerBase) EnsureInsTypeMeta(ctx context.Context, insType string) error + func (q *PodManagerBase) IsDeleted(ctx context.Context) (bool, error) + func (q *PodManagerBase) SetIns(ins *domain.DbIns) + type Port struct + AccessPort []int + Link []int + PerfPort []int + func (r *Port) ToString() (string, error) + type PortGenerator struct + func NewPortGenerator(logger logr.Logger) *PortGenerator + func (g *PortGenerator) CheckPortUsed(port int, rangesName string) (bool, error) + func (g *PortGenerator) GetNextClusterExternalPort() (int, error) + type PortRange struct + Base int + Size int + func ParsePortRange(value string) (*PortRange, error) + func (*PortRange) Type() string + func (pr *PortRange) Contains(p int) bool + func (pr *PortRange) Set(value string) error + func (pr PortRange) String() string + type PortRanges struct + PortRange *PortRange + ReservedPortRanges []*PortRange + func ParsePortRanges(portRange, reservedPortRanges string) (*PortRanges, error) + func (prs *PortRanges) Contains(p int) bool + func (prs *PortRanges) GetMinAndMaxPort() (int, int) + func (prs *PortRanges) Set(value string) error + func (prs *PortRanges) SetReservedPortRanges(value string) error + type ResourceQuantity struct + CPU resource.Quantity + Memory resource.Quantity + type StorageManager struct + func NewStorageManager(logger logr.Logger) *StorageManager + func (s *StorageManager) Expand(ctx context.Context, name, namespace, volumeId, resourceName string, ...) error + func (s *StorageManager) GetTopo(ctx context.Context, name, namespace string) (*domain.StorageTopo, error) + func (s *StorageManager) InitWithAddress(ip, port string) error + func (s *StorageManager) Release(ctx context.Context, name, namespace, clusterName string) error + func (s *StorageManager) SetWriteLock(ctx context.Context, name, namespace, nodeId string) (*domain.StorageTopo, error) + func (s *StorageManager) UseStorage(ctx context.Context, ...) error + type StorageSvcRequestRetry struct + func (r *StorageSvcRequestRetry) ConditionFunc() (bool, error) + type StorageSvcResponse struct + Code int + Msg string + type SysResource struct + Manager *SysResourceQuantity + Pfsd *SysResourceQuantity + PfsdTool *SysResourceQuantity + type SysResourceConfig struct + ReadWriteMany SysResource + Single SysResource + func GetSysResConfig(logger logr.Logger) (conf *SysResourceConfig, err error) + type SysResourceQuantity struct + Limits ResourceQuantity + Requests ResourceQuantity