peered

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectJumpboxLogs added in v1.0.9

func CollectJumpboxLogs(ctx context.Context, config JumpboxLogCollection) error

CollectJumpboxLogs collects logs from the jumpbox instance and uploads them to S3

func JumpboxInstance added in v1.0.2

func JumpboxInstance(ctx context.Context, client *ec2.Client, clusterName string) (*types.Instance, error)

JumpboxInstance returns the jumpbox ec2 instance for the given cluster.

func KeyPair added in v1.0.2

func KeyPair(ctx context.Context, client *ec2.Client, clusterName string) (*types.KeyPairInfo, error)

KeyPair returns the keypair for the given cluster.

Types

type HybridCluster

type HybridCluster struct {
	Name              string
	Arn               string
	Region            string
	KubernetesVersion string
	SubnetID          string
	SecurityGroupID   string
	SubnetIds         []string
}

func GetHybridCluster

func GetHybridCluster(ctx context.Context, eksClient *eks.Client, ec2Client *ec2.Client, clusterName string) (*HybridCluster, error)

GetHybridCluster returns the hybrid cluster details.

type Infrastructure

type Infrastructure struct {
	Credentials       credentials.Infrastructure
	JumpboxInstanceId string
	NodesPublicSSHKey string
}

Infrastructure represents the necessary infrastructure for peered VPCs to be used by nodeadm.

func Setup

func Setup(ctx context.Context, logger logr.Logger, config aws.Config, clusterName, endpoint string) (*Infrastructure, error)

Setup creates the necessary infrastructure for credentials providers to be used by nodeadm.

func (*Infrastructure) Teardown

func (p *Infrastructure) Teardown(ctx context.Context) error

type ItBlockCloser added in v1.0.3

type ItBlockCloser interface {
	It(description string, body func())
	Close()
}

func NewSerialOutputBlockBestEffort added in v1.0.3

func NewSerialOutputBlockBestEffort(ctx context.Context, config *SerialOutputConfig) ItBlockCloser

NewSerialOutputBlockBestEffort creates a SerialOutputBlock if the serial console is available, otherwise it returns a no-op implementation.

type JumpboxLogCollection added in v1.0.9

type JumpboxLogCollection struct {
	JumpboxInstanceID string
	LogsBucket        string
	ClusterName       string
	S3Client          *s3.Client
	SSMClient         *ssm.Client
	Logger            logr.Logger
}

JumpboxLogCollection holds the configuration for jumpbox log collection

type Network added in v1.0.5

type Network struct {
	EC2    *ec2sdk.Client
	Logger logr.Logger
	K8s    peeredtypes.K8s

	Cluster *HybridCluster
}

func (*Network) CreateRoutesForNode added in v1.0.5

func (n *Network) CreateRoutesForNode(ctx context.Context, peeredInstance *PeeredInstance) error

CreateRoutesForNode creates routes in the VPC route table for the node's pod CIDRs.

type Node

type Node struct {
	NodeCreate
	NodeCleanup
}

Node represents is a Hybrid node running as an EC2 instance in a peered VPC.

func (Node) S3LogsURL added in v1.0.3

func (c Node) S3LogsURL(instanceName string) string

type NodeCleanup added in v1.0.3

type NodeCleanup struct {
	SSM          *ssm.Client
	S3           *s3sdk.Client
	EC2          *ec2sdk.Client
	K8s          clientgo.Interface
	Logger       logr.Logger
	LogCollector os.NodeLogCollector

	LogsBucket string
	Cluster    *HybridCluster
	SkipDelete bool
	InstanceId string
}

func (*NodeCleanup) Cleanup added in v1.0.3

func (c *NodeCleanup) Cleanup(ctx context.Context, peeredInstance PeeredInstance) error

Cleanup collects logs and deletes the EC2 instance and Node object.

func (*NodeCleanup) CleanupSSMActivation added in v1.0.4

func (c *NodeCleanup) CleanupSSMActivation(ctx context.Context, nodeName, clusterName string) error

func (*NodeCleanup) NodeInfrastructureCleaner added in v1.0.5

func (c *NodeCleanup) NodeInfrastructureCleaner(peeredInstance PeeredInstance) *NodeInfrastructureCleaner

type NodeCreate added in v1.0.3

type NodeCreate struct {
	AWS                 aws.Config
	Cluster             *HybridCluster
	EC2                 *ec2sdk.Client
	SSM                 *ssm.Client
	K8sClientConfig     *rest.Config
	Logger              logr.Logger
	RemoteCommandRunner commands.RemoteCommandRunner

	SetRootPassword bool
	NodeadmURLs     e2e.NodeadmURLs
	PublicKey       string
}

func (NodeCreate) Create added in v1.0.3

func (c NodeCreate) Create(ctx context.Context, spec *NodeSpec) (PeeredInstance, error)

Create spins up an EC2 instance with the proper user data to join as a Hybrid node to the cluster.

func (*NodeCreate) SerialConsole added in v1.0.3

func (c *NodeCreate) SerialConsole(ctx context.Context, instanceId string) (*ssh.SerialConsole, error)

SerialConsole returns the serial console for the given instance.

type NodeInfrastructureCleaner added in v1.0.5

type NodeInfrastructureCleaner struct {
	EC2    *ec2sdk.Client
	Logger logr.Logger

	SubnetID   string
	InstanceId string
}

func (*NodeInfrastructureCleaner) Cleanup added in v1.0.5

type NodeSpec

type NodeSpec struct {
	EKSEndpoint        string
	InstanceName       string
	InstanceSize       e2e.InstanceSize
	InstanceType       string
	InstanceProfileARN string
	NodeK8sVersion     string
	NodeName           string
	ComputeType        e2e.ComputeType
	OS                 e2e.NodeadmOS
	Provider           e2e.NodeadmCredentialsProvider
}

NodeSpec configures the Hybrid Node.

type PeeredInstance added in v1.0.9

type PeeredInstance struct {
	ec2.Instance
	Name string
}

PeeredInstance represents a Hybrid node running as an EC2 instance in a peered VPC The Name is the name of the Kubernetes node object The Instance is the underlying EC2 instance

type SerialOutputBlock added in v1.0.3

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

SerialOutputBlock is a helper to run sections of a ginkgo test while outputting the serial console output of an instance. It paused the main test logs while streaming the serial console output, and resumes them once the test "body" is done. The serial console output is also saved to a file until Close is called, no matter if you are running a test block or not. This is very useful to help debugging issues with the node joining the cluster, specially if the process runs as part of the node initialization.

func NewSerialOutputBlock added in v1.0.3

func NewSerialOutputBlock(ctx context.Context, config *SerialOutputConfig) (*SerialOutputBlock, error)

func (*SerialOutputBlock) Close added in v1.0.3

func (b *SerialOutputBlock) Close()

func (*SerialOutputBlock) It added in v1.0.3

func (b *SerialOutputBlock) It(description string, body func())

It runs the test body while streaming the serial console output of the instance to stdout. It pauses the main test logs while streaming the serial console output, and resumes them once the test "body" is done. This actually doesn't create a ginkgo node, it just uses By to print the description and help distinguish this test block in the logs.

type SerialOutputConfig added in v1.0.3

type SerialOutputConfig struct {
	By         func(description string, callback ...func())
	PeeredNode *Node
	Instance   PeeredInstance
	TestLogger e2e.PausableLogger
	OutputFile string
	Output     io.Writer // Writer to output serial console to, defaults to os.Stdout if nil
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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