← 返回首页
Containerd sandbox by LeonSun-CS · Pull Request #460 · open-lambda/open-lambda · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .go  (10) .mod  (1) .py  (1) .sum  (1) All 4 file types selected Only manifest files Viewed files
Conversations
Failed to load comments. Retry
Loading
Jump to
Jump to file
Failed to load files. Retry
Loading
Diff view
Unified
Split
Hide whitespace
Apply and reload
Show whitespace
Diff view
Unified
Split
Hide whitespace
Apply and reload
6 changes: 3 additions & 3 deletions examples/thread_counter/f.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
def worker():
counter = 0
while True:
print 'counter=%d' % counter
print ('counter=%d' % counter)
sys.stdout.flush()
counter += 1
time.sleep(0.001)

def f(event):
global t
if t == None:
print 'Init worker thread'
print('Init worker thread')
t = Thread(target=worker)
t.start()
time.sleep(0.1)
return 'Background thread started'

def main():
print f(None, None)
print(f(None, None))

if __name__ == '__main__':
main()
41 changes: 33 additions & 8 deletions go/common/config.go
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Config struct {
// log output of the runtime and proxy?
Log_output bool `json:"log_output"`

// sandbox type: "docker" or "sock"
// sandbox type: "docker", "sock", "containerd", or "mock"
// currently ignored as cgroup sandbox is not fully integrated
Sandbox string `json:"sandbox"`

Expand Down Expand Up @@ -62,13 +62,14 @@ type Config struct {
// pass through to sandbox envirenment variable
Sandbox_config any `json:"sandbox_config"`

Docker DockerConfig `json:"docker"`
Limits LimitsConfig `json:"limits"`
InstallerLimits LimitsConfig `json:"installer_limits"` // limits profile for installers
Features FeaturesConfig `json:"features"`
Trace TraceConfig `json:"trace"`
Storage StorageConfig `json:"storage"`
Kafka KafkaConfig `json:"kafka"`
Docker DockerConfig `json:"docker"`
Containerd ContainerdConfig `json:"containerd"`
Limits LimitsConfig `json:"limits"`
InstallerLimits LimitsConfig `json:"installer_limits"` // limits profile for installers
Features FeaturesConfig `json:"features"`
Trace TraceConfig `json:"trace"`
Storage StorageConfig `json:"storage"`
Kafka KafkaConfig `json:"kafka"`
}

type KafkaConfig struct {
Expand All @@ -91,6 +92,20 @@ type DockerConfig struct {
Base_image string `json:"base_image"`
}

type ContainerdConfig struct {
// Path to containerd socket (default: /run/containerd/containerd.sock)
SocketAddress string `json:"socket_address"`

// Namespace to use (default: "openlambda")
Namespace string `json:"namespace"`

// Runtime handler (default: "io.containerd.runc.v2")
Runtime string `json:"runtime"`

// Base image name for containers
Base_image string `json:"base_image"`
}

type FeaturesConfig struct {
Reuse_cgroups bool `json:"reuse_cgroups"`
Import_cache string `json:"import_cache"`
Expand Down Expand Up @@ -311,6 +326,12 @@ func getDefaultConfigForPatching(olPath string) (*Config, error) {
Docker: DockerConfig{
Base_image: "ol-min",
},
Containerd: ContainerdConfig{
SocketAddress: "/run/containerd/containerd.sock",
Namespace: "openlambda",
Runtime: "io.containerd.runc.v2",
Base_image: "docker.io/library/ol-min:latest",
},
Limits: userLimits,
InstallerLimits: installerLimits,
Features: FeaturesConfig{
Expand Down Expand Up @@ -415,6 +436,10 @@ func checkConf(cfg *Config) error {
if cfg.Features.Import_cache != "" {
return fmt.Errorf("features.import_cache must be disabled for docker Sandbox")
}
} else if cfg.Sandbox == "containerd" {
if cfg.Features.Import_cache != "" {
return fmt.Errorf("features.import_cache must be disabled for containerd Sandbox")
}
} else if cfg.Sandbox == "mock" {
// mock sandbox: no additional requirements
} else {
Expand Down
1 change: 1 addition & 0 deletions go/common/lambdaConfig.go
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func LoadLambdaConfig(codeDir string) (*LambdaConfig, error) {
file, err := os.Open(path)

if errors.Is(err, os.ErrNotExist) {
// TODO: use slog

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Probably simpler to just do it rather than add a comment (or just leave it out of this PR since it is not related).

fmt.Println("Config file not found. Loading defaults...")
return LoadDefaultLambdaConfig(), nil
} else if err != nil {
Expand Down
18 changes: 16 additions & 2 deletions go/go.mod
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ toolchain go1.24.4
require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0
github.com/containerd/containerd v1.6.26
github.com/fsouza/go-dockerclient v1.10.1
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

I think containerd is obvious, but could you let me know what each of the other two dependencies provide?

github.com/robfig/cron/v3 v3.0.1
github.com/twmb/franz-go v1.19.0
github.com/urfave/cli/v2 v2.25.3
gocloud.dev v0.42.0
golang.org/x/sys v0.38.0
gopkg.in/yaml.v3 v3.0.1
)

Expand All @@ -39,6 +42,7 @@ require (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.9.10 // indirect
github.com/aws/aws-sdk-go v1.55.6 // indirect
github.com/aws/aws-sdk-go-v2 v1.36.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.10 // indirect
Expand All @@ -61,18 +65,24 @@ require (
github.com/aws/smithy-go v1.22.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f // indirect
github.com/containerd/containerd v1.6.26 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/containerd/fifo v1.0.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/ttrpc v1.1.2 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/docker/docker v25.0.6+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
Expand All @@ -84,13 +94,18 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.6.0 // indirect
github.com/moby/sys/user v0.2.0 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/opencontainers/selinux v1.10.1 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand All @@ -115,7 +130,6 @@ require (
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sync v0.18.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.11.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
Expand Down
Loading
Loading
Toggle all file notes Toggle all file annotations

Footer

© 2026 GitHub, Inc.