Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotDeploy = errors.New("not deploy")

    ErrNotDeploy 未部署错误

    View Source
    var ErrTimeOut = errors.New("time out")

      ErrTimeOut 超时

      View Source
      var Replicas0 = []byte(`{"spec":{"replicas":0}}`)

        Replicas0 petch replicas to 0

        Functions

        func CheckVersionInfo

        func CheckVersionInfo(version *model.VersionInfo) bool

          CheckVersionInfo CheckVersionInfo

          func GetConfigKey

          func GetConfigKey(rk string) string

            GetConfigKey 获取配置key

            func Replicas

            func Replicas(n int) []byte

              Replicas petch replicas to n

              Types

              type CacheManager

              type CacheManager struct {
              	// contains filtered or unexported fields
              }

                CacheManager cache管理器

                func NewCacheManager

                func NewCacheManager() *CacheManager

                  NewCacheManager new

                  func (*CacheManager) AddPod

                  func (m *CacheManager) AddPod(podName string, logger event.Logger) *PodStatus

                    AddPod 添加

                    func (*CacheManager) RemovePod

                    func (m *CacheManager) RemovePod(podName string)

                      RemovePod 移除POD状态

                      type DeploymentBuild

                      type DeploymentBuild struct {
                      	// contains filtered or unexported fields
                      }

                        DeploymentBuild DeploymentBuild

                        func DeploymentBuilder

                        func DeploymentBuilder(serviceID string, logger event.Logger, nodeAPI string) (*DeploymentBuild, error)

                          DeploymentBuilder DeploymentBuilder

                          func (*DeploymentBuild) Build

                          func (s *DeploymentBuild) Build() (*v1beta1.Deployment, error)

                            Build 构建

                            func (*DeploymentBuild) GetTenant

                            func (s *DeploymentBuild) GetTenant() string

                              GetTenant 获取租户id

                              type K8sServiceBuild

                              type K8sServiceBuild struct {
                              	// contains filtered or unexported fields
                              }

                                K8sServiceBuild K8sServiceBuild

                                func K8sServiceBuilder

                                func K8sServiceBuilder(serviceID, replicationType string, logger event.Logger) (*K8sServiceBuild, error)

                                  K8sServiceBuilder 构建应用对应的k8s service

                                  func (*K8sServiceBuild) Build

                                  func (k *K8sServiceBuild) Build() ([]*v1.Service, error)

                                    Build 构建应用的所有端口服务

                                    func (*K8sServiceBuild) BuildOnPort

                                    func (k *K8sServiceBuild) BuildOnPort(p int, isOut bool) (*v1.Service, error)

                                      BuildOnPort 指定端口创建Service

                                      func (*K8sServiceBuild) CreateUpstreamPluginMappingPort

                                      func (k *K8sServiceBuild) CreateUpstreamPluginMappingPort(
                                      	ports []*model.TenantServicesPort,
                                      	pluginPorts []*model.TenantServicesStreamPluginPort,
                                      ) (
                                      	[]*model.TenantServicesPort,
                                      	map[int32]int,
                                      	error)

                                        CreateUpstreamPluginMappingPort 检查是否存在upstream插件,接管入口网络

                                        func (*K8sServiceBuild) CreateUpstreamPluginMappingService

                                        func (k *K8sServiceBuild) CreateUpstreamPluginMappingService(services []*v1.Service, pp map[int32]int) (
                                        	[]*v1.Service,
                                        	error)

                                          CreateUpstreamPluginMappingService 增加service plugin mapport 标签

                                          func (*K8sServiceBuild) GetTenantID

                                          func (k *K8sServiceBuild) GetTenantID() string

                                            GetTenantID 获取租户ID

                                            type Manager

                                            type Manager interface {
                                            	StartStatefulSet(serviceID string, logger event.Logger) (*v1beta1.StatefulSet, error)
                                            	StopStatefulSet(serviceID string, logger event.Logger) error
                                            	//TODO: 实现滚动升级,目前无滚动升级,采用重启操作
                                            	RollingUpgradeStatefulSet(serviceID string, logger event.Logger) (*v1beta1.StatefulSet, error)
                                            	StartReplicationController(serviceID string, logger event.Logger) (*v1.ReplicationController, error)
                                            	StopReplicationController(serviceID string, logger event.Logger) error
                                            	RollingUpgradeReplicationController(serviceID string, stopChan chan struct{}, logger event.Logger) (*v1.ReplicationController, error)
                                            	RollingUpgradeReplicationControllerCompatible(serviceID string, stopChan chan struct{}, logger event.Logger) (*v1.ReplicationController, error)
                                            	StartDeployment(serviceID string, logger event.Logger) (*v1beta1.Deployment, error)
                                            	StopDeployment(serviceID string, logger event.Logger) error
                                            	//TODO:
                                            	RollingUpgradeDeployment(serviceID string, logger event.Logger) (*v1beta1.Deployment, error)
                                            	HorizontalScaling(serviceID string, oldReplicas int32, logger event.Logger) error
                                            	StartService(serviceID string, logger event.Logger, ReplicationID, ReplicationType string) error
                                            	UpdateService(serviceID string, logger event.Logger, ReplicationID, ReplicationType string) error
                                            	StopService(serviceID string, logger event.Logger) error
                                            	//StartServiceByPort(serviceID string, port int, isOut bool, logger event.Logger) error
                                            	StopServiceByPort(serviceID string, port int, isOut bool, logger event.Logger) error
                                            	SyncData()
                                            	Stop()
                                            }

                                              Manager kubeapi

                                              func NewManager

                                              func NewManager(conf option.Config, statusManager *client.AppRuntimeSyncClient) (Manager, error)

                                                NewManager 创建manager

                                                type PodStatus

                                                type PodStatus struct {
                                                	PodName           string
                                                	PodScheduled      string
                                                	PodScheduledError int
                                                	Initialized       string
                                                	Ready             string
                                                	// contains filtered or unexported fields
                                                }

                                                  PodStatus pod状态

                                                  func (*PodStatus) AddStatus

                                                  func (p *PodStatus) AddStatus(podStatus v1.PodStatus) (bool, error)

                                                    AddStatus 更新POD状态

                                                    type PodTemplateSpecBuild

                                                    type PodTemplateSpecBuild struct {
                                                    	NodeAPI string
                                                    	// contains filtered or unexported fields
                                                    }

                                                      PodTemplateSpecBuild pod build

                                                      func PodTemplateSpecBuilder

                                                      func PodTemplateSpecBuilder(serviceID string, logger event.Logger, nodeAPI string) (*PodTemplateSpecBuild, error)

                                                        PodTemplateSpecBuilder pod builder

                                                        func (*PodTemplateSpecBuild) Build

                                                          Build 通过service 构建pod template

                                                          func (*PodTemplateSpecBuild) CreateUpstreamPluginMappingPort

                                                          func (p *PodTemplateSpecBuild) CreateUpstreamPluginMappingPort(
                                                          	ports []*model.TenantServicesPort,
                                                          	pluginPorts []*model.TenantServicesStreamPluginPort,
                                                          ) (
                                                          	[]*model.TenantServicesPort,
                                                          	error)

                                                            CreateUpstreamPluginMappingPort 检查是否存在upstream插件,接管入口网络

                                                            func (*PodTemplateSpecBuild) GetService

                                                            func (p *PodTemplateSpecBuild) GetService() *model.TenantServices

                                                              GetService get service

                                                              func (*PodTemplateSpecBuild) GetTenant

                                                              func (p *PodTemplateSpecBuild) GetTenant() *model.Tenants

                                                                GetTenant get tenant

                                                                type ReplicationControllerBuild

                                                                type ReplicationControllerBuild struct {
                                                                	// contains filtered or unexported fields
                                                                }

                                                                  ReplicationControllerBuild ReplicationControllerBuild

                                                                  func ReplicationControllerBuilder

                                                                  func ReplicationControllerBuilder(serviceID string, logger event.Logger, nodeAPI string) (*ReplicationControllerBuild, error)

                                                                    ReplicationControllerBuilder ReplicationControllerBuilder

                                                                    func (*ReplicationControllerBuild) Build

                                                                      Build 构建

                                                                      func (*ReplicationControllerBuild) GetTenant

                                                                      func (s *ReplicationControllerBuild) GetTenant() string

                                                                        GetTenant 获取租户id

                                                                        type StatefulSetBuild

                                                                        type StatefulSetBuild struct {
                                                                        	// contains filtered or unexported fields
                                                                        }

                                                                          StatefulSetBuild StatefulSetBuild

                                                                          func StatefulSetBuilder

                                                                          func StatefulSetBuilder(serviceID string, logger event.Logger, nodeAPI string) (*StatefulSetBuild, error)

                                                                            StatefulSetBuilder StatefulSetBuilder

                                                                            func (*StatefulSetBuild) Build

                                                                            func (s *StatefulSetBuild) Build() (*v1beta1.StatefulSet, error)

                                                                              Build 构建

                                                                              func (*StatefulSetBuild) GetTenant

                                                                              func (s *StatefulSetBuild) GetTenant() string

                                                                                GetTenant 获取租户id