Skip to content

Commit

Permalink
feat: update runc to 1.2.0 final
Browse files Browse the repository at this point in the history
  • Loading branch information
smira committed Oct 22, 2024
1 parent 2172535 commit 534b0ce
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TOOLS ?= ghcr.io/siderolabs/tools:v1.9.0-alpha.0-4-g2058296
DEBUG_TOOLS_SOURCE := scratch

PKGS_PREFIX ?= ghcr.io/siderolabs
PKGS ?= v1.9.0-alpha.0-24-gbe92da0
PKGS ?= v1.9.0-alpha.0-26-gc9282c8
EXTRAS ?= v1.9.0-alpha.0-1-geab6e58

KRES_IMAGE ?= ghcr.io/siderolabs/kres:latest
Expand Down
1 change: 1 addition & 0 deletions hack/release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Linux: 6.6.57
containerd: 2.0.0-rc.5
Flannel: 0.25.7
Kubernetes: 1.32.0-alpha.2
runc: 1.2.0
Talos is built with Go 1.23.2.
"""
Expand Down
27 changes: 1 addition & 26 deletions internal/integration/api/cgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"context"
"io"
"path/filepath"
"strings"
"time"

"github.com/siderolabs/go-procfs/procfs"
Expand Down Expand Up @@ -52,8 +51,7 @@ func (suite *CGroupsSuite) TestCGroupsVersion() {
node := suite.RandomDiscoveredNodeInternalIP()
ctx := client.WithNode(suite.ctx, node)

cmdline, err := suite.readCmdline(ctx)
suite.Require().NoError(err)
cmdline := suite.ReadCmdline(ctx)

unified := procfs.NewCmdline(cmdline).Get(constants.KernelParamCGroups).First()
cgroupsV1 := false
Expand Down Expand Up @@ -126,29 +124,6 @@ func (suite *CGroupsSuite) TestCGroupsVersion() {
}
}

func (suite *CGroupsSuite) readCmdline(ctx context.Context) (string, error) {
reader, err := suite.Client.Read(ctx, "/proc/cmdline")
if err != nil {
return "", err
}

defer reader.Close() //nolint:errcheck

body, err := io.ReadAll(reader)
if err != nil {
return "", err
}

bootID := strings.TrimSpace(string(body))

_, err = io.Copy(io.Discard, reader)
if err != nil {
return "", err
}

return bootID, reader.Close()
}

func init() {
allSuites = append(allSuites, new(CGroupsSuite))
}
56 changes: 40 additions & 16 deletions internal/integration/api/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ import (
"strings"
"time"

"github.com/siderolabs/go-pointer"
"github.com/siderolabs/go-procfs/procfs"

"github.com/siderolabs/talos/internal/integration/base"
"github.com/siderolabs/talos/pkg/machinery/client"
"github.com/siderolabs/talos/pkg/machinery/constants"
)

// ProcessSuite ...
Expand Down Expand Up @@ -63,12 +67,18 @@ func (suite *ProcessSuite) readProcfs(nodeCtx context.Context, pid int32, proper

// TestProcessCapabilities reads capabilities of processes from procfs
// and validates system services get necessary capabilities dropped.
//
//nolint:gocyclo
func (suite *ProcessSuite) TestProcessCapabilities() {
nodes := suite.DiscoverNodeInternalIPs(suite.ctx)

for _, node := range nodes {
nodeCtx := client.WithNode(suite.ctx, node)

cmdline := suite.ReadCmdline(nodeCtx)

cgroupsV1 := pointer.SafeDeref(procfs.NewCmdline(cmdline).Get(constants.KernelParamCGroups).First()) == "0"

r, err := suite.Client.Processes(nodeCtx)
suite.Require().NoError(err)

Expand All @@ -87,10 +97,14 @@ func (suite *ProcessSuite) TestProcessCapabilities() {
suite.readProcfs(nodeCtx, p.Pid, "status"),
"CapPrm:\t000001ffffbfffff\nCapEff:\t000001ffffbfffff\nCapBnd:\t000001ffffbfffff",
)
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/system/udevd",
)

if !cgroupsV1 {
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/system/udevd",
)
}

suite.Require().Contains(
suite.readProcfs(nodeCtx, p.Pid, "environ"),
"XDG_RUNTIME_DIR=/run",
Expand All @@ -107,10 +121,14 @@ func (suite *ProcessSuite) TestProcessCapabilities() {
suite.readProcfs(nodeCtx, p.Pid, "status"),
"CapPrm:\t0000000000000000\nCapEff:\t0000000000000000\nCapBnd:\t0000000000000000",
)
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/system/dashboard",
)

if !cgroupsV1 {
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/system/dashboard",
)
}

suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "oom_score_adj"),
"-400",
Expand All @@ -133,19 +151,25 @@ func (suite *ProcessSuite) TestProcessCapabilities() {
)

if strings.Contains(p.Args, "/system/run/containerd") {
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/system/runtime",
)
if !cgroupsV1 {
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/system/runtime",
)
}

suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "oom_score_adj"),
"-999",
)
} else {
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/podruntime/runtime",
)
if !cgroupsV1 {
suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "cgroup"),
"0::/podruntime/runtime",
)
}

suite.Require().Equal(
suite.readProcfs(nodeCtx, p.Pid, "oom_score_adj"),
"-500",
Expand Down
20 changes: 20 additions & 0 deletions internal/integration/base/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,26 @@ func (apiSuite *APISuite) DumpLogs(ctx context.Context, node string, service, pa
}
}

// ReadCmdline reads cmdline from the node.
func (apiSuite *APISuite) ReadCmdline(nodeCtx context.Context) string {
reader, err := apiSuite.Client.Read(nodeCtx, "/proc/cmdline")
apiSuite.Require().NoError(err)

defer reader.Close() //nolint:errcheck

body, err := io.ReadAll(reader)
apiSuite.Require().NoError(err)

cmdline := strings.TrimSpace(string(body))

_, err = io.Copy(io.Discard, reader)
apiSuite.Require().NoError(err)

apiSuite.Require().NoError(reader.Close())

return cmdline
}

// TearDownSuite closes Talos API client.
func (apiSuite *APISuite) TearDownSuite() {
if apiSuite.Client != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/machinery/gendata/data/pkgs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.9.0-alpha.0-24-gbe92da0
v1.9.0-alpha.0-26-gc9282c8

0 comments on commit 534b0ce

Please sign in to comment.