converge

package
v0.0.0-...-94b3a0e Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OKStatus          = "ok"
	ChangedStatus     = "changed"
	DestructiveStatus = "destructively_changed"
	AbandonedStatus   = "abandoned"
	AbsentStatus      = "absent"
	ErrorStatus       = "error"
)
View Source
const (
	MasterNodeGroupName = "master"

	AutoConvergerIdentity = "terraform-auto-converger"
)
View Source
const (
	PhaseBaseInfra = Phase("base-infrastructure")
	PhaseAllNodes  = Phase("all-nodes")
)
View Source
const HideDeckhouseLogs = false
View Source
const ShowDeckhouseLogs = true

Variables

View Source
var (
	ErrConvergeInterrupted = errors.New("Interrupted.")
)
View Source
var ErrNoTerraformState = errors.New("Terraform state is not found in outputs.")
View Source
var (
	ErrNodeGroupChanged = fmt.Errorf("Node group was changed during accept diff.")
)

Functions

func BootstrapAdditionalMasterNode

func BootstrapAdditionalMasterNode(kubeCl *client.KubernetesClient, cfg *config.MetaConfig, index int, cloudConfig string, isConverge bool) (*terraform.PipelineOutputs, error)

func BootstrapAdditionalNode

func BootstrapAdditionalNode(kubeCl *client.KubernetesClient, cfg *config.MetaConfig, index int, step, nodeGroupName, cloudConfig string, isConverge bool) error

func CreateNodeGroup

func CreateNodeGroup(kubeCl *client.KubernetesClient, nodeGroupName string, data map[string]interface{}) error

func CreateNodeTerraformState

func CreateNodeTerraformState(kubeCl *client.KubernetesClient, nodeName, nodeGroup string, settings []byte) error

Create secret for node with group settings only.

func DeleteNode

func DeleteNode(kubeCl *client.KubernetesClient, nodeName string) error

func DeleteNodeGroup

func DeleteNodeGroup(kubeCl *client.KubernetesClient, nodeGroupName string) error

func DeleteTerraformState

func DeleteTerraformState(kubeCl *client.KubernetesClient, secretName string) error

func GetCloudConfig

func GetCloudConfig(kubeCl *client.KubernetesClient, nodeGroupName string, showDeckhouseLogs bool) (string, error)

func GetClusterStateFromCluster

func GetClusterStateFromCluster(kubeCl *client.KubernetesClient) ([]byte, error)

func GetClusterUUID

func GetClusterUUID(kubeCl *client.KubernetesClient) (string, error)

func GetLockLeaseConfig

func GetLockLeaseConfig(identity string) *client.LeaseLockConfig

func GetMetaConfig

func GetMetaConfig(kubeCl *client.KubernetesClient) (*config.MetaConfig, error)

func GetNodeGroup

func GetNodeGroup(kubeCl *client.KubernetesClient, nodeGroupName string) (*unstructured.Unstructured, error)

func GetNodeGroupDirect

func GetNodeGroupDirect(kubeCl *client.KubernetesClient, nodeGroupName string) (*unstructured.Unstructured, error)

func GetNodeGroupTemplates

func GetNodeGroupTemplates(kubeCl *client.KubernetesClient) (map[string]map[string]interface{}, error)

func GetNodeGroups

func GetNodeGroups(kubeCl *client.KubernetesClient) ([]unstructured.Unstructured, error)

func GetNodesStateFromCluster

func GetNodesStateFromCluster(kubeCl *client.KubernetesClient) (map[string]NodeGroupTerraformState, error)

func IsNodeExistsInCluster

func IsNodeExistsInCluster(kubeCl *client.KubernetesClient, nodeName string) (bool, error)

func LockConvergeFromLocal

func LockConvergeFromLocal(kubeCl *client.KubernetesClient, identity string) (func(bool), error)

func NodeName

func NodeName(cfg *config.MetaConfig, nodeGroupName string, index int) string

func SaveClusterTerraformState

func SaveClusterTerraformState(kubeCl *client.KubernetesClient, outputs *terraform.PipelineOutputs) error

func SaveMasterNodeTerraformState

func SaveMasterNodeTerraformState(kubeCl *client.KubernetesClient, nodeName string, tfState, devicePath []byte) error

func SaveNodeTerraformState

func SaveNodeTerraformState(kubeCl *client.KubernetesClient, nodeName, nodeGroup string, tfState, settings []byte) error

func UpdateNodeGroup

func UpdateNodeGroup(kubeCl *client.KubernetesClient, nodeGroupName string, ng *unstructured.Unstructured) error

func WaitForNodesBecomeReady

func WaitForNodesBecomeReady(kubeCl *client.KubernetesClient, nodeGroupName string, desiredReadyNodes int) error

func WaitForNodesListBecomeReady

func WaitForNodesListBecomeReady(kubeCl *client.KubernetesClient, nodes []string, checker hook.NodeChecker) error

func WaitForSingleNodeBecomeReady

func WaitForSingleNodeBecomeReady(kubeCl *client.KubernetesClient, nodeName string) error

Types

type ClusterCheckResult

type ClusterCheckResult struct {
	Status string `json:"status,omitempty"`
}

type ClusterStateSaver

type ClusterStateSaver struct {
	// contains filtered or unexported fields
}

func NewClusterStateSaver

func NewClusterStateSaver(kubeCl *client.KubernetesClient) *ClusterStateSaver

func (*ClusterStateSaver) SaveState

func (s *ClusterStateSaver) SaveState(outputs *terraform.PipelineOutputs) error

type InLockRunner

type InLockRunner struct {
	// contains filtered or unexported fields
}

func NewInLockLocalRunner

func NewInLockLocalRunner(kubeCl *client.KubernetesClient, identity string) *InLockRunner

func NewInLockRunner

func NewInLockRunner(kubeCl *client.KubernetesClient, identity string) *InLockRunner

func (*InLockRunner) Run

func (r *InLockRunner) Run(action func() error) error

func (*InLockRunner) WithForceLock

func (r *InLockRunner) WithForceLock(f bool) *InLockRunner

func (*InLockRunner) WithFullUnlock

func (r *InLockRunner) WithFullUnlock(f bool) *InLockRunner

type NodeCheckResult

type NodeCheckResult struct {
	Group  string `json:"group,omitempty"`
	Name   string `json:"name,omitempty"`
	Status string `json:"status,omitempty"`
}

type NodeGroupCheckResult

type NodeGroupCheckResult struct {
	Name   string `json:"name,omitempty"`
	Status string `json:"status,omitempty"`
}

type NodeGroupController

type NodeGroupController struct {
	// contains filtered or unexported fields
}

func NewConvergeController

func NewConvergeController(kubeCl *client.KubernetesClient, metaConfig *config.MetaConfig, name string, state NodeGroupTerraformState, stateCache dstate.Cache) *NodeGroupController

func (*NodeGroupController) Run

func (c *NodeGroupController) Run() error

func (*NodeGroupController) WithChangeSettings

func (c *NodeGroupController) WithChangeSettings(changeSettings *terraform.ChangeActionSettings) *NodeGroupController

func (*NodeGroupController) WithCommanderMode

func (c *NodeGroupController) WithCommanderMode(commanderMode bool) *NodeGroupController

func (*NodeGroupController) WithExcludedNodes

func (c *NodeGroupController) WithExcludedNodes(nodesMap map[string]bool) *NodeGroupController

type NodeGroupGroupOptions

type NodeGroupGroupOptions struct {
	Name            string
	Step            string
	CloudConfig     string
	DesiredReplicas int
	State           map[string][]byte
}

func (*NodeGroupGroupOptions) CurReplicas

func (n *NodeGroupGroupOptions) CurReplicas() int

type NodeGroupTerraformState

type NodeGroupTerraformState struct {
	State    map[string][]byte
	Settings []byte
}

type NodeStateSaver

type NodeStateSaver struct {
	// contains filtered or unexported fields
}

func NewNodeStateSaver

func NewNodeStateSaver(kubeCl *client.KubernetesClient, nodeName, nodeGroup string, nodeGroupSettings []byte) *NodeStateSaver

func (*NodeStateSaver) SaveState

func (s *NodeStateSaver) SaveState(outputs *terraform.PipelineOutputs) error

SaveState is a method to patch Secret with node state. It patches a "node-tf-state" key with terraform state or create a new secret if new node is created.

settings can be nil for master node.

The difference between master node and static node: master node has no key "node-group-settings.json" with group settings.

type Phase

type Phase string

type Runner

type Runner struct {
	*phases.PhasedExecutionContext
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(kubeCl *client.KubernetesClient, lockRunner *InLockRunner, stateCache dstate.Cache) *Runner

func (*Runner) RunConverge

func (r *Runner) RunConverge() error

func (*Runner) WithChangeSettings

func (r *Runner) WithChangeSettings(changeSettings *terraform.ChangeActionSettings) *Runner

func (*Runner) WithCommanderMode

func (r *Runner) WithCommanderMode(commanderMode bool) *Runner

func (*Runner) WithCommanderModeParams

func (r *Runner) WithCommanderModeParams(params *commander.CommanderModeParams) *Runner

func (*Runner) WithExcludedNodes

func (r *Runner) WithExcludedNodes(nodes []string) *Runner

func (*Runner) WithPhasedExecutionContext

func (r *Runner) WithPhasedExecutionContext(pec *phases.PhasedExecutionContext) *Runner

func (*Runner) WithSkipPhases

func (r *Runner) WithSkipPhases(phases []Phase) *Runner

type Statistics

type Statistics struct {
	Node          []NodeCheckResult      `json:"nodes,omitempty"`
	NodeTemplates []NodeGroupCheckResult `json:"node_templates,omitempty"`
	Cluster       ClusterCheckResult     `json:"cluster,omitempty"`
}

func CheckState

func CheckState(kubeCl *client.KubernetesClient, metaConfig *config.MetaConfig) (*Statistics, error)

Jump to

Keyboard shortcuts

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