Matches ctl version to upstream

This commit is contained in:
2026-03-28 20:28:22 +08:00
parent 848daefffe
commit ecceff225f
25 changed files with 591 additions and 159 deletions

View File

@@ -5,15 +5,19 @@ import (
"fmt"
"os"
"strings"
"k8s.io/klog/v2"
)
const DefaultSecond = 1_000_000_000
func EnsureServiceRunning(ctx context.Context, r *Runner, svc string) error {
if _, err := r.Run(ctx, " rc-service", svc, "status"); err == nil {
return nil
}
klog.Infof("Starting service: %q", svc)
_, err := r.RunRetry(ctx, RetryOptions{
Attempts: 3,
Delay: 2 * DefaultSecond,

View File

@@ -0,0 +1,12 @@
//go:build linux
package system
import "golang.org/x/sys/unix"
func SetHostname(hostname string) error {
if hostname == "" {
return nil
}
return unix.Sethostname([]byte(hostname))
}

View File

@@ -0,0 +1,8 @@
//go:build !linux
package system
func SetHostname(hostname string) error {
// intentionally a no-op
return nil
}