Skip to content

Commit

Permalink
Merge pull request #459 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 12.116.0
  • Loading branch information
andyone authored Apr 22, 2024
2 parents 8968fd0 + 6b832f2 commit 955f3e9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

### 12.116.0

- `[support]` Added Yandex Serverless support
- `[system/container]` Added Yandex Serverless support

### 12.115.0

- `[knf/united]` Added method `GetMapping`
Expand Down
2 changes: 1 addition & 1 deletion ek.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// ////////////////////////////////////////////////////////////////////////////////// //

// VERSION is current ek package version
const VERSION = "12.115.0"
const VERSION = "12.116.0"

// ////////////////////////////////////////////////////////////////////////////////// //

Expand Down
2 changes: 2 additions & 0 deletions support/support_nix.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ func (i *Info) printOSInfo() {
format(12, true, "Container", "Yes (Podman)")
case "lxc":
format(12, true, "Container", "Yes (LXC)")
case "yandex":
format(12, true, "Container", "Yes (Yandex Serverless)")
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions support/support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ func (s *SupportSuite) TestCollect(c *C) {
i.printOSInfo()
i.System.ContainerEngine = "lxc"
i.printOSInfo()
i.System.ContainerEngine = "yandex"
i.printOSInfo()
}

func (s *SupportSuite) TestNil(c *C) {
Expand Down
3 changes: 3 additions & 0 deletions system/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
DOCKER = "docker" // Docker (Moby)
PODMAN = "podman" // Podman
LXC = "lxc" // LXC
YANDEX = "yandex" // Yandex Serverless
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down Expand Up @@ -64,6 +65,8 @@ func IsContainer() bool {
// guessEngine tries to guess container engine based on information from /proc/1/mounts
func guessEngine(mountsData string) string {
switch {
case strings.Contains(mountsData, "overlay-container /function/code/rootfs"):
return YANDEX
case strings.Contains(mountsData, "lxcfs "):
return LXC
case strings.Contains(mountsData, "workdir=/var/lib/containers"):
Expand Down
9 changes: 9 additions & 0 deletions system/container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,nosuid,size=930048k,nr_inodes=232512,mode=755 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0`), 0644)

os.WriteFile(s.DataDir+"/yandex", []byte(`overlay-container /function/code/rootfs overlay rw,relatime,lowerdir=/function/code/3c854c8cbf469fda815b8f6183300c07cfa2fbb5703859ca79aff93ae934961b,upperdir=/tmp/.overlay/tmp/diff,workdir=/tmp/.overlay/tmp/work 0 0
devtmpfs /function/code/rootfs/dev devtmpfs rw,relatime,size=18464k,nr_inodes=4616,mode=755 0 0
/var/run /function/code/rootfs/etc/resolv.conf tmpfs rw,relatime,size=20400k,nr_inodes=5100 0 0`), 0644)

os.WriteFile(s.DataDir+"/lxc", []byte(`none /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime 0 0
lxcfs /proc/cpuinfo fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0`), 0644)

Expand All @@ -60,6 +64,11 @@ func (s *ContainerSuite) TestGetEngine(c *C) {

engineChecked = false

mountsFile = s.DataDir + "/yandex"
c.Assert(GetEngine(), Equals, YANDEX)

engineChecked = false

mountsFile = s.DataDir + "/lxc"
c.Assert(GetEngine(), Equals, LXC)

Expand Down

0 comments on commit 955f3e9

Please sign in to comment.