socket

package
v5.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: AGPL-3.0 Imports: 58 Imported by: 0

Documentation

Overview

Package socket is a generated GoMock package.

Index

Constants

View Source
const (
	VarImagePullSecrets       = "ImagePullSecrets"
	VarImagePullSecretsNoName = "ImagePullSecretsNoName"
	VarBranch                 = "Branch"
	VarCommit                 = "Commit"
	VarPipeline               = "Pipeline"
	VarClusterIssuer          = "ClusterIssuer"
	VarHost                   = "Host"
	VarTlsSecret              = "TlsSecret"
)
View Source
const (
	OpStdout = "stdout"
	OpStdin  = "stdin"
	OpResize = "resize"
	OpToast  = "toast"
)

Variables

View Source
var (
	ETX                 = []byte("\u0003")
	END_OF_TRANSMISSION = []byte("\u0004")
)
View Source
var ErrorVersionNotMatched = errors.New("[部署冲突]: 1. 可能是多个人同时部署导致 2. 项目已经存在")

Functions

func GetSlugName

func GetSlugName[T int64 | int | int32](namespaceId T, name string) string

func InstallProject

func InstallProject(ctx context.Context, job Job) (err error)

func IsRemoteLocalChartPath

func IsRemoteLocalChartPath(input string) bool

func NewCloser

func NewCloser(fn func() error) io.Closer

func NewEmptyCommit

func NewEmptyCommit() application.Commit

func NewEmptyPubSub

func NewEmptyPubSub() application.PubSub

func NewWebsocketManager

func NewWebsocketManager(
	logger mlog.Logger,
	counter counter.Counter,
	projRepo repo.ProjectRepo,
	repoRepo repo.RepoRepo,
	nsRepo repo.NamespaceRepo,
	jobManager JobManager,
	data data.Data,
	pl application.PluginManger,
	auth auth.Auth,
	uploader uploader.Uploader,
	locker locker.Locker,
	clusterRepo repo.K8sRepo,
	eventRepo repo.EventRepo,
	executor repo.ExecutorManager,
	fileRepo repo.FileRepo,
) application.WsHttpServer

Types

type ChartFileLoader

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

ChartFileLoader 下载远程 chart 文件

func (*ChartFileLoader) Load

func (c *ChartFileLoader) Load(j *jobRunner) error

type Conn

type Conn interface {
	ID() string
	UID() string
	SetUser(info *auth.UserInfo)
	GetUser() *auth.UserInfo
	PubSub() application.PubSub

	AddCancelDeployTask(id string, fn func(error)) error
	RunCancelDeployTask(id string) error
	RemoveCancelDeployTask(id string)

	GetPtyHandler(sessionID string) (PtyHandler, bool)
	SetPtyHandler(sessionID string, session PtyHandler)
	ClosePty(ctx context.Context, sessionId string, status uint32, reason string)
	CloseAndClean(ctx context.Context) error
	GorillaWs
}

type DeployMsger

type DeployMsger interface {
	Percentable

	SendProcessPercent(int64)
	SendDeployedResult(t websocket_pb.ResultType, msg string, p *types.ProjectModel)
	SendEndError(error)
	SendMsg(string)
	SendProtoMsg(application.WebsocketMessage)
	SendMsgWithContainerLog(msg string, containers []*websocket_pb.Container)
}

func NewMessageSender

func NewMessageSender(
	conn Conn,
	slugName string,
	wsType websocket_pb.Type,
) DeployMsger

type ElementsLoader

type ElementsLoader struct{}

ElementsLoader 后台自定义配置加载, 返回一个片段

```yaml resources:

  limits:
	cpu: 100m

ingress:

enables: true

```

func (*ElementsLoader) Load

func (d *ElementsLoader) Load(j *jobRunner) error

type GorillaWs

type GorillaWs interface {
	SetWriteDeadline(t time.Time) error
	WriteMessage(messageType int, data []byte) error
	SetReadLimit(limit int64)
	SetReadDeadline(t time.Time) error
	SetPongHandler(h func(appData string) error)
	ReadMessage() (messageType int, p []byte, err error)
	NextWriter(messageType int) (io.WriteCloser, error)
	Close() error
}

type HandleRequestFunc

type HandleRequestFunc func(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

type InstallInput

type InstallInput struct {
	IsNew        bool
	Wait         bool
	Chart        *chart.Chart
	ValueOptions *values.Options
	DryRun       bool
	ReleaseName  string
	Namespace    string
	Description  string
	// contains filtered or unexported fields
}

type Job

type Job interface {
	Stop(error)
	IsNotDryRun() bool

	ID() string
	GlobalLock() Job
	Validate() Job
	LoadConfigs() Job
	Run(ctx context.Context) Job
	Finish() Job
	Error() error
	Project() *repo.Project
	Manifests() []string

	OnError(p int, fn func(err error, sendResultToUser func())) Job
	OnSuccess(p int, fn func(err error, sendResultToUser func())) Job
	OnFinally(p int, fn func(err error, sendResultToUser func())) Job
}

type JobInput

type JobInput struct {
	Type        websocket_pb.Type
	NamespaceId int32
	Name        string
	RepoID      int32
	GitBranch   string
	GitCommit   string
	Config      string
	Atomic      *bool
	ExtraValues []*websocket_pb.ExtraValue
	Version     *int32
	ProjectID   int32

	TimeoutSeconds int32
	User           *auth.UserInfo
	DryRun         bool

	PubSub   application.PubSub `json:"-"`
	Messager DeployMsger        `json:"-"`
}

func (*JobInput) IsNotDryRun

func (job *JobInput) IsNotDryRun() bool

func (*JobInput) Slug

func (job *JobInput) Slug() string

type JobManager

type JobManager interface {
	//	创建一个新的Job
	NewJob(input *JobInput) Job
}

func NewJobManager

func NewJobManager(
	data data.Data,
	timer timer.Timer,
	logger mlog.Logger,
	releaseInstaller ReleaseInstaller,
	repoRepo repo.RepoRepo,
	nsRepo repo.NamespaceRepo,
	projRepo repo.ProjectRepo,
	helmer repo.HelmerRepo,
	uploader uploader.Uploader,
	locker locker.Locker,
	k8sRepo repo.K8sRepo,
	eventRepo repo.EventRepo,
	pl application.PluginManger,
) JobManager

type Loader

type Loader interface {
	Load(*jobRunner) error
}

type MergeValuesLoader

type MergeValuesLoader struct{}

func (*MergeValuesLoader) Load

func (m *MergeValuesLoader) Load(j *jobRunner) error

Load imagePullSecrets 会自动注入到 imagePullSecrets 中

type MessageItem

type MessageItem struct {
	Msg  string
	Type MessageType

	Containers []*websocket_pb.Container
}

type MessageType

type MessageType uint8
const (
	MessageSuccess MessageType
	MessageError
	MessageText
)

type MockConn

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

MockConn is a mock of Conn interface.

func NewMockConn

func NewMockConn(ctrl *gomock.Controller) *MockConn

NewMockConn creates a new mock instance.

func (*MockConn) AddCancelDeployTask

func (m *MockConn) AddCancelDeployTask(arg0 string, arg1 func(error)) error

AddCancelDeployTask mocks base method.

func (*MockConn) Close

func (m *MockConn) Close() error

Close mocks base method.

func (*MockConn) CloseAndClean

func (m *MockConn) CloseAndClean(arg0 context.Context) error

CloseAndClean mocks base method.

func (*MockConn) ClosePty

func (m *MockConn) ClosePty(arg0 context.Context, arg1 string, arg2 uint32, arg3 string)

ClosePty mocks base method.

func (*MockConn) EXPECT

func (m *MockConn) EXPECT() *MockConnMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockConn) GetPtyHandler

func (m *MockConn) GetPtyHandler(arg0 string) (PtyHandler, bool)

GetPtyHandler mocks base method.

func (*MockConn) GetUser

func (m *MockConn) GetUser() *schematype.UserInfo

GetUser mocks base method.

func (*MockConn) ID

func (m *MockConn) ID() string

ID mocks base method.

func (*MockConn) NextWriter

func (m *MockConn) NextWriter(arg0 int) (io.WriteCloser, error)

NextWriter mocks base method.

func (*MockConn) PubSub

func (m *MockConn) PubSub() application.PubSub

PubSub mocks base method.

func (*MockConn) ReadMessage

func (m *MockConn) ReadMessage() (int, []byte, error)

ReadMessage mocks base method.

func (*MockConn) RemoveCancelDeployTask

func (m *MockConn) RemoveCancelDeployTask(arg0 string)

RemoveCancelDeployTask mocks base method.

func (*MockConn) RunCancelDeployTask

func (m *MockConn) RunCancelDeployTask(arg0 string) error

RunCancelDeployTask mocks base method.

func (*MockConn) SetPongHandler

func (m *MockConn) SetPongHandler(arg0 func(string) error)

SetPongHandler mocks base method.

func (*MockConn) SetPtyHandler

func (m *MockConn) SetPtyHandler(arg0 string, arg1 PtyHandler)

SetPtyHandler mocks base method.

func (*MockConn) SetReadDeadline

func (m *MockConn) SetReadDeadline(arg0 time.Time) error

SetReadDeadline mocks base method.

func (*MockConn) SetReadLimit

func (m *MockConn) SetReadLimit(arg0 int64)

SetReadLimit mocks base method.

func (*MockConn) SetUser

func (m *MockConn) SetUser(arg0 *schematype.UserInfo)

SetUser mocks base method.

func (*MockConn) SetWriteDeadline

func (m *MockConn) SetWriteDeadline(arg0 time.Time) error

SetWriteDeadline mocks base method.

func (*MockConn) UID

func (m *MockConn) UID() string

UID mocks base method.

func (*MockConn) WriteMessage

func (m *MockConn) WriteMessage(arg0 int, arg1 []byte) error

WriteMessage mocks base method.

type MockConnMockRecorder

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

MockConnMockRecorder is the mock recorder for MockConn.

func (*MockConnMockRecorder) AddCancelDeployTask

func (mr *MockConnMockRecorder) AddCancelDeployTask(arg0, arg1 any) *gomock.Call

AddCancelDeployTask indicates an expected call of AddCancelDeployTask.

func (*MockConnMockRecorder) Close

func (mr *MockConnMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockConnMockRecorder) CloseAndClean

func (mr *MockConnMockRecorder) CloseAndClean(arg0 any) *gomock.Call

CloseAndClean indicates an expected call of CloseAndClean.

func (*MockConnMockRecorder) ClosePty

func (mr *MockConnMockRecorder) ClosePty(arg0, arg1, arg2, arg3 any) *gomock.Call

ClosePty indicates an expected call of ClosePty.

func (*MockConnMockRecorder) GetPtyHandler

func (mr *MockConnMockRecorder) GetPtyHandler(arg0 any) *gomock.Call

GetPtyHandler indicates an expected call of GetPtyHandler.

func (*MockConnMockRecorder) GetUser

func (mr *MockConnMockRecorder) GetUser() *gomock.Call

GetUser indicates an expected call of GetUser.

func (*MockConnMockRecorder) ID

func (mr *MockConnMockRecorder) ID() *gomock.Call

ID indicates an expected call of ID.

func (*MockConnMockRecorder) NextWriter

func (mr *MockConnMockRecorder) NextWriter(arg0 any) *gomock.Call

NextWriter indicates an expected call of NextWriter.

func (*MockConnMockRecorder) PubSub

func (mr *MockConnMockRecorder) PubSub() *gomock.Call

PubSub indicates an expected call of PubSub.

func (*MockConnMockRecorder) ReadMessage

func (mr *MockConnMockRecorder) ReadMessage() *gomock.Call

ReadMessage indicates an expected call of ReadMessage.

func (*MockConnMockRecorder) RemoveCancelDeployTask

func (mr *MockConnMockRecorder) RemoveCancelDeployTask(arg0 any) *gomock.Call

RemoveCancelDeployTask indicates an expected call of RemoveCancelDeployTask.

func (*MockConnMockRecorder) RunCancelDeployTask

func (mr *MockConnMockRecorder) RunCancelDeployTask(arg0 any) *gomock.Call

RunCancelDeployTask indicates an expected call of RunCancelDeployTask.

func (*MockConnMockRecorder) SetPongHandler

func (mr *MockConnMockRecorder) SetPongHandler(arg0 any) *gomock.Call

SetPongHandler indicates an expected call of SetPongHandler.

func (*MockConnMockRecorder) SetPtyHandler

func (mr *MockConnMockRecorder) SetPtyHandler(arg0, arg1 any) *gomock.Call

SetPtyHandler indicates an expected call of SetPtyHandler.

func (*MockConnMockRecorder) SetReadDeadline

func (mr *MockConnMockRecorder) SetReadDeadline(arg0 any) *gomock.Call

SetReadDeadline indicates an expected call of SetReadDeadline.

func (*MockConnMockRecorder) SetReadLimit

func (mr *MockConnMockRecorder) SetReadLimit(arg0 any) *gomock.Call

SetReadLimit indicates an expected call of SetReadLimit.

func (*MockConnMockRecorder) SetUser

func (mr *MockConnMockRecorder) SetUser(arg0 any) *gomock.Call

SetUser indicates an expected call of SetUser.

func (*MockConnMockRecorder) SetWriteDeadline

func (mr *MockConnMockRecorder) SetWriteDeadline(arg0 any) *gomock.Call

SetWriteDeadline indicates an expected call of SetWriteDeadline.

func (*MockConnMockRecorder) UID

func (mr *MockConnMockRecorder) UID() *gomock.Call

UID indicates an expected call of UID.

func (*MockConnMockRecorder) WriteMessage

func (mr *MockConnMockRecorder) WriteMessage(arg0, arg1 any) *gomock.Call

WriteMessage indicates an expected call of WriteMessage.

type MockDeployMsger

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

MockDeployMsger is a mock of DeployMsger interface.

func NewMockDeployMsger

func NewMockDeployMsger(ctrl *gomock.Controller) *MockDeployMsger

NewMockDeployMsger creates a new mock instance.

func (*MockDeployMsger) Add

func (m *MockDeployMsger) Add()

Add mocks base method.

func (*MockDeployMsger) Current

func (m *MockDeployMsger) Current() int64

Current mocks base method.

func (*MockDeployMsger) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDeployMsger) SendDeployedResult

func (m *MockDeployMsger) SendDeployedResult(arg0 websocket.ResultType, arg1 string, arg2 *types.ProjectModel)

SendDeployedResult mocks base method.

func (*MockDeployMsger) SendEndError

func (m *MockDeployMsger) SendEndError(arg0 error)

SendEndError mocks base method.

func (*MockDeployMsger) SendMsg

func (m *MockDeployMsger) SendMsg(arg0 string)

SendMsg mocks base method.

func (*MockDeployMsger) SendMsgWithContainerLog

func (m *MockDeployMsger) SendMsgWithContainerLog(arg0 string, arg1 []*websocket.Container)

SendMsgWithContainerLog mocks base method.

func (*MockDeployMsger) SendProcessPercent

func (m *MockDeployMsger) SendProcessPercent(arg0 int64)

SendProcessPercent mocks base method.

func (*MockDeployMsger) SendProtoMsg

func (m *MockDeployMsger) SendProtoMsg(arg0 application.WebsocketMessage)

SendProtoMsg mocks base method.

func (*MockDeployMsger) To

func (m *MockDeployMsger) To(arg0 int64)

To mocks base method.

type MockDeployMsgerMockRecorder

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

MockDeployMsgerMockRecorder is the mock recorder for MockDeployMsger.

func (*MockDeployMsgerMockRecorder) Add

Add indicates an expected call of Add.

func (*MockDeployMsgerMockRecorder) Current

func (mr *MockDeployMsgerMockRecorder) Current() *gomock.Call

Current indicates an expected call of Current.

func (*MockDeployMsgerMockRecorder) SendDeployedResult

func (mr *MockDeployMsgerMockRecorder) SendDeployedResult(arg0, arg1, arg2 any) *gomock.Call

SendDeployedResult indicates an expected call of SendDeployedResult.

func (*MockDeployMsgerMockRecorder) SendEndError

func (mr *MockDeployMsgerMockRecorder) SendEndError(arg0 any) *gomock.Call

SendEndError indicates an expected call of SendEndError.

func (*MockDeployMsgerMockRecorder) SendMsg

func (mr *MockDeployMsgerMockRecorder) SendMsg(arg0 any) *gomock.Call

SendMsg indicates an expected call of SendMsg.

func (*MockDeployMsgerMockRecorder) SendMsgWithContainerLog

func (mr *MockDeployMsgerMockRecorder) SendMsgWithContainerLog(arg0, arg1 any) *gomock.Call

SendMsgWithContainerLog indicates an expected call of SendMsgWithContainerLog.

func (*MockDeployMsgerMockRecorder) SendProcessPercent

func (mr *MockDeployMsgerMockRecorder) SendProcessPercent(arg0 any) *gomock.Call

SendProcessPercent indicates an expected call of SendProcessPercent.

func (*MockDeployMsgerMockRecorder) SendProtoMsg

func (mr *MockDeployMsgerMockRecorder) SendProtoMsg(arg0 any) *gomock.Call

SendProtoMsg indicates an expected call of SendProtoMsg.

func (*MockDeployMsgerMockRecorder) To

To indicates an expected call of To.

type MockGorillaWs

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

MockGorillaWs is a mock of GorillaWs interface.

func NewMockGorillaWs

func NewMockGorillaWs(ctrl *gomock.Controller) *MockGorillaWs

NewMockGorillaWs creates a new mock instance.

func (*MockGorillaWs) Close

func (m *MockGorillaWs) Close() error

Close mocks base method.

func (*MockGorillaWs) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGorillaWs) NextWriter

func (m *MockGorillaWs) NextWriter(arg0 int) (io.WriteCloser, error)

NextWriter mocks base method.

func (*MockGorillaWs) ReadMessage

func (m *MockGorillaWs) ReadMessage() (int, []byte, error)

ReadMessage mocks base method.

func (*MockGorillaWs) SetPongHandler

func (m *MockGorillaWs) SetPongHandler(arg0 func(string) error)

SetPongHandler mocks base method.

func (*MockGorillaWs) SetReadDeadline

func (m *MockGorillaWs) SetReadDeadline(arg0 time.Time) error

SetReadDeadline mocks base method.

func (*MockGorillaWs) SetReadLimit

func (m *MockGorillaWs) SetReadLimit(arg0 int64)

SetReadLimit mocks base method.

func (*MockGorillaWs) SetWriteDeadline

func (m *MockGorillaWs) SetWriteDeadline(arg0 time.Time) error

SetWriteDeadline mocks base method.

func (*MockGorillaWs) WriteMessage

func (m *MockGorillaWs) WriteMessage(arg0 int, arg1 []byte) error

WriteMessage mocks base method.

type MockGorillaWsMockRecorder

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

MockGorillaWsMockRecorder is the mock recorder for MockGorillaWs.

func (*MockGorillaWsMockRecorder) Close

func (mr *MockGorillaWsMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockGorillaWsMockRecorder) NextWriter

func (mr *MockGorillaWsMockRecorder) NextWriter(arg0 any) *gomock.Call

NextWriter indicates an expected call of NextWriter.

func (*MockGorillaWsMockRecorder) ReadMessage

func (mr *MockGorillaWsMockRecorder) ReadMessage() *gomock.Call

ReadMessage indicates an expected call of ReadMessage.

func (*MockGorillaWsMockRecorder) SetPongHandler

func (mr *MockGorillaWsMockRecorder) SetPongHandler(arg0 any) *gomock.Call

SetPongHandler indicates an expected call of SetPongHandler.

func (*MockGorillaWsMockRecorder) SetReadDeadline

func (mr *MockGorillaWsMockRecorder) SetReadDeadline(arg0 any) *gomock.Call

SetReadDeadline indicates an expected call of SetReadDeadline.

func (*MockGorillaWsMockRecorder) SetReadLimit

func (mr *MockGorillaWsMockRecorder) SetReadLimit(arg0 any) *gomock.Call

SetReadLimit indicates an expected call of SetReadLimit.

func (*MockGorillaWsMockRecorder) SetWriteDeadline

func (mr *MockGorillaWsMockRecorder) SetWriteDeadline(arg0 any) *gomock.Call

SetWriteDeadline indicates an expected call of SetWriteDeadline.

func (*MockGorillaWsMockRecorder) WriteMessage

func (mr *MockGorillaWsMockRecorder) WriteMessage(arg0, arg1 any) *gomock.Call

WriteMessage indicates an expected call of WriteMessage.

type MockJob

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

MockJob is a mock of Job interface.

func NewMockJob

func NewMockJob(ctrl *gomock.Controller) *MockJob

NewMockJob creates a new mock instance.

func (*MockJob) EXPECT

func (m *MockJob) EXPECT() *MockJobMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJob) Error

func (m *MockJob) Error() error

Error mocks base method.

func (*MockJob) Finish

func (m *MockJob) Finish() Job

Finish mocks base method.

func (*MockJob) GlobalLock

func (m *MockJob) GlobalLock() Job

GlobalLock mocks base method.

func (*MockJob) ID

func (m *MockJob) ID() string

ID mocks base method.

func (*MockJob) IsNotDryRun

func (m *MockJob) IsNotDryRun() bool

IsNotDryRun mocks base method.

func (*MockJob) LoadConfigs

func (m *MockJob) LoadConfigs() Job

LoadConfigs mocks base method.

func (*MockJob) Manifests

func (m *MockJob) Manifests() []string

Manifests mocks base method.

func (*MockJob) OnError

func (m *MockJob) OnError(arg0 int, arg1 func(error, func())) Job

OnError mocks base method.

func (*MockJob) OnFinally

func (m *MockJob) OnFinally(arg0 int, arg1 func(error, func())) Job

OnFinally mocks base method.

func (*MockJob) OnSuccess

func (m *MockJob) OnSuccess(arg0 int, arg1 func(error, func())) Job

OnSuccess mocks base method.

func (*MockJob) Project

func (m *MockJob) Project() *repo.Project

Project mocks base method.

func (*MockJob) Run

func (m *MockJob) Run(arg0 context.Context) Job

Run mocks base method.

func (*MockJob) Stop

func (m *MockJob) Stop(arg0 error)

Stop mocks base method.

func (*MockJob) Validate

func (m *MockJob) Validate() Job

Validate mocks base method.

type MockJobManager

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

MockJobManager is a mock of JobManager interface.

func NewMockJobManager

func NewMockJobManager(ctrl *gomock.Controller) *MockJobManager

NewMockJobManager creates a new mock instance.

func (*MockJobManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJobManager) NewJob

func (m *MockJobManager) NewJob(arg0 *JobInput) Job

NewJob mocks base method.

type MockJobManagerMockRecorder

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

MockJobManagerMockRecorder is the mock recorder for MockJobManager.

func (*MockJobManagerMockRecorder) NewJob

func (mr *MockJobManagerMockRecorder) NewJob(arg0 any) *gomock.Call

NewJob indicates an expected call of NewJob.

type MockJobMockRecorder

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

MockJobMockRecorder is the mock recorder for MockJob.

func (*MockJobMockRecorder) Error

func (mr *MockJobMockRecorder) Error() *gomock.Call

Error indicates an expected call of Error.

func (*MockJobMockRecorder) Finish

func (mr *MockJobMockRecorder) Finish() *gomock.Call

Finish indicates an expected call of Finish.

func (*MockJobMockRecorder) GlobalLock

func (mr *MockJobMockRecorder) GlobalLock() *gomock.Call

GlobalLock indicates an expected call of GlobalLock.

func (*MockJobMockRecorder) ID

func (mr *MockJobMockRecorder) ID() *gomock.Call

ID indicates an expected call of ID.

func (*MockJobMockRecorder) IsNotDryRun

func (mr *MockJobMockRecorder) IsNotDryRun() *gomock.Call

IsNotDryRun indicates an expected call of IsNotDryRun.

func (*MockJobMockRecorder) LoadConfigs

func (mr *MockJobMockRecorder) LoadConfigs() *gomock.Call

LoadConfigs indicates an expected call of LoadConfigs.

func (*MockJobMockRecorder) Manifests

func (mr *MockJobMockRecorder) Manifests() *gomock.Call

Manifests indicates an expected call of Manifests.

func (*MockJobMockRecorder) OnError

func (mr *MockJobMockRecorder) OnError(arg0, arg1 any) *gomock.Call

OnError indicates an expected call of OnError.

func (*MockJobMockRecorder) OnFinally

func (mr *MockJobMockRecorder) OnFinally(arg0, arg1 any) *gomock.Call

OnFinally indicates an expected call of OnFinally.

func (*MockJobMockRecorder) OnSuccess

func (mr *MockJobMockRecorder) OnSuccess(arg0, arg1 any) *gomock.Call

OnSuccess indicates an expected call of OnSuccess.

func (*MockJobMockRecorder) Project

func (mr *MockJobMockRecorder) Project() *gomock.Call

Project indicates an expected call of Project.

func (*MockJobMockRecorder) Run

func (mr *MockJobMockRecorder) Run(arg0 any) *gomock.Call

Run indicates an expected call of Run.

func (*MockJobMockRecorder) Stop

func (mr *MockJobMockRecorder) Stop(arg0 any) *gomock.Call

Stop indicates an expected call of Stop.

func (*MockJobMockRecorder) Validate

func (mr *MockJobMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate.

type MockPercentable

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

MockPercentable is a mock of Percentable interface.

func NewMockPercentable

func NewMockPercentable(ctrl *gomock.Controller) *MockPercentable

NewMockPercentable creates a new mock instance.

func (*MockPercentable) Add

func (m *MockPercentable) Add()

Add mocks base method.

func (*MockPercentable) Current

func (m *MockPercentable) Current() int64

Current mocks base method.

func (*MockPercentable) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPercentable) To

func (m *MockPercentable) To(arg0 int64)

To mocks base method.

type MockPercentableMockRecorder

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

MockPercentableMockRecorder is the mock recorder for MockPercentable.

func (*MockPercentableMockRecorder) Add

Add indicates an expected call of Add.

func (*MockPercentableMockRecorder) Current

func (mr *MockPercentableMockRecorder) Current() *gomock.Call

Current indicates an expected call of Current.

func (*MockPercentableMockRecorder) To

To indicates an expected call of To.

type MockPtyHandler

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

MockPtyHandler is a mock of PtyHandler interface.

func NewMockPtyHandler

func NewMockPtyHandler(ctrl *gomock.Controller) *MockPtyHandler

NewMockPtyHandler creates a new mock instance.

func (*MockPtyHandler) Close

func (m *MockPtyHandler) Close(arg0 context.Context, arg1 string) bool

Close mocks base method.

func (*MockPtyHandler) Cols

func (m *MockPtyHandler) Cols() uint16

Cols mocks base method.

func (*MockPtyHandler) Container

func (m *MockPtyHandler) Container() *repo.Container

Container mocks base method.

func (*MockPtyHandler) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPtyHandler) IsClosed

func (m *MockPtyHandler) IsClosed() bool

IsClosed mocks base method.

func (*MockPtyHandler) Next

Next mocks base method.

func (*MockPtyHandler) Read

func (m *MockPtyHandler) Read(arg0 []byte) (int, error)

Read mocks base method.

func (*MockPtyHandler) Recorder

func (m *MockPtyHandler) Recorder() repo.Recorder

Recorder mocks base method.

func (*MockPtyHandler) ResetTerminalRowCol

func (m *MockPtyHandler) ResetTerminalRowCol(arg0 bool)

ResetTerminalRowCol mocks base method.

func (*MockPtyHandler) Resize

Resize mocks base method.

func (*MockPtyHandler) Rows

func (m *MockPtyHandler) Rows() uint16

Rows mocks base method.

func (*MockPtyHandler) Send

Send mocks base method.

func (*MockPtyHandler) SetShell

func (m *MockPtyHandler) SetShell(arg0 string)

SetShell mocks base method.

func (*MockPtyHandler) Toast

func (m *MockPtyHandler) Toast(arg0 string) error

Toast mocks base method.

func (*MockPtyHandler) Write

func (m *MockPtyHandler) Write(arg0 []byte) (int, error)

Write mocks base method.

type MockPtyHandlerMockRecorder

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

MockPtyHandlerMockRecorder is the mock recorder for MockPtyHandler.

func (*MockPtyHandlerMockRecorder) Close

func (mr *MockPtyHandlerMockRecorder) Close(arg0, arg1 any) *gomock.Call

Close indicates an expected call of Close.

func (*MockPtyHandlerMockRecorder) Cols

Cols indicates an expected call of Cols.

func (*MockPtyHandlerMockRecorder) Container

func (mr *MockPtyHandlerMockRecorder) Container() *gomock.Call

Container indicates an expected call of Container.

func (*MockPtyHandlerMockRecorder) IsClosed

func (mr *MockPtyHandlerMockRecorder) IsClosed() *gomock.Call

IsClosed indicates an expected call of IsClosed.

func (*MockPtyHandlerMockRecorder) Next

Next indicates an expected call of Next.

func (*MockPtyHandlerMockRecorder) Read

func (mr *MockPtyHandlerMockRecorder) Read(arg0 any) *gomock.Call

Read indicates an expected call of Read.

func (*MockPtyHandlerMockRecorder) Recorder

func (mr *MockPtyHandlerMockRecorder) Recorder() *gomock.Call

Recorder indicates an expected call of Recorder.

func (*MockPtyHandlerMockRecorder) ResetTerminalRowCol

func (mr *MockPtyHandlerMockRecorder) ResetTerminalRowCol(arg0 any) *gomock.Call

ResetTerminalRowCol indicates an expected call of ResetTerminalRowCol.

func (*MockPtyHandlerMockRecorder) Resize

func (mr *MockPtyHandlerMockRecorder) Resize(arg0 any) *gomock.Call

Resize indicates an expected call of Resize.

func (*MockPtyHandlerMockRecorder) Rows

Rows indicates an expected call of Rows.

func (*MockPtyHandlerMockRecorder) Send

func (mr *MockPtyHandlerMockRecorder) Send(arg0, arg1 any) *gomock.Call

Send indicates an expected call of Send.

func (*MockPtyHandlerMockRecorder) SetShell

func (mr *MockPtyHandlerMockRecorder) SetShell(arg0 any) *gomock.Call

SetShell indicates an expected call of SetShell.

func (*MockPtyHandlerMockRecorder) Toast

func (mr *MockPtyHandlerMockRecorder) Toast(arg0 any) *gomock.Call

Toast indicates an expected call of Toast.

func (*MockPtyHandlerMockRecorder) Write

func (mr *MockPtyHandlerMockRecorder) Write(arg0 any) *gomock.Call

Write indicates an expected call of Write.

type MockReleaseInstaller

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

MockReleaseInstaller is a mock of ReleaseInstaller interface.

func NewMockReleaseInstaller

func NewMockReleaseInstaller(ctrl *gomock.Controller) *MockReleaseInstaller

NewMockReleaseInstaller creates a new mock instance.

func (*MockReleaseInstaller) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockReleaseInstaller) Run

Run mocks base method.

type MockReleaseInstallerMockRecorder

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

MockReleaseInstallerMockRecorder is the mock recorder for MockReleaseInstaller.

func (*MockReleaseInstallerMockRecorder) Run

func (mr *MockReleaseInstallerMockRecorder) Run(arg0, arg1 any) *gomock.Call

Run indicates an expected call of Run.

type MockSafeWriteMessageChan

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

MockSafeWriteMessageChan is a mock of SafeWriteMessageChan interface.

func NewMockSafeWriteMessageChan

func NewMockSafeWriteMessageChan(ctrl *gomock.Controller) *MockSafeWriteMessageChan

NewMockSafeWriteMessageChan creates a new mock instance.

func (*MockSafeWriteMessageChan) Chan

func (m *MockSafeWriteMessageChan) Chan() <-chan MessageItem

Chan mocks base method.

func (*MockSafeWriteMessageChan) Close

func (m *MockSafeWriteMessageChan) Close()

Close mocks base method.

func (*MockSafeWriteMessageChan) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSafeWriteMessageChan) Send

func (m *MockSafeWriteMessageChan) Send(arg0 MessageItem)

Send mocks base method.

type MockSafeWriteMessageChanMockRecorder

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

MockSafeWriteMessageChanMockRecorder is the mock recorder for MockSafeWriteMessageChan.

func (*MockSafeWriteMessageChanMockRecorder) Chan

Chan indicates an expected call of Chan.

func (*MockSafeWriteMessageChanMockRecorder) Close

Close indicates an expected call of Close.

func (*MockSafeWriteMessageChanMockRecorder) Send

Send indicates an expected call of Send.

type MockSessionMapper

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

MockSessionMapper is a mock of SessionMapper interface.

func NewMockSessionMapper

func NewMockSessionMapper(ctrl *gomock.Controller) *MockSessionMapper

NewMockSessionMapper creates a new mock instance.

func (*MockSessionMapper) Close

func (m *MockSessionMapper) Close(arg0 context.Context, arg1 string, arg2 uint32, arg3 string)

Close mocks base method.

func (*MockSessionMapper) CloseAll

func (m *MockSessionMapper) CloseAll(arg0 context.Context)

CloseAll mocks base method.

func (*MockSessionMapper) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSessionMapper) Get

func (m *MockSessionMapper) Get(arg0 string) (PtyHandler, bool)

Get mocks base method.

func (*MockSessionMapper) Set

func (m *MockSessionMapper) Set(arg0 string, arg1 PtyHandler)

Set mocks base method.

type MockSessionMapperMockRecorder

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

MockSessionMapperMockRecorder is the mock recorder for MockSessionMapper.

func (*MockSessionMapperMockRecorder) Close

func (mr *MockSessionMapperMockRecorder) Close(arg0, arg1, arg2, arg3 any) *gomock.Call

Close indicates an expected call of Close.

func (*MockSessionMapperMockRecorder) CloseAll

func (mr *MockSessionMapperMockRecorder) CloseAll(arg0 any) *gomock.Call

CloseAll indicates an expected call of CloseAll.

func (*MockSessionMapperMockRecorder) Get

Get indicates an expected call of Get.

func (*MockSessionMapperMockRecorder) Set

func (mr *MockSessionMapperMockRecorder) Set(arg0, arg1 any) *gomock.Call

Set indicates an expected call of Set.

type MockTaskManager

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

MockTaskManager is a mock of TaskManager interface.

func NewMockTaskManager

func NewMockTaskManager(ctrl *gomock.Controller) *MockTaskManager

NewMockTaskManager creates a new mock instance.

func (*MockTaskManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTaskManager) Has

func (m *MockTaskManager) Has(arg0 string) bool

Has mocks base method.

func (*MockTaskManager) Register

func (m *MockTaskManager) Register(arg0 string, arg1 func(error)) error

Register mocks base method.

func (*MockTaskManager) Remove

func (m *MockTaskManager) Remove(arg0 string)

Remove mocks base method.

func (*MockTaskManager) Stop

func (m *MockTaskManager) Stop(arg0 string)

Stop mocks base method.

func (*MockTaskManager) StopAll

func (m *MockTaskManager) StopAll()

StopAll mocks base method.

type MockTaskManagerMockRecorder

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

MockTaskManagerMockRecorder is the mock recorder for MockTaskManager.

func (*MockTaskManagerMockRecorder) Has

func (mr *MockTaskManagerMockRecorder) Has(arg0 any) *gomock.Call

Has indicates an expected call of Has.

func (*MockTaskManagerMockRecorder) Register

func (mr *MockTaskManagerMockRecorder) Register(arg0, arg1 any) *gomock.Call

Register indicates an expected call of Register.

func (*MockTaskManagerMockRecorder) Remove

func (mr *MockTaskManagerMockRecorder) Remove(arg0 any) *gomock.Call

Remove indicates an expected call of Remove.

func (*MockTaskManagerMockRecorder) Stop

func (mr *MockTaskManagerMockRecorder) Stop(arg0 any) *gomock.Call

Stop indicates an expected call of Stop.

func (*MockTaskManagerMockRecorder) StopAll

func (mr *MockTaskManagerMockRecorder) StopAll() *gomock.Call

StopAll indicates an expected call of StopAll.

type Percentable

type Percentable interface {
	Current() int64
	Add()
	To(percent int64)
}

func NewProcessPercent

func NewProcessPercent(sender DeployMsger, s Sleeper) Percentable

type PtyHandler

type PtyHandler interface {
	io.Reader
	io.Writer
	remotecommand.TerminalSizeQueue

	Container() *repo.Container
	SetShell(string)
	Toast(string) error

	Send(ctx context.Context, message *websocket_pb.TerminalMessage) error
	Resize(remotecommand.TerminalSize) error

	Recorder() repo.Recorder

	ResetTerminalRowCol(bool)
	Rows() uint16
	Cols() uint16

	Close(context.Context, string) bool
	IsClosed() bool
}

type ReleaseInstaller

type ReleaseInstaller interface {
	Run(ctx context.Context, input *InstallInput) (*release.Release, error)
}

func NewReleaseInstaller

func NewReleaseInstaller(
	logger mlog.Logger,
	helmer repo.HelmerRepo,
	data data.Data,
	timer timer.Timer,
) ReleaseInstaller

type SafeWriteMessageChan

type SafeWriteMessageChan interface {
	Close()
	Chan() <-chan MessageItem
	Send(m MessageItem)
}

func NewSafeWriteMessageCh

func NewSafeWriteMessageCh(logger mlog.Logger, chSize int) SafeWriteMessageChan

type SessionMapper

type SessionMapper interface {
	Get(sessionId string) (PtyHandler, bool)
	Set(sessionId string, session PtyHandler)
	CloseAll(ctx context.Context)
	Close(ctx context.Context, sessionId string, status uint32, reason string)
}

func NewSessionMap

func NewSessionMap(logger mlog.Logger) SessionMapper

type Sleeper

type Sleeper interface {
	Sleep(time.Duration)
}

func NewRealSleeper

func NewRealSleeper() Sleeper

type SystemVariableLoader

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

SystemVariableLoader 系统内置变量替换, values.yaml 中的 <.var> 变量 例如:<.Branch> <.Commit> <.Pipeline> <.Host1> <.TlsSecret1>

func (*SystemVariableLoader) Add

func (v *SystemVariableLoader) Add(key, value string)

func (*SystemVariableLoader) Load

func (v *SystemVariableLoader) Load(j *jobRunner) error

type TaskManager

type TaskManager interface {
	Remove(id string)
	Has(id string) bool
	Stop(id string)
	Register(id string, fn func(error)) error
	StopAll()
}

func NewTaskManager

func NewTaskManager(logger mlog.Logger) TaskManager

type TerminalResponse

type TerminalResponse struct {
	ID string `json:"sessionID"`
}

type UserConfigLoader

type UserConfigLoader struct{}

UserConfigLoader 把用户配置字段 merge 到 values.yaml 返回的应该是一个片段 ```yaml conf:

key: value

```

func (*UserConfigLoader) Load

func (d *UserConfigLoader) Load(j *jobRunner) error

type WebsocketManager

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

func (*WebsocketManager) HandleAuthorize

func (wc *WebsocketManager) HandleAuthorize(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) HandleCloseShell

func (wc *WebsocketManager) HandleCloseShell(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) HandleJoinRoom

func (wc *WebsocketManager) HandleJoinRoom(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) HandleShellMessage

func (wc *WebsocketManager) HandleShellMessage(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) HandleStartShell

func (wc *WebsocketManager) HandleStartShell(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) HandleWsCancelDeploy

func (wc *WebsocketManager) HandleWsCancelDeploy(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) HandleWsCreateProject

func (wc *WebsocketManager) HandleWsCreateProject(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) HandleWsUpdateProject

func (wc *WebsocketManager) HandleWsUpdateProject(ctx context.Context, c Conn, t websocket_pb.Type, message []byte)

func (*WebsocketManager) Info

func (wc *WebsocketManager) Info(writer http.ResponseWriter, request *http.Request)

func (*WebsocketManager) Serve

func (wc *WebsocketManager) Serve(w http.ResponseWriter, r *http.Request)

func (*WebsocketManager) Shutdown

func (wc *WebsocketManager) Shutdown(ctx context.Context) error

func (*WebsocketManager) StartShell

func (wc *WebsocketManager) StartShell(ctx context.Context, input *websocket_pb.WsHandleExecShellInput, conn Conn) (string, error)

func (*WebsocketManager) TickClusterHealth

func (wc *WebsocketManager) TickClusterHealth(done <-chan struct{})

func (*WebsocketManager) WaitForTerminal

func (wc *WebsocketManager) WaitForTerminal(ctx context.Context, conn Conn, container *repo.Container, shell, sessionId string)

WaitForTerminal is called from apihandler.handleAttach as a goroutine Waits for the SockJS connection to be opened by the client the session to be bound in handleMyPtyHandler

type WsConn

type WsConn struct {
	GorillaWs
	// contains filtered or unexported fields
}

func (*WsConn) AddCancelDeployTask

func (c *WsConn) AddCancelDeployTask(id string, fn func(error)) error

func (*WsConn) CloseAndClean

func (c *WsConn) CloseAndClean(ctx context.Context) error

func (*WsConn) ClosePty

func (c *WsConn) ClosePty(ctx context.Context, sessionId string, status uint32, reason string)

func (*WsConn) GetPtyHandler

func (c *WsConn) GetPtyHandler(sessionID string) (PtyHandler, bool)

func (*WsConn) GetUser

func (c *WsConn) GetUser() *auth.UserInfo

func (*WsConn) ID

func (c *WsConn) ID() string

func (*WsConn) PubSub

func (c *WsConn) PubSub() application.PubSub

func (*WsConn) RemoveCancelDeployTask

func (c *WsConn) RemoveCancelDeployTask(id string)

func (*WsConn) RunCancelDeployTask

func (c *WsConn) RunCancelDeployTask(id string) error

func (*WsConn) SetPtyHandler

func (c *WsConn) SetPtyHandler(sessionID string, session PtyHandler)

func (*WsConn) SetUser

func (c *WsConn) SetUser(info *auth.UserInfo)

func (*WsConn) UID

func (c *WsConn) UID() string

type WsResponse

type WsResponse = websocket_pb.WsMetadataResponse

Jump to

Keyboard shortcuts

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