genie

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubeGenie

type KubeGenie struct {
	Masters []Node
	Workers []Node
	// contains filtered or unexported fields
}

func NewKubeGenie

func NewKubeGenie(config *v1alpha1.InitConfiguration) *KubeGenie

func (*KubeGenie) InitCalico

func (genie *KubeGenie) InitCalico()

func (*KubeGenie) InitCluster

func (genie *KubeGenie) InitCluster()

func (*KubeGenie) InitKubeadmConfig

func (genie *KubeGenie) InitKubeadmConfig()

func (*KubeGenie) InitKubelet

func (genie *KubeGenie) InitKubelet()

func (*KubeGenie) InitMaster0

func (genie *KubeGenie) InitMaster0()

func (*KubeGenie) InitMasters

func (genie *KubeGenie) InitMasters()

func (*KubeGenie) InitOS

func (genie *KubeGenie) InitOS()

func (*KubeGenie) InitPackage

func (genie *KubeGenie) InitPackage()

func (*KubeGenie) InstallDocker

func (genie *KubeGenie) InstallDocker()

func (*KubeGenie) JoinMasters

func (genie *KubeGenie) JoinMasters()

func (*KubeGenie) JoinWorkers

func (genie *KubeGenie) JoinWorkers()

type Node

type Node struct {
	Host       string
	SSHCommand *sshutil.SSHCommand
}

type Phase

type Phase struct {
	// name of the phase.
	// Phase name should be unique among peer phases (phases belonging to
	// the same workflow or phases belonging to the same parent phase).
	Name string

	// Aliases returns the aliases for the phase.
	Aliases []string

	// Short description of the phase.
	Short string

	// Long returns the long description of the phase.
	Long string

	// Example returns the example for the phase.
	Example string

	// Hidden define if the phase should be hidden in the workflow help.
	// e.g. PrintFilesIfDryRunning phase in the kubeadm init workflow is candidate for being hidden to the users
	Hidden bool

	// Phases defines a nested, ordered sequence of phases.
	Phases []Phase

	// RunAllSiblings allows to assign to a phase the responsibility to
	// run all the sibling phases
	// Nb. phase marked as RunAllSiblings can not have Run functions
	RunAllSiblings bool

	// Run defines a function implementing the phase action.
	// It is recommended to implent type assertion, e.g. using golang type switch,
	// for validating the RunData type.
	Run func(genie *KubeGenie) error

	// RunIf define a function that implements a condition that should be checked
	// before executing the phase action.
	// If this function return nil, the phase action is always executed.
	RunIf func(genie *KubeGenie) (bool, error)

	// 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
}

Phase provides an implementation of a workflow phase that allows creation of new phases by simply instantiating a variable of this type.

func NewInitCalicoPhase

func NewInitCalicoPhase() Phase

func NewInitClusterPhase

func NewInitClusterPhase() Phase

func NewInitKubeadmConfigPhase

func NewInitKubeadmConfigPhase() Phase

func NewInitKubeletPhase

func NewInitKubeletPhase() Phase

func NewInitMaster0Phase

func NewInitMaster0Phase() Phase

func NewInitMastersPhase

func NewInitMastersPhase() Phase

func NewInitOSPhase

func NewInitOSPhase() Phase

func NewInitPackagePhase

func NewInitPackagePhase() Phase

func NewInstallDockerPhase

func NewInstallDockerPhase() Phase

func NewJoinMastersPhase

func NewJoinMastersPhase() Phase

func NewJoinWorkersPhase

func NewJoinWorkersPhase() Phase

func (*Phase) AppendPhase

func (t *Phase) AppendPhase(phase Phase)

AppendPhase adds the given phase to the nested, ordered sequence of phases.

type Runner

type Runner struct {
	// Options that regulate the runner behavior.
	Options RunnerOptions

	// Phases composing the workflow to be managed by the runner.
	Phases []Phase
	// contains filtered or unexported fields
}

Runner implements management of composable kubeadm workflows.

func NewRunner

func NewRunner() *Runner

NewRunner return a new runner for composable kubeadm workflows.

func (*Runner) AppendPhase

func (e *Runner) AppendPhase(t Phase)

AppendPhase adds the given phase to the ordered sequence of phases managed by the runner.

func (*Runner) BindToCommand

func (e *Runner) BindToCommand(cmd *cobra.Command)

BindToCommand bind the Runner to a cobra command by altering command help, adding phase related flags and by adding phases subcommands Please note that this command needs to be done once all the phases are added to the Runner.

func (*Runner) Help

func (e *Runner) Help(cmdUse string) string

Help returns text with the list of phases included in the workflow.

func (*Runner) InitData

func (e *Runner) InitData(args []string) (*KubeGenie, error)

InitData triggers the creation of runtime data shared among all the phases included in the workflow. This action can be executed explicitly out, when it is necessary to get the RunData before actually executing Run, or implicitly when invoking Run.

func (*Runner) Run

func (e *Runner) Run(args []string) error

Run the kubeadm composable kubeadm workflows.

func (*Runner) SetAdditionalFlags

func (e *Runner) SetAdditionalFlags(fn func(*pflag.FlagSet))

SetAdditionalFlags allows to define flags to be added to the subcommands generated for each phase (but not existing in the parent command). Please note that this command needs to be done before BindToCommand. Nb. if a flag is used only by one phase, please consider using phase LocalFlags.

func (*Runner) SetDataInitializer

func (e *Runner) SetDataInitializer(builder func(cmd *cobra.Command, args []string) (*KubeGenie, error))

SetDataInitializer allows to setup a function that initialize the runtime data shared among all the phases included in the workflow. The method will receive in input the cmd that triggers the Runner (only if the runner is BindToCommand)

type RunnerOptions

type RunnerOptions struct {
	// FilterPhases defines the list of phases to be executed (if empty, all).
	FilterPhases []string

	// SkipPhases defines the list of phases to be excluded by execution (if empty, none).
	SkipPhases []string
}

RunnerOptions defines the options supported during the execution of a kubeadm composable workflows

type Task

type Task func(node Node, config *v1alpha1.InitConfiguration) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL