utils

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveConfigWithWorkflowError

func SaveConfigWithWorkflowError(config *pb.Config, c pb.ContextBoxServiceClient, clusterView *utils.ClusterView) error

SaveConfigWithWorkflowError saves config with workflow states

func SeparateNodepools

func SeparateNodepools(clusterNodes map[string]int32, currentClusterInfo, desiredClusterInfo *pb.ClusterInfo) (master []string, worker []string)

separateNodepools creates two slices of node names, one for master and one for worker nodes

func UpdateNodePoolInfo

func UpdateNodePoolInfo(src []*pb.NodePool, dst []*pb.NodePool)

updateNodePoolInfo updates the nodepool metadata and node private IPs between stages of the cluster build.

Types

type BuilderContext

type BuilderContext struct {
	// ProjectName for this cluster
	ProjectName string
	// CurrentCluster is the current state of the cluster
	// properties may change during processing.
	CurrentCluster *pb.K8Scluster
	// DesiredCluster is the desired state of the cluster
	// properties may change during processing.
	DesiredCluster *pb.K8Scluster

	// CurrentLoadbalancers are the current loadbalancers of the cluster
	// properties may change during processing.
	CurrentLoadbalancers []*pb.LBcluster
	// DesiredLoadbalancers are the current loadbalancers of the cluster
	// properties may change during processing.
	DesiredLoadbalancers []*pb.LBcluster

	// DeletedLoadBalancers are the deleted loadbalancers for the cluster.
	DeletedLoadBalancers []*pb.LBcluster

	// Workflow is the current state of processing of the cluster.
	Workflow *pb.Workflow
}

BuilderContext provides context for the Claudie workflow for a particular cluster.

func (*BuilderContext) GetClusterID

func (ctx *BuilderContext) GetClusterID() string

GetClusterID returns ID of the k8s cluster for a given builder context.

func (*BuilderContext) GetClusterName

func (ctx *BuilderContext) GetClusterName() string

GetClusterName returns name of the k8s cluster for a given builder context.

type IntermediateRepresentation

type IntermediateRepresentation struct {
	// IR is the intermediate representation that should be passed through the workflow
	// before actually building the desired state. If nil there is no in-between step.
	IR *pb.K8Scluster

	// IRLbs are the intermediate representations of LB clusters that should be passed through the workflow
	// before actually building the desired state of the LB clusters. If nil there is no in-between step.
	IRLbs []*pb.LBcluster

	// ToDelete are the nodepools from which nodes needs to be deleted. This may be set
	// even if IR is nil.
	ToDelete map[string]int32

	// ControlPlaneWithAPIEndpointReplace if this is set it means that the nodepool in current state
	// which has an ApiEndpoint is deleted in desired state and needs to be updated
	// before executing the workflow for the desired state and before deleting the nodes
	// from the ToDelete.
	ControlPlaneWithAPIEndpointReplace bool
}

IntermediateRepresentation represents the intermediate state for a pair of current, desired *pb.K8sClusters>

func Diff

func Diff(current, desired *pb.K8Scluster, currentLbs, desiredLbs []*pb.LBcluster) *IntermediateRepresentation

Diff takes the desired and current state to calculate difference between them to determine how many nodes needs to be deleted and added.

func (*IntermediateRepresentation) Stages

func (ir *IntermediateRepresentation) Stages() int

Stages returns the number of individual stages. Useful for logging.

Jump to

Keyboard shortcuts

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