@@ -15,6 +15,7 @@ import (
15
15
v1listers "k8s.io/client-go/listers/core/v1"
16
16
cache "k8s.io/client-go/tools/cache"
17
17
"k8s.io/component-base/featuregate"
18
+ "k8s.io/klog/v2"
18
19
api "k8s.io/kubernetes/pkg/apis/core"
19
20
"k8s.io/kubernetes/pkg/auth/nodeidentifier"
20
21
)
@@ -47,6 +48,7 @@ func NewMinimumKubeletVersion(minVersion *semver.Version,
47
48
48
49
func (m * minimumKubeletVersionAuth ) Authorize (ctx context.Context , attrs authorizer.Attributes ) (authorizer.Decision , string , error ) {
49
50
if m .minVersion == nil {
51
+ klog .Infof ("XXXXXXXX not enabled %v" , attrs .GetUser ())
50
52
return authorizer .DecisionNoOpinion , "" , nil
51
53
}
52
54
@@ -57,34 +59,42 @@ func (m *minimumKubeletVersionAuth) Authorize(ctx context.Context, attrs authori
57
59
switch requestResource {
58
60
case api .Resource ("nodes" ):
59
61
if v := attrs .GetVerb (); v == "get" || v == "update" {
62
+ klog .Infof ("XXXXXXXX nodes %v" , attrs .GetUser ())
60
63
return authorizer .DecisionNoOpinion , "" , nil
61
64
}
62
65
case authorizationv1 .Resource ("subjectaccessreviews" ):
66
+ klog .Infof ("XXXXXXXX SAR %v" , attrs .GetUser ())
63
67
return authorizer .DecisionNoOpinion , "" , nil
64
68
}
65
69
}
66
70
67
71
nodeName , isNode := m .nodeIdentifier .NodeIdentity (attrs .GetUser ())
68
72
if ! isNode {
73
+ klog .Infof ("XXXXXXXX not a node %v" , attrs .GetUser ())
69
74
// ignore requests from non-nodes
70
75
return authorizer .DecisionNoOpinion , "" , nil
71
76
}
72
77
73
78
if ! m .hasNodeInformerSyncedFn () {
79
+ klog .Infof ("XXXXXXXX not synced %v" , attrs .GetUser ())
74
80
return authorizer .DecisionDeny , "" , fmt .Errorf ("node informer not synced, cannot check if node %s is new enough" , nodeName )
75
81
}
76
82
77
83
node , err := m .nodeLister .Get (nodeName )
78
84
if err != nil {
85
+ klog .Infof ("XXXXXXXX failed to get %v" , attrs .GetUser ())
79
86
return authorizer .DecisionDeny , "" , err
80
87
}
81
88
82
89
if err := nodelib .IsNodeTooOld (node , m .minVersion ); err != nil {
83
90
if errors .Is (err , nodelib .ErrKubeletOutdated ) {
91
+ klog .Infof ("XXXXXXXX outdated %v" , attrs .GetUser ())
84
92
return authorizer .DecisionDeny , err .Error (), nil
85
93
}
94
+ klog .Infof ("XXXXXXXX other err %v" , attrs .GetUser ())
86
95
return authorizer .DecisionDeny , "" , err
87
96
}
88
97
98
+ klog .Infof ("XXXXXXXX success %v" , attrs .GetUser ())
89
99
return authorizer .DecisionNoOpinion , "" , nil
90
100
}
0 commit comments