vendor: update system-validators to v1.10.0

This commit is contained in:
Lubomir I. Ivanov
2025-05-21 12:31:52 +03:00
parent 6da56bd4b7
commit aea2743e4e
8 changed files with 32 additions and 31 deletions

2
go.mod
View File

@@ -115,7 +115,7 @@ require (
k8s.io/mount-utils v0.0.0
k8s.io/pod-security-admission v0.0.0
k8s.io/sample-apiserver v0.0.0
k8s.io/system-validators v1.9.1
k8s.io/system-validators v1.10.0
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979
sigs.k8s.io/knftables v0.0.17
sigs.k8s.io/randfill v1.0.0

5
go.sum
View File

@@ -425,6 +425,7 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
@@ -478,8 +479,8 @@ k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUyGcf03XZEP0ZIKgKj35LS4=
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8=
k8s.io/system-validators v1.9.1 h1:O8xrr08foamG+1uQjAdiTLt/fT+QQJ4QNREfCWvuOws=
k8s.io/system-validators v1.9.1/go.mod h1:d4UVrxKu52s0BHU984Peb9VpIq4V9sd8xjTBV/waY/I=
k8s.io/system-validators v1.10.0 h1:JaevkALQp54cKsm1/KzuwXVWCTqL1Ds0zysbFjj/J8I=
k8s.io/system-validators v1.10.0/go.mod h1:awfSS706v9R12VC7u7K89FKfqVy44G+E0L1A0FX9Wmw=
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 h1:jgJW5IePPXLGB8e/1wvd0Ich9QE97RvvF3a8J3fP/Lg=
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=

View File

@@ -23,7 +23,6 @@ import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -196,7 +195,7 @@ func (c *CgroupsValidator) getCgroupV2Subsystems(unifiedMountpoint string) ([]st
if freezeSupported {
subsystems = append(subsystems, "freezer")
}
data, err := ioutil.ReadFile(filepath.Join(unifiedMountpoint, "cgroup.controllers"))
data, err := os.ReadFile(filepath.Join(unifiedMountpoint, "cgroup.controllers"))
if err != nil {
return nil, err, warn
}

View File

@@ -22,7 +22,6 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -198,7 +197,7 @@ func (k *KernelValidator) getKernelConfigReader() (io.Reader, error) {
}
// Buffer the whole file, so that we can close the file and unload
// kernel config module in this function.
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return nil, err
}

View File

@@ -21,8 +21,9 @@ package system
import (
"fmt"
"os/exec"
"strings"
"golang.org/x/sys/unix"
)
var _ Validator = &OSValidator{}
@@ -39,11 +40,13 @@ func (o *OSValidator) Name() string {
// Validate is part of the system.Validator interface.
func (o *OSValidator) Validate(spec SysSpec) ([]error, []error) {
os, err := exec.Command("uname").CombinedOutput()
var utsname unix.Utsname
err := unix.Uname(&utsname)
if err != nil {
return nil, []error{fmt.Errorf("failed to get OS name: %w", err)}
}
if err = o.validateOS(strings.TrimSpace(string(os)), spec.OS); err != nil {
os := strings.TrimSpace(unix.ByteSliceToString(utsname.Sysname[:]))
if err = o.validateOS(os, spec.OS); err != nil {
return nil, []error{err}
}
return nil, nil

View File

@@ -22,7 +22,7 @@ package system
import (
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
@@ -159,19 +159,10 @@ func (validator *packageValidator) validate(packageSpecs []PackageSpec, manager
return nil, errs
}
// getKernelRelease returns the kernel release of the local machine.
func getKernelRelease() (string, error) {
output, err := exec.Command("uname", "-r").Output()
if err != nil {
return "", fmt.Errorf("failed to get kernel release: %w", err)
}
return strings.TrimSpace(string(output)), nil
}
// getOSDistro returns the OS distro of the local machine.
func getOSDistro() (string, error) {
f := "/etc/lsb-release"
b, err := ioutil.ReadFile(f)
b, err := os.ReadFile(f)
if err != nil {
return "", fmt.Errorf("failed to read %q: %w", f, err)
}

View File

@@ -20,17 +20,19 @@ limitations under the License.
package system
import (
"os/exec"
"fmt"
"strings"
"golang.org/x/sys/unix"
)
// DefaultSysSpec is the default SysSpec for Linux
var DefaultSysSpec = SysSpec{
OS: "Linux",
KernelSpec: KernelSpec{
// 4.19 is an active kernel Long Term Support (LTS) release, tracked in https://www.kernel.org/category/releases.html.
Versions: []string{`^4\.19.*$`, `^4\.[2-9][0-9].*$`, `^([5-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`},
VersionsNote: "Recommended LTS version from the 4.x series is 4.19. Any 5.x or 6.x versions are also supported. For cgroups v2 support, the minimal version is 4.15 and the recommended version is 5.8+",
// 5.4, 5.10, 5.15 is an active kernel Long Term Support (LTS) release, tracked in https://www.kernel.org/category/releases.html.
Versions: []string{`^5\.4.*$`, `^5\.10.*$`, `^5\.15.*$`, `^([6-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`},
VersionsNote: "Supported LTS versions from the 5.x series are 5.4, 5.10 and 5.15. Any 6.x version is also supported. For cgroups v2 support, the recommended version is 5.10 or newer",
// TODO(random-liu): Add more config
// TODO(random-liu): Add description for each kernel configuration:
Required: []KernelConfig{
@@ -96,9 +98,15 @@ var _ KernelValidatorHelper = &KernelValidatorHelperImpl{}
// GetKernelReleaseVersion returns the kernel release version (ex. 4.4.0-96-generic) as a string
func (o *KernelValidatorHelperImpl) GetKernelReleaseVersion() (string, error) {
releaseVersion, err := exec.Command("uname", "-r").CombinedOutput()
if err != nil {
return "", err
}
return strings.TrimSpace(string(releaseVersion)), nil
return getKernelRelease()
}
// getKernelRelease returns the kernel release of the local machine.
func getKernelRelease() (string, error) {
var utsname unix.Utsname
err := unix.Uname(&utsname)
if err != nil {
return "", fmt.Errorf("failed to get kernel release: %w", err)
}
return strings.TrimSpace(unix.ByteSliceToString(utsname.Release[:])), nil
}

2
vendor/modules.txt vendored
View File

@@ -1152,7 +1152,7 @@ k8s.io/kube-openapi/pkg/validation/validate
## explicit; go 1.24.0
# k8s.io/sample-apiserver v0.0.0 => ./staging/src/k8s.io/sample-apiserver
## explicit; go 1.24.0
# k8s.io/system-validators v1.9.1
# k8s.io/system-validators v1.10.0
## explicit; go 1.16
k8s.io/system-validators/validators
# k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979