Skip to content

Commit

Permalink
set etcd size at 8 GB
Browse files Browse the repository at this point in the history
  • Loading branch information
AshleyDumaine committed Feb 27, 2024
1 parent b33f035 commit d6503d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions controller/linodemachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ import (
"github.com/linode/cluster-api-provider-linode/cloud/services"
)

// default etcd Disk size in MB
const defaultEtcdDiskSize = 8192

var skippedMachinePhases = map[string]bool{
string(clusterv1.MachinePhasePending): true,
string(clusterv1.MachinePhaseFailed): true,
Expand Down Expand Up @@ -403,16 +406,15 @@ func (r *LinodeMachineReconciler) configureDisks(
}
instanceConfig := configs[0]

// carve out half the root disk space to be used for the etcd disk
// carve out space for the etcd disk
rootDiskID := instanceConfig.Devices.SDA.DiskID
rootDisk, err := machineScope.LinodeClient.GetInstanceDisk(ctx, linodeInstanceID, rootDiskID)
if err != nil {
logger.Error(err, "Failed to get root disk for instance")

return err
}
//nolint:gomnd // cutting disk in half
diskSize := rootDisk.Size / 2
diskSize := rootDisk.Size - defaultEtcdDiskSize
if err = machineScope.LinodeClient.ResizeInstanceDisk(ctx, linodeInstanceID, rootDiskID, diskSize); err != nil {
logger.Error(err, "Failed to resize root disk")

Expand All @@ -425,7 +427,7 @@ func (r *LinodeMachineReconciler) configureDisks(
linodeInstanceID,
linodego.InstanceDiskCreateOptions{
Label: "etcd-data",
Size: diskSize,
Size: defaultEtcdDiskSize,
Filesystem: string(linodego.FilesystemExt4),
},
)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/topics/etcd.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ This guide covers etcd configuration for the control plane of provisioned CAPL c
## Default configuration

By default, etcd is configured to be on a separate device from the root filesystem on
control plane nodes. The etcd disk is automatically sized to take up half of the
storage on the Linode instance.
control plane nodes. The etcd disk is automatically sized at 8 GB per recommendation
from [the etcd documentation](https://etcd.io/docs/latest/dev-guide/limit/#storage-size-limit)

0 comments on commit d6503d2

Please sign in to comment.