mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
kube-controller-manager: readjust log verbosity
- Increase the global level for broadcaster's logging to 3 so that users can ignore event messages by lowering the logging level. It reduces information noise. - Making sure the context is properly injected into the broadcaster, this will allow the -v flag value to be used also in that broadcaster, rather than the above global value. - test: use cancellation from ktesting - golangci-hints: checked error return value
This commit is contained in:
@@ -29,9 +29,9 @@ import (
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/component-base/metrics/testutil"
|
||||
endpointsliceutil "k8s.io/endpointslice/util"
|
||||
"k8s.io/klog/v2/ktesting"
|
||||
endpointsv1 "k8s.io/kubernetes/pkg/api/v1/endpoints"
|
||||
"k8s.io/kubernetes/pkg/controller/endpointslicemirroring/metrics"
|
||||
"k8s.io/kubernetes/test/utils/ktesting"
|
||||
"k8s.io/utils/pointer"
|
||||
)
|
||||
|
||||
@@ -1007,6 +1007,7 @@ func TestReconcile(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.testName, func(t *testing.T) {
|
||||
tCtx := ktesting.Init(t)
|
||||
client := newClientset()
|
||||
setupMetrics()
|
||||
namespace := "test"
|
||||
@@ -1037,7 +1038,7 @@ func TestReconcile(t *testing.T) {
|
||||
if maxEndpointsPerSubset == 0 {
|
||||
maxEndpointsPerSubset = defaultMaxEndpointsPerSubset
|
||||
}
|
||||
r := newReconciler(client, maxEndpointsPerSubset)
|
||||
r := newReconciler(tCtx, client, maxEndpointsPerSubset)
|
||||
reconcileHelper(t, r, &endpoints, tc.existingEndpointSlices)
|
||||
|
||||
numExtraActions := len(client.Actions()) - numInitialActions
|
||||
@@ -1057,8 +1058,8 @@ func TestReconcile(t *testing.T) {
|
||||
|
||||
// Test Helpers
|
||||
|
||||
func newReconciler(client *fake.Clientset, maxEndpointsPerSubset int32) *reconciler {
|
||||
broadcaster := record.NewBroadcaster()
|
||||
func newReconciler(ctx context.Context, client *fake.Clientset, maxEndpointsPerSubset int32) *reconciler {
|
||||
broadcaster := record.NewBroadcaster(record.WithContext(ctx))
|
||||
recorder := broadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "endpoint-slice-mirroring-controller"})
|
||||
|
||||
return &reconciler{
|
||||
|
||||
Reference in New Issue
Block a user