This is an automated email from the ASF dual-hosted git repository. wilfred-s pushed a commit to branch branch-1.9 in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git
commit a024655cba6ce7c814c8907cd87619d7b43652eb Author: Wilfred Spiegelenburg <[email protected]> AuthorDate: Wed Jul 1 10:34:42 2026 +1000 [YUNIKORN-2634] Deprecate user resolution handling via the label (#1047) Add the deprecation logger like it is available in the core. Log the usage of the 'userLabelKey' in the config via the deprecation logger at the WARN level. Log the retrieval of the username from a pod using the deprecation logger at the WARN level. Cleanup of unused loggers (plugin and appmgmt). Closes: #1047 Signed-off-by: Wilfred Spiegelenburg <[email protected]> (cherry picked from commit b8a9097087456c018f76145f82d5bc31b712b893) --- pkg/common/utils/utils.go | 12 ++++++++---- pkg/log/logger.go | 31 +++++++++++++++---------------- pkg/log/logger_test.go | 2 +- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/pkg/common/utils/utils.go b/pkg/common/utils/utils.go index 0432b07a..a5d5a1d1 100644 --- a/pkg/common/utils/utils.go +++ b/pkg/common/utils/utils.go @@ -341,14 +341,18 @@ func GetUserFromPod(pod *v1.Pod) (string, []string) { // Label is processed for backwards compatibility userLabelKey := conf.GetSchedulerConf().UserLabelKey + if userLabelKey != "" { + log.Log(log.Deprecation).Warn("'userLabelKey' config is deprecated, use 'user.info' annotation") + } // UserLabelKey should not be empty - if len(userLabelKey) == 0 { + if userLabelKey == "" { userLabelKey = constants.DefaultUserLabel } - // User name to be defined in labels + // Username to be defined in labels if username := GetPodLabelValue(pod, userLabelKey); username != "" && len(username) > 0 { - log.Log(log.ShimUtils).Info("Found user name from pod labels.", - zap.String("userLabel", userLabelKey), zap.String("user", username)) + log.Log(log.Deprecation).Warn("Found user name from pod label", + zap.String("userLabel", userLabelKey), + zap.String("user", username)) return username, nil } value := constants.DefaultUser diff --git a/pkg/log/logger.go b/pkg/log/logger.go index 1ac6291d..2c662be7 100644 --- a/pkg/log/logger.go +++ b/pkg/log/logger.go @@ -56,15 +56,15 @@ var ( Shim = &LoggerHandle{id: 0, name: "shim"} Kubernetes = &LoggerHandle{id: 1, name: "kubernetes"} Test = &LoggerHandle{id: 2, name: "test"} - Admission = &LoggerHandle{id: 3, name: "admission"} - AdmissionClient = &LoggerHandle{id: 4, name: "admission.client"} - AdmissionConf = &LoggerHandle{id: 5, name: "admission.conf"} - AdmissionWebhook = &LoggerHandle{id: 6, name: "admission.webhook"} - AdmissionUtils = &LoggerHandle{id: 7, name: "admission.utils"} - ShimContext = &LoggerHandle{id: 8, name: "shim.context"} - ShimFSM = &LoggerHandle{id: 9, name: "shim.fsm"} - ShimCacheApplication = &LoggerHandle{id: 10, name: "shim.cache.application"} - ShimCacheAppMgmt = &LoggerHandle{id: 11, name: "shim.cache.appmgmt"} + Deprecation = &LoggerHandle{id: 3, name: "deprecation"} + Admission = &LoggerHandle{id: 4, name: "admission"} + AdmissionClient = &LoggerHandle{id: 5, name: "admission.client"} + AdmissionConf = &LoggerHandle{id: 6, name: "admission.conf"} + AdmissionWebhook = &LoggerHandle{id: 7, name: "admission.webhook"} + AdmissionUtils = &LoggerHandle{id: 8, name: "admission.utils"} + ShimContext = &LoggerHandle{id: 9, name: "shim.context"} + ShimFSM = &LoggerHandle{id: 10, name: "shim.fsm"} + ShimCacheApplication = &LoggerHandle{id: 11, name: "shim.cache.application"} ShimCacheNode = &LoggerHandle{id: 12, name: "shim.cache.node"} ShimCacheTask = &LoggerHandle{id: 13, name: "shim.cache.task"} ShimCacheExternal = &LoggerHandle{id: 14, name: "shim.cache.external"} @@ -76,19 +76,18 @@ var ( ShimConfig = &LoggerHandle{id: 20, name: "shim.config"} ShimDispatcher = &LoggerHandle{id: 21, name: "shim.dispatcher"} ShimScheduler = &LoggerHandle{id: 22, name: "shim.scheduler"} - ShimSchedulerPlugin = &LoggerHandle{id: 23, name: "shim.scheduler.plugin"} - ShimPredicates = &LoggerHandle{id: 24, name: "shim.predicates"} - ShimFramework = &LoggerHandle{id: 25, name: "shim.framework"} - ShimPlaceHolderConfig = &LoggerHandle{id: 26, name: "shim.placeholder.config"} + ShimPredicates = &LoggerHandle{id: 23, name: "shim.predicates"} + ShimFramework = &LoggerHandle{id: 24, name: "shim.framework"} + ShimPlaceHolderConfig = &LoggerHandle{id: 25, name: "shim.placeholder.config"} ) // this tracks all the known logger handles, used to preallocate the real logger instances when configuration changes var loggers = []*LoggerHandle{ - Shim, Kubernetes, Test, + Shim, Kubernetes, Test, Deprecation, Admission, AdmissionClient, AdmissionConf, AdmissionWebhook, AdmissionUtils, ShimContext, ShimFSM, - ShimCacheApplication, ShimCacheAppMgmt, ShimCacheNode, ShimCacheTask, ShimCacheExternal, ShimCachePlaceholder, + ShimCacheApplication, ShimCacheNode, ShimCacheTask, ShimCacheExternal, ShimCachePlaceholder, ShimRMCallback, ShimClient, ShimResources, ShimUtils, ShimConfig, ShimDispatcher, - ShimScheduler, ShimSchedulerPlugin, ShimPredicates, ShimFramework, ShimPlaceHolderConfig, + ShimScheduler, ShimPredicates, ShimFramework, ShimPlaceHolderConfig, } // structure to hold all current logger configuration state diff --git a/pkg/log/logger_test.go b/pkg/log/logger_test.go index e373d7ca..01a50828 100644 --- a/pkg/log/logger_test.go +++ b/pkg/log/logger_test.go @@ -38,7 +38,7 @@ func TestLoggerIds(t *testing.T) { _ = Log(Test) // validate logger count - assert.Equal(t, 27, len(loggers), "wrong logger count") + assert.Equal(t, 26, len(loggers), "wrong logger count") // validate that all loggers are populated and have sequential ids for i := 0; i < len(loggers); i++ { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
