diff --git a/go.mod b/go.mod index 6eb3147b8f..fd4148d246 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,9 @@ require ( github.com/ghodss/yaml v1.0.0 github.com/golang/protobuf v1.4.3 github.com/google/go-cmp v0.5.5 - github.com/jaypipes/ghw v0.8.0 + github.com/jaypipes/ghw v0.8.1-0.20210609141030-acb1a36eaf89 github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10 + github.com/k8stopologyawareschedwg/resource-topology-exporter v0.0.0-20210803134815-419046e117f4 github.com/klauspost/cpuid/v2 v2.0.9 github.com/onsi/ginkgo v1.11.0 github.com/onsi/gomega v1.7.0 @@ -27,7 +28,7 @@ require ( k8s.io/apimachinery v0.21.2 k8s.io/client-go v0.21.2 k8s.io/klog/v2 v2.8.0 - k8s.io/kubelet v0.0.0 + k8s.io/kubelet v0.21.0 k8s.io/kubernetes v1.21.2 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/yaml v1.2.0 diff --git a/go.sum b/go.sum index 7fc1a787b5..98d9448dea 100644 --- a/go.sum +++ b/go.sum @@ -421,8 +421,8 @@ github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ishidawataru/sctp v0.0.0-20190723014705-7c296d48a2b5/go.mod h1:DM4VvS+hD/kDi1U1QsX2fnZowwBhqD0Dk3bRPKF/Oc8= -github.com/jaypipes/ghw v0.8.0 h1:02q1pTm9CD83vuhBsEZZhOCS128pq87uyaQeJZkp3sQ= -github.com/jaypipes/ghw v0.8.0/go.mod h1:+gR9bjm3W/HnFi90liF+Fj9GpCe/Dsibl9Im8KmC7c4= +github.com/jaypipes/ghw v0.8.1-0.20210609141030-acb1a36eaf89 h1:bnu/t/cBT64OZyqRAsu9mj0+MPYipVE9XxeKyN2Bobk= +github.com/jaypipes/ghw v0.8.1-0.20210609141030-acb1a36eaf89/go.mod h1:+gR9bjm3W/HnFi90liF+Fj9GpCe/Dsibl9Im8KmC7c4= github.com/jaypipes/pcidb v0.6.0 h1:VIM7GKVaW4qba30cvB67xSCgJPTzkG8Kzw/cbs5PHWU= github.com/jaypipes/pcidb v0.6.0/go.mod h1:L2RGk04sfRhp5wvHO0gfRAMoLY/F3PKv/nwJeVoho0o= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -443,8 +443,11 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7 github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.8/go.mod h1:zRoCNg6LjSQewUwnpORw1VT9mP0rGNQlYy4WYaGWvHo= github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10 h1:wHS+TOQfFY67wkS1roZ5WVyihnE/IQmVsD0zzKtzHrU= github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.0.10/go.mod h1:yJo22okt35DQhvNw3Hgpaol6/oryET8Y5n1CJb9R5mM= +github.com/k8stopologyawareschedwg/resource-topology-exporter v0.0.0-20210803134815-419046e117f4 h1:HwmPIdmAXlSq+RjgZbYjK0S9D1uQaJOq08mJQNxUGZ8= +github.com/k8stopologyawareschedwg/resource-topology-exporter v0.0.0-20210803134815-419046e117f4/go.mod h1:2G4+4ZKZIQ2VVon0UiiI4YuqYYlTHLSUxiuPRUsxa5U= github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -685,10 +688,6 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/swatisehgal/noderesourcetopology-api v0.0.6-0.20210728142040-031453db983f h1:l8m7eeVayME4l6oPuzEAHdyJzBVRze6DAmd7Mu2az4k= -github.com/swatisehgal/noderesourcetopology-api v0.0.6-0.20210728142040-031453db983f/go.mod h1:yJo22okt35DQhvNw3Hgpaol6/oryET8Y5n1CJb9R5mM= -github.com/swatisehgal/noderesourcetopology-api v0.0.6-0.20210728164509-82aa43355060 h1:fki7lgyX2hcmesAZNMmCyRBKj1IKxdJ6I16oYsmalzM= -github.com/swatisehgal/noderesourcetopology-api v0.0.6-0.20210728164509-82aa43355060/go.mod h1:yJo22okt35DQhvNw3Hgpaol6/oryET8Y5n1CJb9R5mM= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/thecodeteam/goscaleio v0.1.0 h1:SB5tO98lawC+UK8ds/U2jyfOCH7GTcFztcF5x9gbut4= @@ -836,6 +835,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210330142815-c8897c278d10/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210716203947-853a461950ff h1:j2EK/QoxYNBsXI4R7fQkkRUk8y6wnOBI+6hgPdP/6Ds= golang.org/x/net v0.0.0-20210716203947-853a461950ff/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -905,6 +905,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= @@ -919,6 +921,7 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1131,6 +1134,7 @@ k8s.io/kubectl v0.21.2 h1:9XPCetvOMDqrIZZXb1Ei+g8t6KrIp9ENJaysQjUuLiE= k8s.io/kubectl v0.21.2/go.mod h1:PgeUclpG8VVmmQIl8zpLar3IQEpFc9mrmvlwY3CK1xo= k8s.io/kubelet v0.21.2 h1:n6PHxrm0FBlAGi7f3hs3CrNqVr+x3ssfrbb0aKqsBzo= k8s.io/kubelet v0.21.2/go.mod h1:1EqOUgp3BqvMXuZZRIlPDNkpgT5MfbJrpEnS4Gxn/mo= +k8s.io/kubernetes v1.21.0/go.mod h1:Yx6XZ8zalyqEk7but+j4+5SvLzdyH1eeqZ4cwO+5dD4= k8s.io/kubernetes v1.21.2 h1:7r1wYSBaMwleFy/VIhdte8G8TUJTmx+MR6Ip2ZsF4NM= k8s.io/kubernetes v1.21.2/go.mod h1:HevHCwYnT2nf/6w8I+b2tpz1NvzJmHZ9nOjh9ng7Rwg= k8s.io/legacy-cloud-providers v0.21.2 h1:W8KdwSbc764/mB4ltFWVRLouv6O0U7T/ji6OvZxVDAk= diff --git a/vendor/github.com/jaypipes/ghw/README.md b/vendor/github.com/jaypipes/ghw/README.md index 6b4f37c1c1..d7f1d59721 100644 --- a/vendor/github.com/jaypipes/ghw/README.md +++ b/vendor/github.com/jaypipes/ghw/README.md @@ -81,6 +81,34 @@ Alternately, you can use the `ghw.WithChroot()` function like so: cpu, err := ghw.CPU(ghw.WithChroot("/host")) ``` +### Overriding the per-mountpoint `ghw` uses + +When running inside containers, it could be a bit cumbersome to just override +the root mountpoint. Inside containers, when granting access to the host +file systems, is more common to bind-mount them in non standard location, +like `/sys` on `/host-sys` or `/proc` on `/host-proc`. +Is rarer to mount them in a common subtree (e.g. `/sys` on `/host/sys` and + `/proc` on /host/proc...) + +To better cover this use case, `ghw` allows to *programmatically* override +the initial component of filesystems subtrees, allowing to access `sysfs` +(or `procfs` or...) mounted on non-standard locations. + + +```go +cpu, err := ghw.CPU(ghw.WithPathOverrides(ghw.PathOverrides{ + "/proc": "/host-proc", + "/sys": "/host-sys", +})) +``` + +Please note +- this feature works in addition and is composable with the + `WithChroot`/`GHW_CHROOT` feature. +- `ghw` doesn't support yet environs variable to override individual + mountpoints, because this could lead to significant environs variables + proliferation. + ### Consuming snapshots You can make `ghw` read from snapshots (created with `ghw-snapshot`) using @@ -811,8 +839,23 @@ The `ghw.PCIDevice` struct has the following fields: The `ghw.PCIAddress` (which is an alias for the `ghw.pci.address.Address` struct) contains the PCI address fields. It has a `ghw.PCIAddress.String()` -method that returns the canonical Domain:Bus:Slot.Function ([D]BSF) -representation of this Address +method that returns the canonical Domain:Bus:Device.Function ([D]BDF) +representation of this Address. + +The `ghw.PCIAddress` struct has the following fields: + +* `ghw.PCIAddress.Domain` is a string representing the PCI domain component of + the address. +* `ghw.PCIAddress.Bus` is a string representing the PCI bus component of + the address. +* `ghw.PCIAddress.Device` is a string representing the PCI device component of + the address. +* `ghw.PCIAddress.Function` is a string representing the PCI function component of + the address. + +**NOTE**: Older versions (pre-`v0.9.0`) erroneously referred to the `Device` +field as the `Slot` field. As noted by [@pearsonk](https://github.com/pearsonk) +in [#220](https://github.com/jaypipes/ghw/issues/220), this was a misnomer. #### Finding a PCI device by PCI address diff --git a/vendor/github.com/jaypipes/ghw/alias.go b/vendor/github.com/jaypipes/ghw/alias.go index 66b4f2b956..0b4e149b33 100644 --- a/vendor/github.com/jaypipes/ghw/alias.go +++ b/vendor/github.com/jaypipes/ghw/alias.go @@ -32,10 +32,13 @@ var ( // match the existing environ variable to minimize surprises WithDisableWarnings = option.WithNullAlerter WithDisableTools = option.WithDisableTools + WithPathOverrides = option.WithPathOverrides ) type SnapshotOptions = option.SnapshotOptions +type PathOverrides = option.PathOverrides + type CPUInfo = cpu.Info var ( diff --git a/vendor/github.com/jaypipes/ghw/pkg/block/block_linux.go b/vendor/github.com/jaypipes/ghw/pkg/block/block_linux.go index 612d3b99b0..078c18dc09 100644 --- a/vendor/github.com/jaypipes/ghw/pkg/block/block_linux.go +++ b/vendor/github.com/jaypipes/ghw/pkg/block/block_linux.go @@ -381,10 +381,10 @@ func partitionInfo(paths *linuxpath.Paths, part string) (string, string, bool) { part = "/dev/" + part } - // /etc/mtab entries for mounted partitions look like this: + // mount entries for mounted partitions look like this: // /dev/sda6 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0 var r io.ReadCloser - r, err := os.Open(paths.EtcMtab) + r, err := os.Open(paths.ProcMounts) if err != nil { return "", "", true } @@ -393,7 +393,7 @@ func partitionInfo(paths *linuxpath.Paths, part string) (string, string, bool) { scanner := bufio.NewScanner(r) for scanner.Scan() { line := scanner.Text() - entry := parseMtabEntry(line) + entry := parseMountEntry(line) if entry == nil || entry.Partition != part { continue } @@ -410,15 +410,15 @@ func partitionInfo(paths *linuxpath.Paths, part string) (string, string, bool) { return "", "", true } -type mtabEntry struct { +type mountEntry struct { Partition string Mountpoint string FilesystemType string Options []string } -func parseMtabEntry(line string) *mtabEntry { - // /etc/mtab entries for mounted partitions look like this: +func parseMountEntry(line string) *mountEntry { + // mount entries for mounted partitions look like this: // /dev/sda6 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0 if line[0] != '/' { return nil @@ -430,7 +430,7 @@ func parseMtabEntry(line string) *mtabEntry { } // We do some special parsing of the mountpoint, which may contain space, - // tab and newline characters, encoded into the mtab entry line using their + // tab and newline characters, encoded into the mount entry line using their // octal-to-string representations. From the GNU mtab man pages: // // "Therefore these characters are encoded in the files and the getmntent @@ -444,7 +444,7 @@ func parseMtabEntry(line string) *mtabEntry { ) mp = r.Replace(mp) - res := &mtabEntry{ + res := &mountEntry{ Partition: fields[0], Mountpoint: mp, FilesystemType: fields[2], diff --git a/vendor/github.com/jaypipes/ghw/pkg/context/context.go b/vendor/github.com/jaypipes/ghw/pkg/context/context.go index 315c2d8bb0..e5ac347104 100644 --- a/vendor/github.com/jaypipes/ghw/pkg/context/context.go +++ b/vendor/github.com/jaypipes/ghw/pkg/context/context.go @@ -19,6 +19,7 @@ type Context struct { SnapshotPath string SnapshotRoot string SnapshotExclusive bool + PathOverrides option.PathOverrides snapshotUnpackedPath string alert option.Alerter } @@ -48,6 +49,10 @@ func New(opts ...*option.Option) *Context { ctx.EnableTools = *merged.EnableTools } + if merged.PathOverrides != nil { + ctx.PathOverrides = merged.PathOverrides + } + return ctx } diff --git a/vendor/github.com/jaypipes/ghw/pkg/linuxpath/path_linux.go b/vendor/github.com/jaypipes/ghw/pkg/linuxpath/path_linux.go index 0322f2e381..c5967d6194 100644 --- a/vendor/github.com/jaypipes/ghw/pkg/linuxpath/path_linux.go +++ b/vendor/github.com/jaypipes/ghw/pkg/linuxpath/path_linux.go @@ -12,12 +12,55 @@ import ( "github.com/jaypipes/ghw/pkg/context" ) +// PathRoots holds the roots of all the filesystem subtrees +// ghw wants to access. +type PathRoots struct { + Etc string + Proc string + Run string + Sys string + Var string +} + +// DefaultPathRoots return the canonical default value for PathRoots +func DefaultPathRoots() PathRoots { + return PathRoots{ + Etc: "/etc", + Proc: "/proc", + Run: "/run", + Sys: "/sys", + Var: "/var", + } +} + +// PathRootsFromContext initialize PathRoots from the given Context, +// allowing overrides of the canonical default paths. +func PathRootsFromContext(ctx *context.Context) PathRoots { + roots := DefaultPathRoots() + if pathEtc, ok := ctx.PathOverrides["/etc"]; ok { + roots.Etc = pathEtc + } + if pathProc, ok := ctx.PathOverrides["/proc"]; ok { + roots.Proc = pathProc + } + if pathRun, ok := ctx.PathOverrides["/run"]; ok { + roots.Run = pathRun + } + if pathSys, ok := ctx.PathOverrides["/sys"]; ok { + roots.Sys = pathSys + } + if pathVar, ok := ctx.PathOverrides["/var"]; ok { + roots.Var = pathVar + } + return roots +} + type Paths struct { VarLog string ProcMeminfo string ProcCpuinfo string + ProcMounts string SysKernelMMHugepages string - EtcMtab string SysBlock string SysDevicesSystemNode string SysDevicesSystemMemory string @@ -31,20 +74,21 @@ type Paths struct { // New returns a new Paths struct containing filepath fields relative to the // supplied Context func New(ctx *context.Context) *Paths { + roots := PathRootsFromContext(ctx) return &Paths{ - VarLog: filepath.Join(ctx.Chroot, "var", "log"), - ProcMeminfo: filepath.Join(ctx.Chroot, "proc", "meminfo"), - ProcCpuinfo: filepath.Join(ctx.Chroot, "proc", "cpuinfo"), - SysKernelMMHugepages: filepath.Join(ctx.Chroot, "sys", "kernel", "mm", "hugepages"), - EtcMtab: filepath.Join(ctx.Chroot, "etc", "mtab"), - SysBlock: filepath.Join(ctx.Chroot, "sys", "block"), - SysDevicesSystemNode: filepath.Join(ctx.Chroot, "sys", "devices", "system", "node"), - SysDevicesSystemMemory: filepath.Join(ctx.Chroot, "sys", "devices", "system", "memory"), - SysBusPciDevices: filepath.Join(ctx.Chroot, "sys", "bus", "pci", "devices"), - SysClassDRM: filepath.Join(ctx.Chroot, "sys", "class", "drm"), - SysClassDMI: filepath.Join(ctx.Chroot, "sys", "class", "dmi"), - SysClassNet: filepath.Join(ctx.Chroot, "sys", "class", "net"), - RunUdevData: filepath.Join(ctx.Chroot, "run", "udev", "data"), + VarLog: filepath.Join(ctx.Chroot, roots.Var, "log"), + ProcMeminfo: filepath.Join(ctx.Chroot, roots.Proc, "meminfo"), + ProcCpuinfo: filepath.Join(ctx.Chroot, roots.Proc, "cpuinfo"), + ProcMounts: filepath.Join(ctx.Chroot, roots.Proc, "self", "mounts"), + SysKernelMMHugepages: filepath.Join(ctx.Chroot, roots.Sys, "kernel", "mm", "hugepages"), + SysBlock: filepath.Join(ctx.Chroot, roots.Sys, "block"), + SysDevicesSystemNode: filepath.Join(ctx.Chroot, roots.Sys, "devices", "system", "node"), + SysDevicesSystemMemory: filepath.Join(ctx.Chroot, roots.Sys, "devices", "system", "memory"), + SysBusPciDevices: filepath.Join(ctx.Chroot, roots.Sys, "bus", "pci", "devices"), + SysClassDRM: filepath.Join(ctx.Chroot, roots.Sys, "class", "drm"), + SysClassDMI: filepath.Join(ctx.Chroot, roots.Sys, "class", "dmi"), + SysClassNet: filepath.Join(ctx.Chroot, roots.Sys, "class", "net"), + RunUdevData: filepath.Join(ctx.Chroot, roots.Run, "udev", "data"), } } diff --git a/vendor/github.com/jaypipes/ghw/pkg/option/option.go b/vendor/github.com/jaypipes/ghw/pkg/option/option.go index 0af8b4cbe6..b2db718832 100644 --- a/vendor/github.com/jaypipes/ghw/pkg/option/option.go +++ b/vendor/github.com/jaypipes/ghw/pkg/option/option.go @@ -129,6 +129,10 @@ type Option struct { // EnableTools optionally request ghw to not call any external program to learn // about the hardware. The default is to use such tools if available. EnableTools *bool + + // PathOverrides optionally allows to override the default paths ghw uses internally + // to learn about the system resources. + PathOverrides PathOverrides } // SnapshotOptions contains options for handling of ghw snapshots @@ -152,6 +156,7 @@ type SnapshotOptions struct { Exclusive bool } +// WithChroot allows to override the root directory ghw uses. func WithChroot(dir string) *Option { return &Option{Chroot: &dir} } @@ -183,6 +188,16 @@ func WithDisableTools() *Option { return &Option{EnableTools: &false_} } +// PathOverrides is a map, keyed by the string name of a mount path, of override paths +type PathOverrides map[string]string + +// WithPathOverrides supplies path-specific overrides for the context +func WithPathOverrides(overrides PathOverrides) *Option { + return &Option{ + PathOverrides: overrides, + } +} + // There is intentionally no Option related to GHW_SNAPSHOT_PRESERVE because we see that as // a debug/troubleshoot aid more something users wants to do regularly. // Hence we allow that only via the environment variable for the time being. @@ -202,6 +217,10 @@ func Merge(opts ...*Option) *Option { if opt.EnableTools != nil { merged.EnableTools = opt.EnableTools } + // intentionally only programmatically + if opt.PathOverrides != nil { + merged.PathOverrides = opt.PathOverrides + } } // Set the default value if missing from mergeOpts if merged.Chroot == nil { diff --git a/vendor/github.com/jaypipes/ghw/pkg/pci/address/address.go b/vendor/github.com/jaypipes/ghw/pkg/pci/address/address.go index 7b1360536e..6a8a4e4575 100644 --- a/vendor/github.com/jaypipes/ghw/pkg/pci/address/address.go +++ b/vendor/github.com/jaypipes/ghw/pkg/pci/address/address.go @@ -17,23 +17,23 @@ var ( ) ) +// Address contains the components of a PCI Address type Address struct { Domain string Bus string - Slot string + Device string Function string } -// String() returns the canonical [D]BSF representation of this Address +// String() returns the canonical [D]BDF representation of this Address func (addr *Address) String() string { - return addr.Domain + ":" + addr.Bus + ":" + addr.Slot + "." + addr.Function + return addr.Domain + ":" + addr.Bus + ":" + addr.Device + "." + addr.Function } -// Given a string address, returns a complete Address struct, filled in with -// domain, bus, slot and function components. The address string may either -// be in $BUS:$SLOT.$FUNCTION (BSF) format or it can be a full PCI address -// that includes the 4-digit $DOMAIN information as well: -// $DOMAIN:$BUS:$SLOT.$FUNCTION. +// FromString returns an Address struct from an ddress string in either +// $BUS:$DEVICE.$FUNCTION (BDF) format or it can be a full PCI address that +// includes the 4-digit $DOMAIN information as well: +// $DOMAIN:$BUS:$DEVICE.$FUNCTION. // // Returns "" if the address string wasn't a valid PCI address. func FromString(address string) *Address { @@ -47,7 +47,7 @@ func FromString(address string) *Address { return &Address{ Domain: dom, Bus: matches[3], - Slot: matches[4], + Device: matches[4], Function: matches[5], } } diff --git a/vendor/github.com/jaypipes/ghw/pkg/pci/pci_linux.go b/vendor/github.com/jaypipes/ghw/pkg/pci/pci_linux.go index 4c6e34a6ae..67c93d0d2e 100644 --- a/vendor/github.com/jaypipes/ghw/pkg/pci/pci_linux.go +++ b/vendor/github.com/jaypipes/ghw/pkg/pci/pci_linux.go @@ -40,7 +40,7 @@ func getDeviceModaliasPath(ctx *context.Context, address string) string { } return filepath.Join( paths.SysBusPciDevices, - pciAddr.Domain+":"+pciAddr.Bus+":"+pciAddr.Slot+"."+pciAddr.Function, + pciAddr.String(), "modalias", ) } diff --git a/vendor/github.com/jaypipes/ghw/pkg/snapshot/clonetree.go b/vendor/github.com/jaypipes/ghw/pkg/snapshot/clonetree.go index d2f75116aa..8f82233c8a 100644 --- a/vendor/github.com/jaypipes/ghw/pkg/snapshot/clonetree.go +++ b/vendor/github.com/jaypipes/ghw/pkg/snapshot/clonetree.go @@ -61,9 +61,9 @@ func ExpectedCloneContent() []string { // thus are safely represented by a static slice - e.g. they don't need to be discovered at runtime. func ExpectedCloneStaticContent() []string { return []string{ - "/etc/mtab", "/proc/cpuinfo", "/proc/meminfo", + "/proc/self/mounts", "/sys/devices/system/cpu/cpu*/cache/index*/*", "/sys/devices/system/cpu/cpu*/topology/*", "/sys/devices/system/memory/block_size_bytes", diff --git a/vendor/github.com/klauspost/cpuid/v2/cpuid.go b/vendor/github.com/klauspost/cpuid/v2/cpuid.go index b49537545f..1d88736b68 100644 --- a/vendor/github.com/klauspost/cpuid/v2/cpuid.go +++ b/vendor/github.com/klauspost/cpuid/v2/cpuid.go @@ -83,6 +83,7 @@ const ( AVX512DQ // AVX-512 Doubleword and Quadword Instructions AVX512ER // AVX-512 Exponential and Reciprocal Instructions AVX512F // AVX-512 Foundation + AVX512FP16 // AVX-512 FP16 Instructions AVX512IFMA // AVX-512 Integer Fused Multiply-Add Instructions AVX512PF // AVX-512 Prefetch Instructions AVX512VBMI // AVX-512 Vector Bit Manipulation Instructions @@ -384,7 +385,6 @@ func (c *CPUInfo) frequencies() { eax, ebx, ecx, _ := cpuid(0x15) if eax != 0 && ebx != 0 && ecx != 0 { c.Hz = (int64(ecx) * int64(ebx)) / int64(eax) - fmt.Println("frequencies(): ", ecx, ebx, eax, "->", c.Hz) } } if mfi >= 0x16 { @@ -981,6 +981,7 @@ func support() flagSet { // edx fs.setIf(edx&(1<<8) != 0, AVX512VP2INTERSECT) fs.setIf(edx&(1<<22) != 0, AMXBF16) + fs.setIf(edx&(1<<23) != 0, AVX512FP16) fs.setIf(edx&(1<<24) != 0, AMXTILE) fs.setIf(edx&(1<<25) != 0, AMXINT8) // eax1 = CPUID.(EAX=7, ECX=1).EAX diff --git a/vendor/github.com/klauspost/cpuid/v2/featureid_string.go b/vendor/github.com/klauspost/cpuid/v2/featureid_string.go index f56af03b9e..b1fe42e467 100644 --- a/vendor/github.com/klauspost/cpuid/v2/featureid_string.go +++ b/vendor/github.com/klauspost/cpuid/v2/featureid_string.go @@ -24,114 +24,115 @@ func _() { _ = x[AVX512DQ-14] _ = x[AVX512ER-15] _ = x[AVX512F-16] - _ = x[AVX512IFMA-17] - _ = x[AVX512PF-18] - _ = x[AVX512VBMI-19] - _ = x[AVX512VBMI2-20] - _ = x[AVX512VL-21] - _ = x[AVX512VNNI-22] - _ = x[AVX512VP2INTERSECT-23] - _ = x[AVX512VPOPCNTDQ-24] - _ = x[AVXSLOW-25] - _ = x[BMI1-26] - _ = x[BMI2-27] - _ = x[CLDEMOTE-28] - _ = x[CLMUL-29] - _ = x[CLZERO-30] - _ = x[CMOV-31] - _ = x[CPBOOST-32] - _ = x[CX16-33] - _ = x[ENQCMD-34] - _ = x[ERMS-35] - _ = x[F16C-36] - _ = x[FMA3-37] - _ = x[FMA4-38] - _ = x[GFNI-39] - _ = x[HLE-40] - _ = x[HTT-41] - _ = x[HWA-42] - _ = x[HYPERVISOR-43] - _ = x[IBPB-44] - _ = x[IBS-45] - _ = x[IBSBRNTRGT-46] - _ = x[IBSFETCHSAM-47] - _ = x[IBSFFV-48] - _ = x[IBSOPCNT-49] - _ = x[IBSOPCNTEXT-50] - _ = x[IBSOPSAM-51] - _ = x[IBSRDWROPCNT-52] - _ = x[IBSRIPINVALIDCHK-53] - _ = x[INT_WBINVD-54] - _ = x[INVLPGB-55] - _ = x[LZCNT-56] - _ = x[MCAOVERFLOW-57] - _ = x[MCOMMIT-58] - _ = x[MMX-59] - _ = x[MMXEXT-60] - _ = x[MOVDIR64B-61] - _ = x[MOVDIRI-62] - _ = x[MPX-63] - _ = x[MSRIRC-64] - _ = x[NX-65] - _ = x[POPCNT-66] - _ = x[RDPRU-67] - _ = x[RDRAND-68] - _ = x[RDSEED-69] - _ = x[RDTSCP-70] - _ = x[RTM-71] - _ = x[RTM_ALWAYS_ABORT-72] - _ = x[SERIALIZE-73] - _ = x[SGX-74] - _ = x[SGXLC-75] - _ = x[SHA-76] - _ = x[SSE-77] - _ = x[SSE2-78] - _ = x[SSE3-79] - _ = x[SSE4-80] - _ = x[SSE42-81] - _ = x[SSE4A-82] - _ = x[SSSE3-83] - _ = x[STIBP-84] - _ = x[SUCCOR-85] - _ = x[TBM-86] - _ = x[TSXLDTRK-87] - _ = x[VAES-88] - _ = x[VMX-89] - _ = x[VPCLMULQDQ-90] - _ = x[WAITPKG-91] - _ = x[WBNOINVD-92] - _ = x[XOP-93] - _ = x[AESARM-94] - _ = x[ARMCPUID-95] - _ = x[ASIMD-96] - _ = x[ASIMDDP-97] - _ = x[ASIMDHP-98] - _ = x[ASIMDRDM-99] - _ = x[ATOMICS-100] - _ = x[CRC32-101] - _ = x[DCPOP-102] - _ = x[EVTSTRM-103] - _ = x[FCMA-104] - _ = x[FP-105] - _ = x[FPHP-106] - _ = x[GPA-107] - _ = x[JSCVT-108] - _ = x[LRCPC-109] - _ = x[PMULL-110] - _ = x[SHA1-111] - _ = x[SHA2-112] - _ = x[SHA3-113] - _ = x[SHA512-114] - _ = x[SM3-115] - _ = x[SM4-116] - _ = x[SVE-117] - _ = x[lastID-118] + _ = x[AVX512FP16-17] + _ = x[AVX512IFMA-18] + _ = x[AVX512PF-19] + _ = x[AVX512VBMI-20] + _ = x[AVX512VBMI2-21] + _ = x[AVX512VL-22] + _ = x[AVX512VNNI-23] + _ = x[AVX512VP2INTERSECT-24] + _ = x[AVX512VPOPCNTDQ-25] + _ = x[AVXSLOW-26] + _ = x[BMI1-27] + _ = x[BMI2-28] + _ = x[CLDEMOTE-29] + _ = x[CLMUL-30] + _ = x[CLZERO-31] + _ = x[CMOV-32] + _ = x[CPBOOST-33] + _ = x[CX16-34] + _ = x[ENQCMD-35] + _ = x[ERMS-36] + _ = x[F16C-37] + _ = x[FMA3-38] + _ = x[FMA4-39] + _ = x[GFNI-40] + _ = x[HLE-41] + _ = x[HTT-42] + _ = x[HWA-43] + _ = x[HYPERVISOR-44] + _ = x[IBPB-45] + _ = x[IBS-46] + _ = x[IBSBRNTRGT-47] + _ = x[IBSFETCHSAM-48] + _ = x[IBSFFV-49] + _ = x[IBSOPCNT-50] + _ = x[IBSOPCNTEXT-51] + _ = x[IBSOPSAM-52] + _ = x[IBSRDWROPCNT-53] + _ = x[IBSRIPINVALIDCHK-54] + _ = x[INT_WBINVD-55] + _ = x[INVLPGB-56] + _ = x[LZCNT-57] + _ = x[MCAOVERFLOW-58] + _ = x[MCOMMIT-59] + _ = x[MMX-60] + _ = x[MMXEXT-61] + _ = x[MOVDIR64B-62] + _ = x[MOVDIRI-63] + _ = x[MPX-64] + _ = x[MSRIRC-65] + _ = x[NX-66] + _ = x[POPCNT-67] + _ = x[RDPRU-68] + _ = x[RDRAND-69] + _ = x[RDSEED-70] + _ = x[RDTSCP-71] + _ = x[RTM-72] + _ = x[RTM_ALWAYS_ABORT-73] + _ = x[SERIALIZE-74] + _ = x[SGX-75] + _ = x[SGXLC-76] + _ = x[SHA-77] + _ = x[SSE-78] + _ = x[SSE2-79] + _ = x[SSE3-80] + _ = x[SSE4-81] + _ = x[SSE42-82] + _ = x[SSE4A-83] + _ = x[SSSE3-84] + _ = x[STIBP-85] + _ = x[SUCCOR-86] + _ = x[TBM-87] + _ = x[TSXLDTRK-88] + _ = x[VAES-89] + _ = x[VMX-90] + _ = x[VPCLMULQDQ-91] + _ = x[WAITPKG-92] + _ = x[WBNOINVD-93] + _ = x[XOP-94] + _ = x[AESARM-95] + _ = x[ARMCPUID-96] + _ = x[ASIMD-97] + _ = x[ASIMDDP-98] + _ = x[ASIMDHP-99] + _ = x[ASIMDRDM-100] + _ = x[ATOMICS-101] + _ = x[CRC32-102] + _ = x[DCPOP-103] + _ = x[EVTSTRM-104] + _ = x[FCMA-105] + _ = x[FP-106] + _ = x[FPHP-107] + _ = x[GPA-108] + _ = x[JSCVT-109] + _ = x[LRCPC-110] + _ = x[PMULL-111] + _ = x[SHA1-112] + _ = x[SHA2-113] + _ = x[SHA3-114] + _ = x[SHA512-115] + _ = x[SM3-116] + _ = x[SM4-117] + _ = x[SVE-118] + _ = x[lastID-119] _ = x[firstID-0] } -const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXINT8AMXTILEAVXAVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXSLOWBMI1BMI2CLDEMOTECLMULCLZEROCMOVCPBOOSTCX16ENQCMDERMSF16CFMA3FMA4GFNIHLEHTTHWAHYPERVISORIBPBIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKINT_WBINVDINVLPGBLZCNTMCAOVERFLOWMCOMMITMMXMMXEXTMOVDIR64BMOVDIRIMPXMSRIRCNXPOPCNTRDPRURDRANDRDSEEDRDTSCPRTMRTM_ALWAYS_ABORTSERIALIZESGXSGXLCSHASSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSUCCORTBMTSXLDTRKVAESVMXVPCLMULQDQWAITPKGWBNOINVDXOPAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFPFPHPGPAJSCVTLRCPCPMULLSHA1SHA2SHA3SHA512SM3SM4SVElastID" +const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXINT8AMXTILEAVXAVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXSLOWBMI1BMI2CLDEMOTECLMULCLZEROCMOVCPBOOSTCX16ENQCMDERMSF16CFMA3FMA4GFNIHLEHTTHWAHYPERVISORIBPBIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKINT_WBINVDINVLPGBLZCNTMCAOVERFLOWMCOMMITMMXMMXEXTMOVDIR64BMOVDIRIMPXMSRIRCNXPOPCNTRDPRURDRANDRDSEEDRDTSCPRTMRTM_ALWAYS_ABORTSERIALIZESGXSGXLCSHASSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSUCCORTBMTSXLDTRKVAESVMXVPCLMULQDQWAITPKGWBNOINVDXOPAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFPFPHPGPAJSCVTLRCPCPMULLSHA1SHA2SHA3SHA512SM3SM4SVElastID" -var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 58, 62, 72, 84, 92, 100, 108, 116, 123, 133, 141, 151, 162, 170, 180, 198, 213, 220, 224, 228, 236, 241, 247, 251, 258, 262, 268, 272, 276, 280, 284, 288, 291, 294, 297, 307, 311, 314, 324, 335, 341, 349, 360, 368, 380, 396, 406, 413, 418, 429, 436, 439, 445, 454, 461, 464, 470, 472, 478, 483, 489, 495, 501, 504, 520, 529, 532, 537, 540, 543, 547, 551, 555, 560, 565, 570, 575, 581, 584, 592, 596, 599, 609, 616, 624, 627, 633, 641, 646, 653, 660, 668, 675, 680, 685, 692, 696, 698, 702, 705, 710, 715, 720, 724, 728, 732, 738, 741, 744, 747, 753} +var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 58, 62, 72, 84, 92, 100, 108, 116, 123, 133, 143, 151, 161, 172, 180, 190, 208, 223, 230, 234, 238, 246, 251, 257, 261, 268, 272, 278, 282, 286, 290, 294, 298, 301, 304, 307, 317, 321, 324, 334, 345, 351, 359, 370, 378, 390, 406, 416, 423, 428, 439, 446, 449, 455, 464, 471, 474, 480, 482, 488, 493, 499, 505, 511, 514, 530, 539, 542, 547, 550, 553, 557, 561, 565, 570, 575, 580, 585, 591, 594, 602, 606, 609, 619, 626, 634, 637, 643, 651, 656, 663, 670, 678, 685, 690, 695, 702, 706, 708, 712, 715, 720, 725, 730, 734, 738, 742, 748, 751, 754, 757, 763} func (i FeatureID) String() string { if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) { diff --git a/vendor/modules.txt b/vendor/modules.txt index 789cb53552..b72e545e14 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -392,7 +392,7 @@ github.com/hpcloud/tail/winfile github.com/imdario/mergo # github.com/inconshreveable/mousetrap v1.0.0 github.com/inconshreveable/mousetrap -# github.com/jaypipes/ghw v0.8.0 +# github.com/jaypipes/ghw v0.8.1-0.20210609141030-acb1a36eaf89 ## explicit github.com/jaypipes/ghw github.com/jaypipes/ghw/pkg/baseboard @@ -430,9 +430,12 @@ github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/apis/topology/v1 github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/generated/clientset/versioned github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/generated/clientset/versioned/scheme github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/generated/clientset/versioned/typed/topology/v1alpha1 +# github.com/k8stopologyawareschedwg/resource-topology-exporter v0.0.0-20210803134815-419046e117f4 +## explicit +github.com/k8stopologyawareschedwg/resource-topology-exporter/test/e2e/utils # github.com/karrick/godirwalk v1.16.1 github.com/karrick/godirwalk -# github.com/klauspost/cpuid/v2 v2.0.7 +# github.com/klauspost/cpuid/v2 v2.0.9 ## explicit github.com/klauspost/cpuid/v2 # github.com/libopenstorage/openstorage v1.0.0 @@ -976,6 +979,15 @@ k8s.io/api/scheduling/v1beta1 k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 +# k8s.io/apiextensions-apiserver v0.21.2 => k8s.io/apiextensions-apiserver v0.21.2 +## explicit +k8s.io/apiextensions-apiserver/pkg/apis/apiextensions +k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 +k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1 +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1 # k8s.io/apimachinery v0.21.2 => k8s.io/apimachinery v0.21.2 ## explicit k8s.io/apimachinery/pkg/api/equality @@ -1502,7 +1514,7 @@ k8s.io/kube-scheduler/extender/v1 # k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.21.2 k8s.io/kubectl/pkg/scale k8s.io/kubectl/pkg/util/podutils -# k8s.io/kubelet v0.0.0 => k8s.io/kubelet v0.21.2 +# k8s.io/kubelet v0.21.0 => k8s.io/kubelet v0.21.2 ## explicit k8s.io/kubelet/config/v1alpha1 k8s.io/kubelet/config/v1beta1 @@ -1790,6 +1802,7 @@ k8s.io/kubernetes/test/e2e/framework/config k8s.io/kubernetes/test/e2e/framework/events k8s.io/kubernetes/test/e2e/framework/ginkgowrapper k8s.io/kubernetes/test/e2e/framework/kubectl +k8s.io/kubernetes/test/e2e/framework/kubelet k8s.io/kubernetes/test/e2e/framework/log k8s.io/kubernetes/test/e2e/framework/manifest k8s.io/kubernetes/test/e2e/framework/metrics @@ -1864,6 +1877,7 @@ k8s.io/legacy-cloud-providers/vsphere/vclib/diskmanagers # k8s.io/mount-utils v0.0.0 => k8s.io/mount-utils v0.21.2 k8s.io/mount-utils # k8s.io/utils v0.0.0-20201110183641-67b214c5f920 +## explicit k8s.io/utils/buffer k8s.io/utils/clock k8s.io/utils/exec