Skip to content

Commit 8a8e556

Browse files
committed
klog update
1 parent d428010 commit 8a8e556

38 files changed

+69
-1902
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
k8s.io/apimachinery v0.20.0
2222
k8s.io/client-go v11.0.0+incompatible
2323
k8s.io/component-base v0.20.0
24-
k8s.io/klog v1.0.0
24+
k8s.io/klog/v2 v2.4.0
2525
)
2626

2727
replace (

pkg/cmd/start/receiver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/spf13/cobra"
13-
"k8s.io/klog"
13+
"k8s.io/klog/v2"
1414
)
1515

1616
// NewReceiver is a debug endpoint that allows testing of the status destination.

pkg/cmd/start/start.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/openshift/library-go/pkg/serviceability"
1212
"github.com/spf13/cobra"
1313
"k8s.io/client-go/pkg/version"
14-
"k8s.io/klog"
14+
"k8s.io/klog/v2"
1515

1616
"github.com/openshift/insights-operator/pkg/config"
1717
"github.com/openshift/insights-operator/pkg/controller"

pkg/config/configobserver/configobserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
"k8s.io/apimachinery/pkg/util/wait"
1515
"k8s.io/client-go/kubernetes"
16-
"k8s.io/klog"
16+
"k8s.io/klog/v2"
1717

1818
"github.com/openshift/insights-operator/pkg/config"
1919
)

pkg/config/configobserver/configobserver_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"k8s.io/client-go/kubernetes"
1717
clsetfake "k8s.io/client-go/kubernetes/fake"
1818
corefake "k8s.io/client-go/kubernetes/typed/core/v1/fake"
19-
"k8s.io/klog"
19+
"k8s.io/klog/v2"
2020

2121
clienttesting "k8s.io/client-go/testing"
2222
)

pkg/controller/operator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88
"time"
99

10-
"k8s.io/klog"
10+
"k8s.io/klog/v2"
1111

1212
"k8s.io/apimachinery/pkg/api/errors"
1313
"k8s.io/apimachinery/pkg/runtime"

pkg/controller/periodic/periodic.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"sort"
77
"time"
88

9-
"k8s.io/klog"
9+
"k8s.io/klog/v2"
1010

1111
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
1212
"k8s.io/apimachinery/pkg/util/wait"

pkg/controller/status/status.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/apimachinery/pkg/util/wait"
2323
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
24-
"k8s.io/klog"
24+
"k8s.io/klog/v2"
2525
)
2626

2727
// How many upload failures in a row we tolerate before starting reporting

pkg/controller/status/status_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
88
"k8s.io/apimachinery/pkg/runtime"
9-
"k8s.io/klog"
9+
"k8s.io/klog/v2"
1010

1111
configv1 "github.com/openshift/api/config/v1"
1212
configfake "github.com/openshift/client-go/config/clientset/versioned/fake"

pkg/controllerstatus/controllerstatus.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"sync"
55
"time"
66

7-
"k8s.io/klog"
7+
"k8s.io/klog/v2"
88
)
99

1010
type Interface interface {

pkg/gather/clusterconfig/0_gatherer.go

+43-43
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111

1212
"k8s.io/client-go/rest"
13-
"k8s.io/klog"
13+
"k8s.io/klog/v2"
1414

1515
_ "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
1616

@@ -37,33 +37,33 @@ type gatherFunction func(g *Gatherer) ([]record.Record, []error)
3737
const gatherAll = "ALL"
3838

3939
var gatherFunctions = map[string]gatherFunction{
40-
"pdbs": GatherPodDisruptionBudgets,
41-
"metrics": GatherMostRecentMetrics,
42-
"operators": GatherClusterOperators,
43-
"container_images": GatherContainerImages,
44-
"nodes": GatherNodes,
45-
"config_maps": GatherConfigMaps,
46-
"version": GatherClusterVersion,
47-
"id": GatherClusterID,
48-
"infrastructures": GatherClusterInfrastructure,
49-
"networks": GatherClusterNetwork,
50-
"authentication": GatherClusterAuthentication,
51-
"image_registries": GatherClusterImageRegistry,
52-
"image_pruners": GatherClusterImagePruner,
53-
"feature_gates": GatherClusterFeatureGates,
54-
"oauths": GatherClusterOAuth,
55-
"ingress": GatherClusterIngress,
56-
"proxies": GatherClusterProxy,
40+
"pdbs": GatherPodDisruptionBudgets,
41+
"metrics": GatherMostRecentMetrics,
42+
"operators": GatherClusterOperators,
43+
"container_images": GatherContainerImages,
44+
"nodes": GatherNodes,
45+
"config_maps": GatherConfigMaps,
46+
"version": GatherClusterVersion,
47+
"id": GatherClusterID,
48+
"infrastructures": GatherClusterInfrastructure,
49+
"networks": GatherClusterNetwork,
50+
"authentication": GatherClusterAuthentication,
51+
"image_registries": GatherClusterImageRegistry,
52+
"image_pruners": GatherClusterImagePruner,
53+
"feature_gates": GatherClusterFeatureGates,
54+
"oauths": GatherClusterOAuth,
55+
"ingress": GatherClusterIngress,
56+
"proxies": GatherClusterProxy,
5757
"certificate_signing_requests": GatherCertificateSigningRequests,
58-
"crds": GatherCRD,
59-
"host_subnets": GatherHostSubnet,
60-
"machine_sets": GatherMachineSet,
61-
"install_plans": GatherInstallPlans,
62-
"service_accounts": GatherServiceAccounts,
63-
"machine_config_pools": GatherMachineConfigPool,
64-
"container_runtime_configs": GatherContainerRuntimeConfig,
65-
"stateful_sets": GatherStatefulSets,
66-
"netnamespaces": GatherNetNamespace,
58+
"crds": GatherCRD,
59+
"host_subnets": GatherHostSubnet,
60+
"machine_sets": GatherMachineSet,
61+
"install_plans": GatherInstallPlans,
62+
"service_accounts": GatherServiceAccounts,
63+
"machine_config_pools": GatherMachineConfigPool,
64+
"container_runtime_configs": GatherContainerRuntimeConfig,
65+
"stateful_sets": GatherStatefulSets,
66+
"netnamespaces": GatherNetNamespace,
6767
}
6868

6969
// New creates new Gatherer
@@ -144,22 +144,22 @@ func uniqueStrings(list []string) []string {
144144
if len(list) < 2 {
145145
return list
146146
}
147-
keys := make(map[string]bool)
148-
set := []string{}
149-
for _, entry := range list {
150-
if _, value := keys[entry]; !value {
151-
keys[entry] = true
152-
set = append(set, entry)
153-
}
154-
}
155-
return set
147+
keys := make(map[string]bool)
148+
set := []string{}
149+
for _, entry := range list {
150+
if _, value := keys[entry]; !value {
151+
keys[entry] = true
152+
set = append(set, entry)
153+
}
154+
}
155+
return set
156156
}
157157

158158
func contains(s []string, e string) bool {
159-
for _, a := range s {
160-
if a == e {
161-
return true
162-
}
163-
}
164-
return false
165-
}
159+
for _, a := range s {
160+
if a == e {
161+
return true
162+
}
163+
}
164+
return false
165+
}

pkg/gather/clusterconfig/certificate_signing_requests.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
"k8s.io/apimachinery/pkg/util/json"
1515
"k8s.io/client-go/kubernetes"
16-
"k8s.io/klog"
16+
"k8s.io/klog/v2"
1717

1818
"k8s.io/apimachinery/pkg/api/errors"
1919

pkg/gather/clusterconfig/config_maps_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"testing"
99

1010
corev1 "k8s.io/api/core/v1"
11-
"k8s.io/klog"
11+
"k8s.io/klog/v2"
1212

1313
"github.com/openshift/insights-operator/pkg/record"
1414
"github.com/openshift/insights-operator/pkg/utils"

pkg/gather/clusterconfig/container_images.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1111
"k8s.io/client-go/kubernetes"
1212
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
13-
"k8s.io/klog"
13+
"k8s.io/klog/v2"
1414

1515
_ "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
1616

pkg/gather/clusterconfig/custom_resource_definitions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
apixv1beta1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"
88
"k8s.io/apimachinery/pkg/api/errors"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
10-
"k8s.io/klog"
10+
"k8s.io/klog/v2"
1111

1212
_ "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
1313

pkg/gather/clusterconfig/image_pruners.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"k8s.io/apimachinery/pkg/api/errors"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1010
"k8s.io/apimachinery/pkg/runtime"
11-
"k8s.io/klog"
11+
"k8s.io/klog/v2"
1212

1313
registryv1 "github.com/openshift/api/imageregistry/v1"
1414
imageregistryv1client "github.com/openshift/client-go/imageregistry/clientset/versioned"

pkg/gather/clusterconfig/image_registries.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"k8s.io/apimachinery/pkg/api/errors"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1010
"k8s.io/apimachinery/pkg/runtime"
11-
"k8s.io/klog"
11+
"k8s.io/klog/v2"
1212

1313
registryv1 "github.com/openshift/api/imageregistry/v1"
1414
imageregistryv1client "github.com/openshift/client-go/imageregistry/clientset/versioned"

pkg/gather/clusterconfig/operators.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"k8s.io/apimachinery/pkg/runtime"
1818
"k8s.io/apimachinery/pkg/runtime/schema"
1919
"k8s.io/apimachinery/pkg/util/sets"
20-
"k8s.io/klog"
20+
"k8s.io/klog/v2"
2121

2222
configv1 "github.com/openshift/api/config/v1"
2323
configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"

pkg/gather/clusterconfig/recent_metrics.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"io/ioutil"
88

99
"k8s.io/client-go/rest"
10-
"k8s.io/klog"
10+
"k8s.io/klog/v2"
1111

1212
"github.com/openshift/insights-operator/pkg/record"
1313
)

pkg/gather/clusterconfig/service_accounts.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"k8s.io/apimachinery/pkg/util/json"
1212
"k8s.io/client-go/kubernetes"
1313
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
14-
"k8s.io/klog"
14+
"k8s.io/klog/v2"
1515

1616
_ "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
1717

pkg/gather/clusterconfig/stateful_sets.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"k8s.io/client-go/kubernetes"
1212
appsclient "k8s.io/client-go/kubernetes/typed/apps/v1"
1313
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
14-
"k8s.io/klog"
14+
"k8s.io/klog/v2"
1515

1616
appsv1 "k8s.io/api/apps/v1"
1717
_ "k8s.io/apimachinery/pkg/runtime/serializer/yaml"

pkg/insights/insightsclient/insightsclient.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"k8s.io/component-base/metrics"
2424
"k8s.io/component-base/metrics/legacyregistry"
2525

26-
"k8s.io/klog"
26+
"k8s.io/klog/v2"
2727

2828
configv1 "github.com/openshift/api/config/v1"
2929
apimachineryversion "k8s.io/apimachinery/pkg/version"

pkg/insights/insightsreport/insightsreport.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"k8s.io/apimachinery/pkg/util/wait"
1010
"k8s.io/component-base/metrics"
1111
"k8s.io/component-base/metrics/legacyregistry"
12-
"k8s.io/klog"
12+
"k8s.io/klog/v2"
1313

1414
"github.com/openshift/insights-operator/pkg/authorizer"
1515
"github.com/openshift/insights-operator/pkg/config"

pkg/insights/insightsuploader/insightsuploader.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"io"
99
"time"
1010

11-
"k8s.io/klog"
11+
"k8s.io/klog/v2"
1212

1313
"k8s.io/apimachinery/pkg/util/wait"
1414

@@ -177,7 +177,7 @@ func (c *Controller) ArchiveUploaded() <-chan struct{} {
177177
}
178178

179179
func reportToLogs(source io.Reader, klog klog.Verbose) error {
180-
if !klog {
180+
if !klog.Enabled() {
181181
return nil
182182
}
183183
gr, err := gzip.NewReader(source)

pkg/record/diskrecorder/diskrecorder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
"k8s.io/apimachinery/pkg/util/wait"
1818

19-
"k8s.io/klog"
19+
"k8s.io/klog/v2"
2020

2121
"github.com/openshift/insights-operator/pkg/record"
2222
)

vendor/k8s.io/klog/.travis.yml

-16
This file was deleted.

vendor/k8s.io/klog/CONTRIBUTING.md

-22
This file was deleted.

0 commit comments

Comments
 (0)