Documentation ¶
Index ¶
- Constants
- type ApplicationInterface
- type Archiver
- type AuditLogImpl
- type AuthInterface
- type Authenticator
- type AuthorizeInterface
- type Bootstrapper
- type BranchInterface
- type CacheInterface
- type CacheKeyInterface
- type Callback
- type CancelSignaler
- type Command
- type CommitInterface
- type Container
- type CopyFileToPodResult
- type CronManager
- type CronRunner
- type DBManager
- type DeployMsger
- type DispatcherInterface
- type Event
- type ExecRequestBuilder
- type ExecUrlBuilder
- type FanOutInterface
- type FanOutType
- type File
- type FileInfo
- type Helmer
- type Job
- type JwtClaims
- type K8sClient
- type ListBranchResponseInterface
- type ListProjectResponseInterface
- type Listener
- type Locker
- type LogFn
- type LoggerInterface
- type MessageItem
- type MessageType
- type Msger
- type Obj
- type OidcClaims
- type OidcConfig
- type OidcConfigItem
- type OpenIDClaims
- type Percentable
- type Picture
- type PipelineInterface
- type PluginInterface
- type PodFileCopier
- type ProcessPercentMsger
- type ProjectInterface
- type ProjectPodEventPublisher
- type ProjectPodEventSubscriber
- type PtyHandler
- type PubSub
- type RecorderInterface
- type ReleaseInstaller
- type RemoteExecutor
- type SafeWriteMessageChInterface
- type Server
- type SessionMapper
- type SignData
- type Status
- type Store
- type UploadType
- type Uploader
- type UserInfo
- type WebsocketConn
- type WebsocketMessage
- type WrapLogFn
Constants ¶
View Source
const Expired = 8 * time.Hour
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationInterface ¶
type ApplicationInterface interface { // IsDebug bool. IsDebug() bool // K8sClient return *K8sClient K8sClient() *K8sClient // SetK8sClient set *K8sClient SetK8sClient(*K8sClient) // Auth return AuthInterface. Auth() AuthInterface // SetAuth set AuthInterface. SetAuth(AuthInterface) // SetLocalUploader set local Uploader SetLocalUploader(Uploader) // LocalUploader get local Uploader LocalUploader() Uploader // SetUploader setter SetUploader(Uploader) // Uploader getter Uploader() Uploader // Bootstrap boots all. Bootstrap() error // Config app configuration. Config() *config.Config // DBManager db. DBManager() DBManager // DB instance. DB() *gorm.DB // Oidc sso cfg Oidc() OidcConfig // SetOidc setter SetOidc(OidcConfig) // AddServer add boot server AddServer(Server) // Run servers. Run() context.Context // Shutdown all servers. Shutdown() Done() <-chan struct{} BeforeServerRunHooks(Callback) RegisterBeforeShutdownFunc(Callback) RegisterAfterShutdownFunc(Callback) EventDispatcher() DispatcherInterface SetEventDispatcher(DispatcherInterface) SetPlugins(map[string]PluginInterface) GetPlugins() map[string]PluginInterface GetPluginByName(string) PluginInterface Singleflight() *singleflight.Group SetCache(CacheInterface) Cache() CacheInterface CacheLock() Locker SetCacheLock(Locker) SetTracer(trace.Tracer) GetTracer() trace.Tracer SetCronManager(CronManager) CronManager() CronManager }
ApplicationInterface app.
type Archiver ¶
type Archiver interface { Archive(sources []string, destination string) error Open(path string) (io.ReadCloser, error) Remove(path string) error }
Archiver 不是很合理,但暂时这样
type AuditLogImpl ¶ added in v4.19.7
type AuthInterface ¶
type AuthInterface interface { Authenticator Sign(UserInfo) (*SignData, error) }
type Authenticator ¶
type AuthorizeInterface ¶
type Bootstrapper ¶
type Bootstrapper interface { // Bootstrap when app start. Bootstrap(ApplicationInterface) error // Tags boot tags. Tags() []string }
Bootstrapper boots.
type BranchInterface ¶
type CacheInterface ¶
type CacheInterface interface { SetWithTTL(key CacheKeyInterface, value []byte, seconds int) error Remember(key CacheKeyInterface, seconds int, fn func() ([]byte, error)) ([]byte, error) Clear(key CacheKeyInterface) error Store() Store }
type CacheKeyInterface ¶
type Callback ¶
type Callback func(ApplicationInterface)
type CancelSignaler ¶
type Command ¶
type Command interface { //Name 名称 Name() string //Func 方法 Func() func() //Expression cron 表达式: "* * * * * *" Expression() string //Cron 自定义 expression "* * * * * *" Cron(expression string) Command //EverySecond 每 1 秒 EverySecond() Command //EveryTwoSeconds 每 2 秒 EveryTwoSeconds() Command //EveryThreeSeconds 每 3 秒 EveryThreeSeconds() Command //EveryFourSeconds 每 4 秒 EveryFourSeconds() Command //EveryFiveSeconds 每 5 秒 EveryFiveSeconds() Command //EveryTenSeconds 每 10 秒 EveryTenSeconds() Command //EveryFifteenSeconds 每 15 秒 EveryFifteenSeconds() Command //EveryThirtySeconds 每 30 秒 EveryThirtySeconds() Command //EveryMinute 每分钟 EveryMinute() Command //EveryTwoMinutes 每 2 分钟 EveryTwoMinutes() Command //EveryThreeMinutes 每 3 分钟 EveryThreeMinutes() Command //EveryFourMinutes 每 4 分钟 EveryFourMinutes() Command //EveryFiveMinutes 每 5 分钟 EveryFiveMinutes() Command //EveryTenMinutes 每 10 分钟 EveryTenMinutes() Command //EveryFifteenMinutes 每 15 分钟 EveryFifteenMinutes() Command //EveryThirtyMinutes 每 30 分钟 EveryThirtyMinutes() Command //Hourly 每小时 Hourly() Command //HourlyAt 每小时的第几分钟 HourlyAt([]int) Command //EveryTwoHours 每 2 小时 EveryTwoHours() Command //EveryThreeHours 每 3 小时 EveryThreeHours() Command //EveryFourHours 每 4 小时 EveryFourHours() Command //EverySixHours 每 6 小时 EverySixHours() Command //Daily 每天 Daily() Command //DailyAt 每天几点(time: "2:00") DailyAt(time string) Command //At alias of DailyAt At(string) Command //Weekdays 工作日 1-5 Weekdays() Command //Weekends 周末 Weekends() Command //Mondays 周一 Mondays() Command //Tuesdays 周二 Tuesdays() Command //Wednesdays 周三 Wednesdays() Command //Thursdays 周四 Thursdays() Command //Fridays 周五 Fridays() Command //Saturdays 周六 Saturdays() Command //Sundays 周日 Sundays() Command //Weekly 每周一 Weekly() Command //WeeklyOn 周日几(day) 几点(time: "0:0") WeeklyOn(day int, time string) Command Monthly() Command // MonthlyOn dayOfMonth: 1, time: "0:0" MonthlyOn(dayOfMonth string, time string) Command //LastDayOfMonth 每月最后一天 LastDayOfMonth(time string) Command // Quarterly 每季度执行 Quarterly() Command // QuarterlyOn 每季度的第几天,几点(time: "0:0")执行 QuarterlyOn(dayOfQuarter string, time string) Command //Yearly 每年 Yearly() Command //YearlyOn 每年几月(month) 哪天(dayOfMonth) 时间(time: "0:0") YearlyOn(month string, dayOfMonth string, time string) Command //Days 天(0-6: 周日-周六) Days([]int) Command }
type CommitInterface ¶
type CommitInterface interface { GetID() string GetShortID() string GetTitle() string GetCommittedDate() *time.Time GetAuthorName() string GetAuthorEmail() string GetCommitterName() string GetCommitterEmail() string GetCreatedAt() *time.Time GetMessage() string GetProjectID() int64 GetWebURL() string }
type CopyFileToPodResult ¶
type CronManager ¶
type CronRunner ¶
type DeployMsger ¶
type DeployMsger interface { Msger ProcessPercentMsger SendDeployedResult(t websocket.ResultType, msg string, p *types.ProjectModel) }
type DispatcherInterface ¶
type DispatcherInterface interface { // Listen Register an event listener with the dispatcher. Listen(Event, Listener) // HasListeners Determine if a given event has listeners. HasListeners(Event) bool // Dispatch Fire an event and call the listeners. Dispatch(Event, any) error // Forget Remove a set of listeners from the dispatcher. Forget(Event) // GetListeners get all listeners by event. GetListeners(Event) []Listener }
type ExecRequestBuilder ¶
type ExecRequestBuilder interface {
BuildExecRequest(namespace, pod string, peo *corev1.PodExecOptions) ExecUrlBuilder
}
type ExecUrlBuilder ¶
type FanOutInterface ¶
type Helmer ¶
type Helmer interface { UpgradeOrInstall(ctx context.Context, releaseName, namespace string, ch *chart.Chart, valueOpts *values.Options, fn WrapLogFn, wait bool, timeoutSeconds int64, dryRun bool, desc string) (*release.Release, error) Rollback(releaseName, namespace string, wait bool, log LogFn, dryRun bool) error Uninstall(releaseName, namespace string, log LogFn) error ReleaseStatus(releaseName, namespace string) types.Deploy PackageChart(path string, destDir string) (string, error) }
type Job ¶
type Job interface { Stop(error) IsNotDryRun() bool ID() string GlobalLock() Job Validate() Job LoadConfigs() Job Run() Job Finish() Job Error() error 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 JwtClaims ¶
type JwtClaims struct { *jwt.StandardClaims UserInfo UserInfo `json:"user_info"` }
type K8sClient ¶
type K8sClient struct { Client kubernetes.Interface MetricsClient versioned.Interface RestConfig *restclient.Config PodInformer cache.SharedIndexInformer PodLister v1.PodLister SecretInformer cache.SharedIndexInformer SecretLister v1.SecretLister ReplicaSetLister appsv1.ReplicaSetLister ServiceLister v1.ServiceLister IngressLister networkingv1.IngressLister EventInformer cache.SharedIndexInformer EventFanOut FanOutInterface[*eventsv1.Event] PodFanOut FanOutInterface[*corev1.Pod] }
type ListBranchResponseInterface ¶
type ListBranchResponseInterface interface { GetItems() []BranchInterface // contains filtered or unexported methods }
type ListProjectResponseInterface ¶
type ListProjectResponseInterface interface { GetItems() []ProjectInterface // contains filtered or unexported methods }
type LoggerInterface ¶
type MessageItem ¶
type MessageItem struct { Msg string Type MessageType Containers []*types.Container }
type MessageType ¶
type MessageType uint8
const ( MessageSuccess MessageType MessageError MessageText )
type Obj ¶
type Obj[T runtime.Object] interface { Type() FanOutType Old() T Current() T }
type OidcClaims ¶
type OidcClaims struct { LogoutUrl string `json:"logout_url"` OpenIDClaims }
func (OidcClaims) ToUserInfo ¶
func (c OidcClaims) ToUserInfo() UserInfo
type OidcConfig ¶
type OidcConfig map[string]OidcConfigItem
type OidcConfigItem ¶
type OpenIDClaims ¶
type OpenIDClaims struct { Sub string `json:"sub"` Name string `json:"name"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` MiddleName string `json:"middle_name"` Nickname string `json:"nickname"` PreferredUsername string `json:"preferred_username"` Profile string `json:"profile"` Picture string `json:"picture"` Website string `json:"website"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Gender string `json:"gender"` Birthdate string `json:"birthdate"` Zoneinfo string `json:"zoneinfo"` Locale string `json:"locale"` PhoneNumber string `json:"phone_number"` PhoneNumberVerified bool `json:"phone_number_verified"` Address map[string]any `json:"address"` UpdatedAt int `json:"updated_at"` }
type Percentable ¶
type PipelineInterface ¶
type PluginInterface ¶
type PodFileCopier ¶
type PodFileCopier interface {
Copy(namespace, pod, container, fpath, targetContainerDir string, clientSet kubernetes.Interface, config *restclient.Config) (*CopyFileToPodResult, error)
}
type ProcessPercentMsger ¶
type ProcessPercentMsger interface {
SendProcessPercent(int64)
}
type ProjectInterface ¶
type PtyHandler ¶
type PtyHandler interface { io.Reader io.Writer remotecommand.TerminalSizeQueue Container() Container SetShell(string) Toast(string) error Send(*websocket.TerminalMessage) error Resize(remotecommand.TerminalSize) error Recorder() RecorderInterface ResetTerminalRowCol(bool) Rows() uint16 Cols() uint16 Close(string) bool IsClosed() bool }
PtyHandler is what remotecommand expects from a pty
type PubSub ¶
type PubSub interface { ProjectPodEventSubscriber ProjectPodEventPublisher Info() any Uid() string ID() string ToSelf(WebsocketMessage) error ToAll(WebsocketMessage) error ToOthers(WebsocketMessage) error Subscribe() <-chan []byte Close() error }
type RecorderInterface ¶
type ReleaseInstaller ¶
type RemoteExecutor ¶
type RemoteExecutor interface { WithMethod(method string) RemoteExecutor WithContainer(namespace, pod, container string) RemoteExecutor WithCommand(cmd []string) RemoteExecutor Execute(ctx context.Context, clientSet kubernetes.Interface, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error }
type SafeWriteMessageChInterface ¶
type SafeWriteMessageChInterface interface { Close() Chan() <-chan MessageItem Send(m MessageItem) }
type Server ¶
type Server interface { // Run server. Run(context.Context) error // Shutdown server. Shutdown(context.Context) error }
Server define booting server.
type SessionMapper ¶
type SessionMapper interface { Send(message *websocket.TerminalMessage) Get(sessionId string) (PtyHandler, bool) Set(sessionId string, session PtyHandler) CloseAll() Close(sessionId string, status uint32, reason string) }
type Uploader ¶
type Uploader interface { Disk(string) Uploader Type() UploadType DeleteDir(dir string) error DirSize() (int64, error) Delete(path string) error Exists(path string) bool MkDir(path string, recursive bool) error AbsolutePath(path string) string Put(path string, content io.Reader) (FileInfo, error) Read(string string) (io.ReadCloser, error) Stat(file string) (FileInfo, error) AllDirectoryFiles(dir string) ([]FileInfo, error) NewFile(path string) (File, error) RemoveEmptyDir() error UnWrap() Uploader }
type UserInfo ¶
type WebsocketConn ¶
type WebsocketConn interface { Close() error 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) }
type WebsocketMessage ¶
Click to show internal directories.
Click to hide internal directories.