本篇内容主要讲解“kubernetes/kubeadm工作流Runner怎么用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“kubernetes/kubeadm工作流Runner怎么用”吧!
// phaseRunner provides a wrapper to a Phase with the addition of a set
// of contextual information derived by the workflow managed by the Runner.
// TODO: If we ever decide to get more sophisticated we can swap this type with a well defined dag or tree library.
type phaseRunner struct {
Phase
parent *phaseRunner // 父phaseRunner
level int // phase在工作流中的层级
// selfPath contains all the elements of the path that identify the phase into
// the workflow managed by the Runner.
selfPath []string
generatedName string // phase包含各级phase的全名
use string // 使用帮助信息,相当于工作流中的相对路径
}
type RunnerOptions struct {
FilterPhases []string // 需要执行的phase列表,如果列表为空,则全部执行
SkipPhases []string // 需要屏蔽的phase,如果列表为空,则不屏蔽
}
// Runner implements management of composable kubeadm workflows.
type Runner struct {
Options RunnerOptions // Runner执行选项
Phases []Phase // Runner管理的工作流中所有的phase
runDataInitializer func(*cobra.Command, []string) (RunData, error) // 构造工作流中所有phase共享数据的回调函数
runData RunData // 工作流中所有phase共享的数据
runCmd *cobra.Command // 触发Runner的命令
// cmdAdditionalFlags holds additional, shared flags that could be added to the subcommands generated
// for phases. Flags could be inherited from the parent command too or added directly to each phase
cmdAdditionalFlags *pflag.FlagSet
phaseRunners []*phaseRunner // 工作流的上下文信息
}
工作流workflow
包对外提供一个创建空Runner的方法NewRunner()
,该空Runner实际上也是一个空的工作流,它不包括任何phase
,后续可以使用添加phase
的接口来增加phase
。
func NewRunner() *Runner {
return &Runner{
Phases: []Phase{},
}
}
当工作流创建完成后,就可以使用func (e *Runner) AppendPhase(t Phase)
接口来添加phase
了。
func (e *Runner) AppendPhase(t Phase) {
e.Phases = append(e.Phases, t)
}
此时添加phase,只是简单的把phase追加到runner的切片列表中,phase的执行顺序与加入顺序一致。
到此,相信大家对“kubernetes/kubeadm工作流Runner怎么用”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/renhc/blog/3062010