-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
145 changed files
with
18,746 additions
and
7,474 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
79 changes: 79 additions & 0 deletions
79
agent/taskresource/cgroup/control/cgroupv2_controller_linux.go
This file contains 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
//go:build linux | ||
|
||
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"). You may | ||
// not use this file except in compliance with the License. A copy of the | ||
// License is located at | ||
// | ||
// http://aws.amazon.com/apache2.0/ | ||
// | ||
// or in the "license" file accompanying this file. This file 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 control | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/cihub/seelog" | ||
cgroupsv2 "github.com/containerd/cgroups/v2" | ||
) | ||
|
||
const ( | ||
defaultCgroupv2Path = "/sys/fs/cgroup" | ||
parentCgroupSlice = "/" | ||
) | ||
|
||
// controlv2 is used to implement the cgroup Control interface | ||
type controlv2 struct{} | ||
|
||
// Create creates a new cgroup based off the spec post validation | ||
func (c *controlv2) Create(cgroupSpec *Spec) error { | ||
// Validate incoming spec | ||
err := validateCgroupSpec(cgroupSpec) | ||
if err != nil { | ||
return fmt.Errorf("cgroup create: failed to validate spec: %w", err) | ||
} | ||
|
||
cgroupPath := cgroupSpec.Root | ||
seelog.Infof("Creating cgroup cgroupv2root=%s parentSlice=%s cgroupPath=%s", defaultCgroupv2Path, parentCgroupSlice, cgroupPath) | ||
_, err = cgroupsv2.NewSystemd(parentCgroupSlice, cgroupPath, -1, cgroupsv2.ToResources(cgroupSpec.Specs)) | ||
if err != nil { | ||
return fmt.Errorf("cgroup create: unable to create v2 manager cgroupPath=%s err=%s", cgroupPath, err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// Remove is used to delete the cgroup | ||
func (c *controlv2) Remove(cgroupPath string) error { | ||
seelog.Infof("Removing cgroup cgroupv2root=%s parentSlice=%s cgroupPath=%s", defaultCgroupv2Path, parentCgroupSlice, cgroupPath) | ||
|
||
m, err := cgroupsv2.LoadSystemd(parentCgroupSlice, cgroupPath) | ||
if err != nil { | ||
return err | ||
} | ||
return m.Delete() | ||
} | ||
|
||
// Exists is used to verify the existence of a cgroup | ||
func (c *controlv2) Exists(cgroupPath string) bool { | ||
fullCgroupPath := filepath.Join(defaultCgroupv2Path, parentCgroupSlice, cgroupPath) | ||
seelog.Infof("Checking existence of cgroup cgroupv2root=%s parentSlice=%s cgroupPath=%s fullPath=%s", defaultCgroupv2Path, parentCgroupSlice, cgroupPath, fullCgroupPath) | ||
|
||
if _, err := os.Stat(fullCgroupPath); os.IsNotExist(err) { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
// Init is used to setup the cgroup root for ecs | ||
func (c *controlv2) Init() error { | ||
// In cgroups v2, there is no root "ecs" cgroup, so this function is a no-op. | ||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
8 changes: 3 additions & 5 deletions
8
agent/taskresource/cgroup/control/mock_control/mock_cgroup_control_linux.go
Oops, something went wrong.
This file contains 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
17 changes: 17 additions & 0 deletions
17
agent/vendor/github.com/cilium/ebpf/.clang-format
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
agent/vendor/github.com/cilium/ebpf/.gitignore
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
agent/vendor/github.com/cilium/ebpf/ARCHITECTURE.md
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
agent/vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
agent/vendor/github.com/cilium/ebpf/CONTRIBUTING.md
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
agent/vendor/github.com/cilium/ebpf/LICENSE
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
agent/vendor/github.com/cilium/ebpf/Makefile
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
agent/vendor/github.com/cilium/ebpf/README.md
Oops, something went wrong.
149 changes: 149 additions & 0 deletions
149
agent/vendor/github.com/cilium/ebpf/asm/alu.go
Oops, something went wrong.
107 changes: 107 additions & 0 deletions
107
agent/vendor/github.com/cilium/ebpf/asm/alu_string.go
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
agent/vendor/github.com/cilium/ebpf/asm/doc.go
Oops, something went wrong.
143 changes: 143 additions & 0 deletions
143
agent/vendor/github.com/cilium/ebpf/asm/func.go
Oops, something went wrong.
133 changes: 133 additions & 0 deletions
133
agent/vendor/github.com/cilium/ebpf/asm/func_string.go
Oops, something went wrong.
498 changes: 498 additions & 0 deletions
498
agent/vendor/github.com/cilium/ebpf/asm/instruction.go
Large diffs are not rendered by default.
Oops, something went wrong.
109 changes: 109 additions & 0 deletions
109
agent/vendor/github.com/cilium/ebpf/asm/jump.go
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
agent/vendor/github.com/cilium/ebpf/asm/jump_string.go
Oops, something went wrong.
204 changes: 204 additions & 0 deletions
204
agent/vendor/github.com/cilium/ebpf/asm/load_store.go
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
agent/vendor/github.com/cilium/ebpf/asm/load_store_string.go
Oops, something went wrong.
237 changes: 237 additions & 0 deletions
237
agent/vendor/github.com/cilium/ebpf/asm/opcode.go
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
agent/vendor/github.com/cilium/ebpf/asm/opcode_string.go
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
agent/vendor/github.com/cilium/ebpf/asm/register.go
Oops, something went wrong.
589 changes: 589 additions & 0 deletions
589
agent/vendor/github.com/cilium/ebpf/collection.go
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
agent/vendor/github.com/cilium/ebpf/doc.go
Oops, something went wrong.
930 changes: 930 additions & 0 deletions
930
agent/vendor/github.com/cilium/ebpf/elf_reader.go
Large diffs are not rendered by default.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
agent/vendor/github.com/cilium/ebpf/elf_reader_fuzz.go
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
agent/vendor/github.com/cilium/ebpf/go.mod
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
agent/vendor/github.com/cilium/ebpf/go.sum
Oops, something went wrong.
239 changes: 239 additions & 0 deletions
239
agent/vendor/github.com/cilium/ebpf/info.go
Oops, something went wrong.
791 changes: 791 additions & 0 deletions
791
agent/vendor/github.com/cilium/ebpf/internal/btf/btf.go
Large diffs are not rendered by default.
Oops, something went wrong.
269 changes: 269 additions & 0 deletions
269
agent/vendor/github.com/cilium/ebpf/internal/btf/btf_types.go
Oops, something went wrong.
388 changes: 388 additions & 0 deletions
388
agent/vendor/github.com/cilium/ebpf/internal/btf/core.go
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
agent/vendor/github.com/cilium/ebpf/internal/btf/doc.go
Oops, something went wrong.
281 changes: 281 additions & 0 deletions
281
agent/vendor/github.com/cilium/ebpf/internal/btf/ext_info.go
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
agent/vendor/github.com/cilium/ebpf/internal/btf/fuzz.go
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
agent/vendor/github.com/cilium/ebpf/internal/btf/strings.go
Oops, something went wrong.
871 changes: 871 additions & 0 deletions
871
agent/vendor/github.com/cilium/ebpf/internal/btf/types.go
Large diffs are not rendered by default.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
agent/vendor/github.com/cilium/ebpf/internal/cpu.go
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
agent/vendor/github.com/cilium/ebpf/internal/elf.go
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
agent/vendor/github.com/cilium/ebpf/internal/endian.go
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
agent/vendor/github.com/cilium/ebpf/internal/errors.go
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
agent/vendor/github.com/cilium/ebpf/internal/fd.go
Oops, something went wrong.
138 changes: 138 additions & 0 deletions
138
agent/vendor/github.com/cilium/ebpf/internal/feature.go
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
agent/vendor/github.com/cilium/ebpf/internal/io.go
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
agent/vendor/github.com/cilium/ebpf/internal/ptr.go
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
agent/vendor/github.com/cilium/ebpf/internal/ptr_32_be.go
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
agent/vendor/github.com/cilium/ebpf/internal/ptr_32_le.go
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
agent/vendor/github.com/cilium/ebpf/internal/ptr_64.go
Oops, something went wrong.
179 changes: 179 additions & 0 deletions
179
agent/vendor/github.com/cilium/ebpf/internal/syscall.go
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
agent/vendor/github.com/cilium/ebpf/internal/syscall_string.go
Oops, something went wrong.
170 changes: 170 additions & 0 deletions
170
agent/vendor/github.com/cilium/ebpf/internal/unix/types_linux.go
Oops, something went wrong.
228 changes: 228 additions & 0 deletions
228
agent/vendor/github.com/cilium/ebpf/internal/unix/types_other.go
Oops, something went wrong.
169 changes: 169 additions & 0 deletions
169
agent/vendor/github.com/cilium/ebpf/link/cgroup.go
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
agent/vendor/github.com/cilium/ebpf/link/doc.go
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
agent/vendor/github.com/cilium/ebpf/link/iter.go
Oops, something went wrong.
214 changes: 214 additions & 0 deletions
214
agent/vendor/github.com/cilium/ebpf/link/link.go
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
agent/vendor/github.com/cilium/ebpf/link/netns.go
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
agent/vendor/github.com/cilium/ebpf/link/program.go
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
agent/vendor/github.com/cilium/ebpf/link/raw_tracepoint.go
Oops, something went wrong.
173 changes: 173 additions & 0 deletions
173
agent/vendor/github.com/cilium/ebpf/link/syscalls.go
Oops, something went wrong.
133 changes: 133 additions & 0 deletions
133
agent/vendor/github.com/cilium/ebpf/linker.go
Oops, something went wrong.
1,188 changes: 1,188 additions & 0 deletions
1,188
agent/vendor/github.com/cilium/ebpf/map.go
Large diffs are not rendered by default.
Oops, something went wrong.
216 changes: 216 additions & 0 deletions
216
agent/vendor/github.com/cilium/ebpf/marshalers.go
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
agent/vendor/github.com/cilium/ebpf/pinning.go
Oops, something went wrong.
Oops, something went wrong.