cluster

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSubnetBits = 24

Variables

View Source
var DefaultNetwork = netip.MustParsePrefix("10.210.0.0/16")

Functions

func NewMachineID

func NewMachineID() (string, error)

NewMachineID generates a new unique machine ID.

func NewRandomMachineName

func NewRandomMachineName() (string, error)

NewRandomMachineName generates a random machine name in the format "machine-xxxx".

Types

type Cluster

type Cluster struct {
	pb.UnimplementedClusterServer
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(store *store.Store, corroAdmin *corrosion.AdminClient) *Cluster

func (*Cluster) AddMachine

func (c *Cluster) AddMachine(ctx context.Context, req *pb.AddMachineRequest) (*pb.AddMachineResponse, error)

AddMachine adds a machine to the cluster.

func (*Cluster) CreateDomainRecords

func (c *Cluster) CreateDomainRecords(
	ctx context.Context, req *pb.CreateDomainRecordsRequest,
) (*pb.CreateDomainRecordsResponse, error)

func (*Cluster) GetDomain

func (c *Cluster) GetDomain(ctx context.Context, _ *emptypb.Empty) (*pb.Domain, error)

func (*Cluster) Init

func (c *Cluster) Init(ctx context.Context, network netip.Prefix) error

func (*Cluster) Initialised

func (c *Cluster) Initialised(ctx context.Context) (bool, error)

func (*Cluster) ListMachines

func (c *Cluster) ListMachines(ctx context.Context, _ *emptypb.Empty) (*pb.ListMachinesResponse, error)

ListMachines lists all machines in the cluster including their membership states.

func (*Cluster) Network

func (c *Cluster) Network(ctx context.Context) (netip.Prefix, error)

func (*Cluster) ReleaseDomain

func (c *Cluster) ReleaseDomain(ctx context.Context, _ *emptypb.Empty) (*pb.Domain, error)

func (*Cluster) RemoveMachine added in v0.10.0

func (c *Cluster) RemoveMachine(ctx context.Context, req *pb.RemoveMachineRequest) (*emptypb.Empty, error)

RemoveMachine removes a machine from the cluster.

func (*Cluster) ReserveDomain

func (c *Cluster) ReserveDomain(ctx context.Context, req *pb.ReserveDomainRequest) (*pb.Domain, error)

func (*Cluster) UpdateMachine added in v0.10.0

func (c *Cluster) UpdateMachine(ctx context.Context, req *pb.UpdateMachineRequest) (*pb.UpdateMachineResponse, error)

UpdateMachine updates machine configuration in the cluster.

func (*Cluster) UpdateMachineID

func (c *Cluster) UpdateMachineID(mid string)

UpdateMachineID updates the current machine ID that is running the cluster service.

type IPAM

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

IPAM is an in-memory IP address manager for allocating and releasing subnets for machines from a cluster network.

func NewIPAM

func NewIPAM(network netip.Prefix) (*IPAM, error)

func NewIPAMWithAllocated

func NewIPAMWithAllocated(network netip.Prefix, subnets []netip.Prefix) (*IPAM, error)

NewIPAMWithAllocated creates a new IPAM with the given network and already allocated subnets.

func (*IPAM) AllocateSubnet

func (ipam *IPAM) AllocateSubnet(subnet netip.Prefix) error

func (*IPAM) AllocateSubnetLen

func (ipam *IPAM) AllocateSubnetLen(bits int) (netip.Prefix, error)

Jump to

Keyboard shortcuts

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