Documentation
¶
Index ¶
- Constants
- Variables
- func AddI18nMessages(msgs I18nMessages) error
- func GetExtraData(ctx context.Context) []byte
- func GetLocalizer(lang Lang) *i18n.Localizer
- func GetOperationID(ctx context.Context) string
- func GetRepoMirror(ctx context.Context) string
- func GetRetry(ctx context.Context) bool
- func GetStepID(ctx context.Context) string
- func PropsMax(i int) *int
- func Register(kv string, p Interface) error
- func RegisterAgentStep(kv string, p StepRunnable) error
- func RegisterTemplate(kv string, t TemplateRender) error
- func WithExtraData(ctx context.Context, data []byte) context.Context
- func WithExtraMetadata(ctx context.Context, metadata ExtraMetadata) context.Context
- func WithOperationID(ctx context.Context, opID string) context.Context
- func WithOplog(ctx context.Context, ol OperationLogFile) context.Context
- func WithRepoMirror(ctx context.Context, mirror string) context.Context
- func WithRetry(ctx context.Context, retry bool) context.Context
- func WithStepID(ctx context.Context, stepID string) context.Context
- type ExtraMetadata
- func (e ExtraMetadata) GetAllNodeIDs() []string
- func (e ExtraMetadata) GetAllNodes() (nodes NodeList)
- func (e ExtraMetadata) GetAvailableMasterNodes() []string
- func (e ExtraMetadata) GetMasterHostname(id string) string
- func (e ExtraMetadata) GetMasterNodeIDs() []string
- func (e ExtraMetadata) GetMasterNodeIP() map[string]string
- func (e ExtraMetadata) GetWorkerHostname(id string) string
- func (e ExtraMetadata) GetWorkerNodeIDs() []string
- func (e ExtraMetadata) GetWorkerNodeIP() map[string]string
- func (e ExtraMetadata) IsAllMasterAvailable() bool
- type FuncIndex
- type HealthCheck
- type I18nMessage
- type I18nMessages
- type Interface
- type JSON
- type JSONSchemaProps
- type Lang
- type Meta
- type Node
- type NodeList
- type ObjectMeta
- type OfflinePackages
- type OperationLogFile
- type Options
- type Props
- type Runnable
- type StepRunnable
- type TemplateRender
Constants ¶
View Source
const ( RegisterFormat = "%s/%s" TypeStep = "step" TypeTemplate = "template" TypeRegistryConfigure = "registryConfigure" )
View Source
const ( JSONSchemaTypeObject = "object" JSONSchemaTypeBool = "boolean" JSONSchemaTypeString = "string" JSONSchemaTypeArray = "array" JSONSchemaTypeInt = "number" )
View Source
const ( InternalCategoryNodes = "nodes" InternalCategoryKubernetes = "kubernetes" InternalCategoryStorage = "storage" InternalCategoryPAAS = "PAAS" )
View Source
const ( RegisterTemplateKeyFormat = "%s/%s/%s" RegisterStepKeyFormat = "%s/%s/%s" )
View Source
const OfflinePackagesKeyFormat = "%s-%s-%s"
Variables ¶
View Source
var ( ErrExist = errors.New("component already exist") ErrKeyFormat = errors.New("component key must be name/version") )
View Source
var ( ErrStepExist = errors.New("component already exist") ErrStepKeyFormat = errors.New("component key must be name/version") )
View Source
var ( ErrTemplateExist = errors.New("component template already exist") ErrTemplateKeyFormat = errors.New("component template key must be name/version/templateName") )
Functions ¶
func AddI18nMessages ¶
func AddI18nMessages(msgs I18nMessages) error
func GetExtraData ¶
func GetLocalizer ¶
func GetOperationID ¶
func GetRepoMirror ¶
func RegisterAgentStep ¶
func RegisterAgentStep(kv string, p StepRunnable) error
RegisterAgentStep KV must format at componentName/version/stepName
func RegisterTemplate ¶
func RegisterTemplate(kv string, t TemplateRender) error
func WithExtraMetadata ¶
func WithExtraMetadata(ctx context.Context, metadata ExtraMetadata) context.Context
Types ¶
type ExtraMetadata ¶
type ExtraMetadata struct { Masters NodeList Workers NodeList Offline bool LocalRegistry string CRI string ClusterName string KubeVersion string OperationType string KubeletDataDir string ControlPlaneStatus []v1.ControlPlaneHealth Addons []v1.Addon CNI string CNINamespace string }
func GetExtraMetadata ¶
func GetExtraMetadata(ctx context.Context) ExtraMetadata
func (ExtraMetadata) GetAllNodeIDs ¶
func (e ExtraMetadata) GetAllNodeIDs() []string
func (ExtraMetadata) GetAllNodes ¶
func (e ExtraMetadata) GetAllNodes() (nodes NodeList)
func (ExtraMetadata) GetAvailableMasterNodes ¶ added in v1.3.1
func (e ExtraMetadata) GetAvailableMasterNodes() []string
func (ExtraMetadata) GetMasterHostname ¶
func (e ExtraMetadata) GetMasterHostname(id string) string
func (ExtraMetadata) GetMasterNodeIDs ¶
func (e ExtraMetadata) GetMasterNodeIDs() []string
GetMasterNodeIDs Deprecated. Use GetAvailableMasterNodes() instead
func (ExtraMetadata) GetMasterNodeIP ¶
func (e ExtraMetadata) GetMasterNodeIP() map[string]string
func (ExtraMetadata) GetWorkerHostname ¶
func (e ExtraMetadata) GetWorkerHostname(id string) string
func (ExtraMetadata) GetWorkerNodeIDs ¶
func (e ExtraMetadata) GetWorkerNodeIDs() []string
func (ExtraMetadata) GetWorkerNodeIP ¶
func (e ExtraMetadata) GetWorkerNodeIP() map[string]string
func (ExtraMetadata) IsAllMasterAvailable ¶ added in v1.3.1
func (e ExtraMetadata) IsAllMasterAvailable() bool
type HealthCheck ¶
type I18nMessage ¶
type I18nMessages ¶
type I18nMessages []I18nMessage
type Interface ¶
type Interface interface { ObjectMeta HealthCheck GetInstanceName() string // Object metadata GetComponentMeta(lang Lang) Meta // Component method GetDependence() []string RequireExtraCluster() []string CompleteWithExtraCluster(extra map[string]ExtraMetadata) error Validate() error InitSteps(ctx context.Context) error GetInstallSteps() []v1.Step GetUninstallSteps() []v1.Step GetUpgradeSteps() []v1.Step GetImageRepoMirror() string }
type JSON ¶
type JSON interface{}
JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.
type JSONSchemaProps ¶
type JSONSchemaProps struct { Title string `json:"title"` Properties map[string]JSONSchemaProps `json:"properties,omitempty"` Type string `json:"type,omitempty"` Mask bool `json:"mask,omitempty"` Default JSON `json:"default,omitempty"` Description string `json:"description,omitempty"` Required []string `json:"required,omitempty"` Items *JSONSchemaProps `json:"items,omitempty"` Enum []JSON `json:"enum,omitempty"` EnumNames []string `json:"enumNames,omitempty"` Dependencies []string `json:"dependencies,omitempty"` Priority int `json:"priority,omitempty"` Props *Props `json:"props,omitempty"` }
type Meta ¶
type Meta struct { Title string `json:"title"` Description string `json:"description"` Icon string `json:"icon"` Unique bool `json:"unique"` Template bool `json:"template"` Category string `json:"category"` Deprecated bool `json:"deprecated"` Name string `json:"name"` Version string `json:"version"` Dependence []string `json:"dependence"` TimeoutSeconds int `json:"timeoutSeconds"` Priority int `json:"priority,omitempty"` Schema *JSONSchemaProps `json:"schema"` }
type ObjectMeta ¶
type ObjectMeta interface {
NewInstance() ObjectMeta
}
type OfflinePackages ¶
OfflinePackages key must format as version-osVendor-osArch value is packages eg for docker 19.03, docker-19.03-centos7-x86_64
type OperationLogFile ¶
type OperationLogFile interface { GetRootDir() string CreateOperationDir(opID string) error GetOperationDir(opID string) (path string, err error) CreateStepLogFile(opID, stepID string) (file *os.File, err error) GetStepLogFile(opID, stepID string) (path string, err error) GetStepLogContent(opID, stepID string, offset int64, length int) (content []byte, deliverySize int64, logSize int64, err error) CreateStepLogFileAndAppend(opID, stepID string, data []byte) error TruncateStepLogFile(opID, stepID string) error }
func GetOplog ¶
func GetOplog(ctx context.Context) OperationLogFile
type StepRunnable ¶
type StepRunnable interface { Runnable ObjectMeta }
func LoadAgentStep ¶
func LoadAgentStep(kv string) (StepRunnable, bool)
type TemplateRender ¶
type TemplateRender interface { Render(ctx context.Context, opts Options) error ObjectMeta }
func LoadTemplate ¶
func LoadTemplate(kv string) (TemplateRender, bool)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.