Documentation ¶
Index ¶
- func IsRolesAllow(stage string, roles []interface{}) bool
- func NewShellRole(args *RoleArgs) error
- type CopyRole
- type DockerRole
- type FetchRole
- type GitRepo
- type Hook
- type IncludeRole
- type K8sBasic
- type K8sRole
- type RoleArgs
- type RoleFactory
- type RoleLC
- type RolePlugin
- type RoleType
- type ScriptRole
- type ShellRole
- type SystemdRole
- type TemplateRole
- type UserRole
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CopyRole ¶
type CopyRole struct { RoleLC // contains filtered or unexported fields }
type DockerRole ¶
type DockerRole struct { RoleLC // contains filtered or unexported fields }
func (*DockerRole) Init ¶
func (r *DockerRole) Init(args *RoleArgs) error
准备数据 @Param stage 阶段标记 @Param user 远端执行用户 @Param host 目标主机 @Param vars 动态参数 @Param configs 执行模块内容 @Param msg 消息结构体
func (*DockerRole) Run ¶
func (r *DockerRole) Run() error
type FetchRole ¶
type FetchRole struct { RoleLC // contains filtered or unexported fields }
远程文件下载struct
type IncludeRole ¶
type IncludeRole struct { RoleLC // contains filtered or unexported fields }
func (*IncludeRole) After ¶
func (i *IncludeRole) After()
type K8sBasic ¶
type K8sBasic struct {
// contains filtered or unexported fields
}
对标pod内containerd信息
type RoleArgs ¶
type RoleArgs struct {
// contains filtered or unexported fields
}
@Params stage 当前stage @Params user 远端目标机执行账户 @Params host 执行目标机 @Params vars 公共环境变量 @Params configs 执行playbook @Params currentConfig 当前config @Params msg pipeline消息传递 TODO: context替换,传递上下文 @Params hook 自定义config执行完的钩子函数 @Params isTerminial 是否terminial执行shell
func NewRoleArgs ¶
func (*RoleArgs) AddCountByName ¶
type RoleFactory ¶
type RoleFactory struct{}
role插件工厂对象,实现Role接口
func (*RoleFactory) Create ¶
func (r *RoleFactory) Create(conf RoleType) (RolePlugin, error)
读取配置,通过反射机制进行对象实例化
type RolePlugin ¶
type RolePlugin interface { // 初始化对象 Init(*RoleArgs) error // 环境准备 Pre() // 执行前 Before() error // 执行中 // 返回是否执行信号 Run() error // 执行后 After() // 是否执行hook IsHook() bool // 钩子函数 Hooks() error }
执行过程生命周期接口 Role LifeCycle
type RoleType ¶
type RoleType string
const ( CopyType RoleType = "copy" FetchType RoleType = "fetch" DockerType RoleType = "image" K8sType RoleType = "k8s" ShellType RoleType = "shell" SwarmType RoleType = "swarm" TemplateType RoleType = "template" IncludeType RoleType = "include" SystemdType RoleType = "systemd" UserType RoleType = "user" ScriptType RoleType = "script" )
func ParseRoleType ¶
自动匹配roleNames对象和目标对象的匹配度 实现yaml即不用新增type字段又能自动匹配Role插件
type ScriptRole ¶
type ScriptRole struct { RoleLC // contains filtered or unexported fields }
func (*ScriptRole) Init ¶
func (c *ScriptRole) Init(args *RoleArgs) error
准备数据 @Param stage 阶段标记 @Param user 远端执行用户 @Param host 目标主机 @Param vars 动态参数 @Param configs 执行模块内容 @Param msg 消息结构体
func (*ScriptRole) Run ¶
func (c *ScriptRole) Run() error
1. copy file 2. exec script 3. delete script
type ShellRole ¶
type ShellRole struct { RoleLC // contains filtered or unexported fields }
type SystemdRole ¶
type SystemdRole struct { RoleLC // contains filtered or unexported fields }
func (*SystemdRole) Init ¶
func (s *SystemdRole) Init(args *RoleArgs) error
准备数据 @Param stage 阶段标记 @Param user 远端执行用户 @Param host 目标主机 @Param vars 动态参数 @Param configs 执行模块内容 @Param msg 消息结构体
func (*SystemdRole) Run ¶
func (s *SystemdRole) Run() error
type TemplateRole ¶
type TemplateRole struct { RoleLC // contains filtered or unexported fields }
func (*TemplateRole) Init ¶
func (r *TemplateRole) Init(args *RoleArgs) error
准备数据 @Param stage 阶段标记 @Param user 远端执行用户 @Param host 目标主机 @Param vars 动态参数 @Param configs 执行模块内容 @Param msg 消息结构体