Throttle disk write to prevent etcd puking during upgrade

This commit is contained in:
2026-04-07 17:34:38 +08:00
parent 11e2c96173
commit bc4b124246
17 changed files with 639 additions and 25 deletions

View File

@@ -7,6 +7,7 @@ import (
"path/filepath"
monov1alpha1 "example.com/monok8s/pkg/apis/monok8s/v1alpha1"
"example.com/monok8s/pkg/controller/osimage"
)
func EngageControlGate(ctx context.Context, nctx *NodeContext) error {
@@ -30,3 +31,7 @@ func ReleaseControlGate(ctx context.Context, nctx *NodeContext) error {
return nil
}
func DiagTestDiskWrite(ctx context.Context, nctx *NodeContext) error {
return osimage.TestStreamToTarget(ctx, monov1alpha1.AltPartDeviceLink)
}

View File

@@ -96,9 +96,6 @@ func resolvePauseImage(ctx context.Context, nctx *NodeContext, kubeVersion strin
continue
}
// examples:
// registry.k8s.io/pause:3.10
// some.registry.local/pause:3.10
if strings.Contains(line, "/pause:") || strings.HasPrefix(line, "pause:") {
return line, nil
}

View File

@@ -36,7 +36,7 @@ func MountAltImageStore(ctx context.Context, nctx *NodeContext) error {
[]string{"-o", "ro", altDev, altRootMount},
system.RunOptions{Timeout: 30 * time.Second},
); err != nil {
return fmt.Errorf("mount alt rootfs %s on %s: %w", altDev, altRootMount, err)
klog.Errorf("mount alt rootfs %s on %s: %w", altDev, altRootMount, err)
}
}

View File

@@ -32,7 +32,7 @@ func ConfigureABBoot(ctx context.Context, nctx *node.NodeContext) error {
return fmt.Errorf("read boot state: %w", err)
}
bootPart := state["BOOT_PART"]
bootPart = state["BOOT_PART"]
if bootPart == "" {
return fmt.Errorf("BOOT_PART missing")
}

View File

@@ -70,6 +70,6 @@ fi;
setenv bootdev 0:${rootpart};
setenv rootdev ${boot_source}:${rootpart};
setenv bootargs "${bootargs_console} root=${rootdev} bootpart=${boot_part} rw rootwait rootfstype=ext4";
setenv bootargs "${bootargs_console} root=${rootdev} bootpart=${boot_part} rw rootwait rootfstype=ext4 delayacct";
ext4load ${boot_iface} ${bootdev} ${kernel_addr_r} /boot/kernel.itb && bootm ${kernel_addr_r};
`