mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
Merge pull request #113910 from mengjiao-liu/contextual-logging-pkg-controller-certificates
clusterroleaggregation: use contextual logging
This commit is contained in:
commit
c88b61f553
@ -21,10 +21,12 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/controller-manager/controller"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/controller/clusterroleaggregation"
|
||||
)
|
||||
|
||||
func startClusterRoleAggregrationController(ctx context.Context, controllerContext ControllerContext) (controller.Interface, bool, error) {
|
||||
ctx = klog.NewContext(ctx, klog.LoggerWithName(klog.FromContext(ctx), "clusterrole-aggregation-controller"))
|
||||
if !controllerContext.AvailableResources[schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterroles"}] {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
@ -185,8 +185,9 @@ func (c *ClusterRoleAggregationController) Run(ctx context.Context, workers int)
|
||||
defer utilruntime.HandleCrash()
|
||||
defer c.queue.ShutDown()
|
||||
|
||||
klog.Infof("Starting ClusterRoleAggregator")
|
||||
defer klog.Infof("Shutting down ClusterRoleAggregator")
|
||||
logger := klog.FromContext(ctx)
|
||||
logger.Info("Starting ClusterRoleAggregator controller")
|
||||
defer logger.Info("Shutting down ClusterRoleAggregator controller")
|
||||
|
||||
if !cache.WaitForNamedCacheSync("ClusterRoleAggregator", ctx.Done(), c.clusterRolesSynced) {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user