Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the Phase data structure of kubernetes and kubeadm workflows

Shulou Source: shulou.com Published: 2022-05-31 18:02:50 10月05日 Update

What is the Phase data structure of kubernetes and kubeadm workflow? in order to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

A Phase is a stage or step in a workflow. To create a Phase, you only need to instantiate a variable of type Phase struct.

Phase defines a step and the actions to be taken under that step.

Phase number knot structure

The Phase data structure definition is located in kubernetes\ cmd\ kubeadm\ app\ cmd\ phases\ workflow\ phase.go.

Type Phase struct {Name string / / phase name, phase under the same workflow or child phase name under the same parent phase must also have a unique alias of Aliases [] string / / phase, and can have multiple Short string / / phase brief introductions Long string / / phase introduction Example string / / use examples Similar to help information Hidden bool / / whether the phase needs to hide Phases [] Phase / / sub-phase in the workflow help information, and arrange / / RunAllSiblings allows to assign to a phase the responsibility to / / run all the sibling phases / / Nb in order. The callback function RunIf func (data RunData) (bool, error) / / of phase marked as RunAllSiblings can not have Run functions RunAllSiblings bool Run func (data RunData) error / / phase detects the callback function, which is called before Run to decide whether to continue calling Run. If RunIf returns (true,nil), Run will be executed. Otherwise, do not execute / / InheritFlags defines the list of flags that the cobra command generated for this phase should Inherit / / from local flags defined in the parent command / or additional flags defined in the phase runner. / / If the values is not set or empty, no flags will be assigned to the command / / Nb. Global flags are automatically inherited by nested cobra command InheritFlags [] string / / LocalFlags defines the list of flags that should be assigned to the cobra command generated / / for this phase. / / Nb. If two or phases have the same local flags, please consider using local flags in the parent command / / or additional flags defined in the phase runner. LocalFlags * pflag.FlagSet / / ArgsValidator defines the positional arg function to be used for validating args for this phase / / If not set a phase will adopt the args of the top level command. ArgsValidator cobra.PositionalArgs} external method

Phase provides only one method for adding sub-Phase, which means that once it is created, its properties are generally not modified, and you can add sub-Phase dynamically.

Func (t * Phase) AppendPhase (phase Phase) {t.Phases = append (t.Phases, phase)} main points summary phase can contain sub-phase

Through the phase method func (t * Phase) AppendPhase (phase Phase), you can add a phase to another phase, thus becoming its child phase.

A sub-phase of phase is stored in a slice of Phase.Phases and is arranged in the order in which it is added, which is the order in which the sub-phase is executed.

A child phase of phase executes immediately after its parent phase executes.

The answer to the question about the Phase data structure of kubernetes and kubeadm workflow is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Tags: Workflow structure work method data data structure step question help information function name more order solution easy orderly short simple content Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information MariaDB Shulou Technology Shulou Tech Info