build(deps): bump github.com/open-policy-agent/opa from 0.51.0 to 0.59.0
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 0.51.0 to 0.59.0. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v0.51.0...v0.59.0) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
a6a6c22c14
commit
1f069c7c00
-1
@@ -331,7 +331,6 @@ type deviceKey struct {
|
||||
// keyed by major and minor number. Since devices may be mapped multiple times,
|
||||
// we err on taking the first occurrence.
|
||||
func getDevices(r io.Reader) (map[deviceKey]string, error) {
|
||||
|
||||
var (
|
||||
s = bufio.NewScanner(r)
|
||||
devices = make(map[deviceKey]string)
|
||||
|
||||
+7
-3
@@ -41,7 +41,7 @@ func New(path Path, resources *specs.LinuxResources, opts ...InitOpts) (Cgroup,
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
subsystems, err := config.hiearchy()
|
||||
subsystems, err := config.hierarchy()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func Load(path Path, opts ...InitOpts) (Cgroup, error) {
|
||||
}
|
||||
}
|
||||
var activeSubsystems []Subsystem
|
||||
subsystems, err := config.hiearchy()
|
||||
subsystems, err := config.hierarchy()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -158,7 +158,7 @@ func (c *cgroup) subsystemsFilter(subsystems ...Name) []Subsystem {
|
||||
return c.subsystems
|
||||
}
|
||||
|
||||
var filteredSubsystems = []Subsystem{}
|
||||
filteredSubsystems := []Subsystem{}
|
||||
for _, s := range c.subsystems {
|
||||
for _, f := range subsystems {
|
||||
if s.Name() == f {
|
||||
@@ -259,6 +259,10 @@ func (c *cgroup) Delete() error {
|
||||
// kernel prevents cgroups with running process from being removed, check the tree is empty
|
||||
procs, err := c.processes(s.Name(), true, cgroupProcs)
|
||||
if err != nil {
|
||||
// if the control group does not exist within a subsystem, then proceed to the next subsystem
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
if len(procs) > 0 {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ type procType = string
|
||||
const (
|
||||
cgroupProcs procType = "cgroup.procs"
|
||||
cgroupTasks procType = "tasks"
|
||||
defaultDirPerm = 0755
|
||||
defaultDirPerm = 0o755
|
||||
)
|
||||
|
||||
// defaultFilePerm is a var so that the test framework can change the filemode
|
||||
|
||||
+1
-1
@@ -472,7 +472,7 @@ func (m *memoryController) memoryEvent(path string, event MemoryEvent) (uintptr,
|
||||
defer evtFile.Close()
|
||||
data := fmt.Sprintf("%d %d %s", efd, evtFile.Fd(), event.Arg())
|
||||
evctlPath := filepath.Join(root, "cgroup.event_control")
|
||||
if err := os.WriteFile(evctlPath, []byte(data), 0700); err != nil {
|
||||
if err := os.WriteFile(evctlPath, []byte(data), 0o700); err != nil {
|
||||
unix.Close(efd)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
+3
-3
@@ -36,13 +36,13 @@ type InitOpts func(*InitConfig) error
|
||||
type InitConfig struct {
|
||||
// InitCheck can be used to check initialization errors from the subsystem
|
||||
InitCheck InitCheck
|
||||
hiearchy Hierarchy
|
||||
hierarchy Hierarchy
|
||||
}
|
||||
|
||||
func newInitConfig() *InitConfig {
|
||||
return &InitConfig{
|
||||
InitCheck: RequireDevices,
|
||||
hiearchy: Default,
|
||||
hierarchy: Default,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ func RequireDevices(s Subsystem, _ Path, _ error) error {
|
||||
// The default list is coming from /proc/self/mountinfo.
|
||||
func WithHiearchy(h Hierarchy) InitOpts {
|
||||
return func(c *InitConfig) error {
|
||||
c.hiearchy = h
|
||||
c.hierarchy = h
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
+1
-8
@@ -20,7 +20,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
v1 "github.com/containerd/cgroups/v3/cgroup1/stats"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
@@ -67,16 +66,10 @@ func (p *pidsController) Stat(path string, stats *v1.Metrics) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var max uint64
|
||||
maxData, err := os.ReadFile(filepath.Join(p.Path(path), "pids.max"))
|
||||
max, err := readUint(filepath.Join(p.Path(path), "pids.max"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if maxS := strings.TrimSpace(string(maxData)); maxS != "max" {
|
||||
if max, err = parseUint(maxS, 10, 64); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
stats.Pids = &v1.PidsStat{
|
||||
Current: current,
|
||||
Limit: max,
|
||||
|
||||
-1
@@ -124,7 +124,6 @@ func toRdmaEntry(strEntries []string) []*v1.RdmaEntry {
|
||||
}
|
||||
|
||||
func (p *rdmaController) Stat(path string, stats *v1.Metrics) error {
|
||||
|
||||
currentData, err := os.ReadFile(filepath.Join(p.Path(path), "rdma.current"))
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+2
-3
@@ -29,7 +29,7 @@ import (
|
||||
|
||||
const (
|
||||
SystemdDbus Name = "systemd"
|
||||
defaultSlice = "system.slice"
|
||||
defaultSlice Name = "system.slice"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -56,7 +56,7 @@ func Systemd() ([]Subsystem, error) {
|
||||
|
||||
func Slice(slice, name string) Path {
|
||||
if slice == "" {
|
||||
slice = defaultSlice
|
||||
slice = string(defaultSlice)
|
||||
}
|
||||
return func(subsystem Name) (string, error) {
|
||||
return filepath.Join(slice, name), nil
|
||||
@@ -70,7 +70,6 @@ func NewSystemd(root string) (*SystemdController, error) {
|
||||
}
|
||||
|
||||
type SystemdController struct {
|
||||
mu sync.Mutex
|
||||
root string
|
||||
}
|
||||
|
||||
|
||||
+17
-2
@@ -18,6 +18,7 @@ package cgroup1
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -131,11 +132,25 @@ func hugePageSizes() ([]string, error) {
|
||||
}
|
||||
|
||||
func readUint(path string) (uint64, error) {
|
||||
v, err := os.ReadFile(path)
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return parseUint(strings.TrimSpace(string(v)), 10, 64)
|
||||
defer f.Close()
|
||||
|
||||
// We should only need 20 bytes for the max uint64, but for a nice power of 2
|
||||
// lets use 32.
|
||||
b := make([]byte, 32)
|
||||
n, err := f.Read(b)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
s := string(bytes.TrimSpace(b[:n]))
|
||||
if s == "max" {
|
||||
// Return 0 for the max value to maintain backward compatibility.
|
||||
return 0, nil
|
||||
}
|
||||
return parseUint(s, 10, 64)
|
||||
}
|
||||
|
||||
func parseUint(s string, base, bitSize int) (uint64, error) {
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ func Default() ([]Subsystem, error) {
|
||||
}
|
||||
|
||||
// v1MountPoint returns the mount point where the cgroup
|
||||
// mountpoints are mounted in a single hiearchy
|
||||
// mountpoints are mounted in a single hierarchy
|
||||
func v1MountPoint() (string, error) {
|
||||
f, err := os.Open("/proc/self/mountinfo")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user