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 1 commit
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 @@
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"

Expand All @@ -29,6 +30,7 @@
"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 @@
"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 @@
)

var (
setPIDMaxScript = filepath.Join(homedir.HomeDir(), "kne-internal", "set_pid_max.sh")

Check failure on line 67 in topo/topo.go

View workflow job for this annotation

GitHub Actions / go / lint

File is not `gofmt`-ed with `-s` (gofmt)
protojsonUnmarshaller = protojson.UnmarshalOptions{
AllowPartial: true,
DiscardUnknown: false,
Expand Down Expand Up @@ -484,6 +488,14 @@
uid++
}
for k, n := range nMap {
// If the script is found, then run it. Else silently ignore it.
guoshiuan marked this conversation as resolved.
Show resolved Hide resolved
// The set_pid_max script modifies the kernel.pid_max value to
// be acceptable for the Cisco 8000e container.
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