Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep kernel.pid_max smaller than 1048575. #565

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions topo/topo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"

Expand All @@ -29,6 +30,7 @@ import (
"github.com/openconfig/gnmi/errlist"
"github.com/openconfig/kne/cluster/kind"
"github.com/openconfig/kne/events"
"github.com/openconfig/kne/exec/run"
"github.com/openconfig/kne/metrics"
"github.com/openconfig/kne/pods"
cpb "github.com/openconfig/kne/proto/controller"
Expand All @@ -45,6 +47,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
log "k8s.io/klog/v2"

_ "github.com/openconfig/kne/topo/node/alpine"
Expand All @@ -61,6 +64,7 @@ import (
)

var (
setPIDMaxScript = filepath.Join(homedir.HomeDir(), "kne-internal", "set_pid_max.sh")
protojsonUnmarshaller = protojson.UnmarshalOptions{
AllowPartial: true,
DiscardUnknown: false,
Expand Down Expand Up @@ -484,6 +488,14 @@ func (m *Manager) load() error {
uid++
}
for k, n := range nMap {
// Bug: Some vendors incorrectly increase the value of kernel.pid_max which
// causes other vendors to have issues. Run this script as a temporary
// workaround.
if _, err := os.Stat(setPIDMaxScript); err == nil {
if err := run.LogCommand(setPIDMaxScript); err != nil {
return fmt.Errorf("failed to exec set_pid_max script: %w", err)
}
}
log.Infof("Adding Node: %s:%s", n.Name, n.Vendor)
nn, err := node.New(m.topo.Name, n, m.kClient, m.rCfg, m.basePath, m.kubecfg)
if err != nil {
Expand Down
Loading