1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-28 14:41:10 +01:00

update k8s to v1.33

Signed-off-by: dongjiang <dongjiang1989@126.com>
This commit is contained in:
dongjiang
2025-04-28 10:12:24 +08:00
parent 6e9622bf41
commit a249c9baf0
1273 changed files with 79284 additions and 28462 deletions

View File

@@ -26,7 +26,6 @@ import (
"fmt"
"io"
"os"
"os/user"
"path/filepath"
"runtime"
"strings"
@@ -68,9 +67,8 @@ func init() {
host = shortHostname(h)
}
current, err := user.Current()
if err == nil {
userName = current.Username
if u := lookupUser(); u != "" {
userName = u
}
// Sanitize userName since it is used to construct file paths.
userName = strings.Map(func(r rune) rune {

12
vendor/github.com/golang/glog/glog_file_nonwindows.go generated vendored Normal file
View File

@@ -0,0 +1,12 @@
//go:build !windows
package glog
import "os/user"
func lookupUser() string {
if current, err := user.Current(); err == nil {
return current.Username
}
return ""
}

30
vendor/github.com/golang/glog/glog_file_windows.go generated vendored Normal file
View File

@@ -0,0 +1,30 @@
//go:build windows
package glog
import (
"syscall"
)
// This follows the logic in the standard library's user.Current() function, except
// that it leaves out the potentially expensive calls required to look up the user's
// display name in Active Directory.
func lookupUser() string {
token, err := syscall.OpenCurrentProcessToken()
if err != nil {
return ""
}
defer token.Close()
tokenUser, err := token.GetTokenUser()
if err != nil {
return ""
}
username, _, accountType, err := tokenUser.User.Sid.LookupAccount("")
if err != nil {
return ""
}
if accountType != syscall.SidTypeUser {
return ""
}
return username
}