Skip to content

Commit

Permalink
setup environment GOMAXPROCS=2
Browse files Browse the repository at this point in the history
Signed-off-by: yylt <[email protected]>
  • Loading branch information
yylt committed Mar 3, 2025
1 parent f4736bb commit dcb34ff
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ func defaultCNIConfig() *libcni {
[]string{
DefaultCNIDir,
},
&invoke.DefaultExec{
&Exec{
RawExec: &invoke.RawExec{Stderr: os.Stderr},
PluginDecoder: version.PluginDecoder{},
Environ: []string{"GOMAXPROCS=2"},
},
),
networkCount: 1,
Expand Down
34 changes: 34 additions & 0 deletions exec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package cni

import (
"context"

"github.com/containernetworking/cni/pkg/invoke"
"github.com/containernetworking/cni/pkg/version"
)

type Exec struct {
*invoke.RawExec
version.PluginDecoder
Environ []string
}

func (e *Exec) ExecPlugin(ctx context.Context, pluginPath string, stdinData []byte, environ []string) ([]byte, error) {
return e.RawExec.ExecPlugin(ctx, pluginPath, stdinData, append(e.Environ, environ...))
}

0 comments on commit dcb34ff

Please sign in to comment.