Skip to content

Commit

Permalink
remove direct klog@v1 dep
Browse files Browse the repository at this point in the history
  • Loading branch information
stlaz committed Apr 17, 2024
1 parent e7a6730 commit eb4ffd1
Show file tree
Hide file tree
Showing 29 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion cmd/bridge/config/auth/authoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/openshift/console/cmd/bridge/config/session"
"github.com/openshift/console/pkg/auth"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ require (
k8s.io/apimachinery v0.28.2
k8s.io/cli-runtime v0.28.2
k8s.io/client-go v0.28.2
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.100.1
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/controller-runtime v0.14.7
Expand Down Expand Up @@ -207,6 +206,7 @@ require (
k8s.io/apiserver v0.28.2 // indirect
k8s.io/component-base v0.28.2 // indirect
k8s.io/helm v2.17.0+incompatible // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/kubectl v0.28.2 // indirect
k8s.io/pod-security-admission v0.26.10 // indirect
Expand Down
2 changes: 1 addition & 1 deletion pkg/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
oscrypto "github.com/openshift/library-go/pkg/crypto"

"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/auth/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"
)

var userResource = schema.GroupVersionResource{
Expand Down
2 changes: 1 addition & 1 deletion pkg/auth/sessions/server_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"golang.org/x/oauth2"
"k8s.io/klog"
"k8s.io/klog/v2"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/devfile/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"

"github.com/openshift/console/pkg/serverutils"
"k8s.io/klog"
"k8s.io/klog/v2"

devfile "github.com/devfile/library/v2/pkg/devfile"
"github.com/devfile/library/v2/pkg/devfile/parser"
Expand Down
2 changes: 1 addition & 1 deletion pkg/devfile/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/klog"
"k8s.io/klog/v2"
)

// GetBuildResource gets the build config resource
Expand Down
2 changes: 1 addition & 1 deletion pkg/devfile/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"reflect"

"k8s.io/klog"
"k8s.io/klog/v2"

devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
"github.com/devfile/library/v2/pkg/devfile/parser"
Expand Down
2 changes: 1 addition & 1 deletion pkg/graphql/resolver/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

authn "k8s.io/api/authentication/v1"
authz "k8s.io/api/authorization/v1"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/openshift/console/pkg/proxy"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/actions/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"helm.sh/helm/v3/pkg/cli"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"
)

var settings = initSettings()
Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/actions/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/dynamic"
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/klog"
"k8s.io/klog/v2"
)

// constants
Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/chartproxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"k8s.io/client-go/kubernetes"
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/openshift/console/pkg/version"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/chartproxy/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/openshift/library-go/pkg/crypto"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/knative/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"
)

type KnativeHandler struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/knative/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/openshift/console/pkg/serverutils"

"k8s.io/klog"
"k8s.io/klog/v2"
)

// EventSourceFilter shall filter partial metadata from knative event sources CRDs before propagating
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"path"
"strings"

"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/openshift/console/pkg/proxy"
"github.com/openshift/console/pkg/serverconfig"
Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"

"github.com/gorilla/websocket"
"k8s.io/klog"
"k8s.io/klog/v2"
)

var websocketPingInterval = 30 * time.Second
Expand Down Expand Up @@ -113,7 +113,7 @@ func CopyRequestHeaders(originalRequest, newRequest *http.Request) {

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {

if klog.V(3) {
if klog.V(3).Enabled() {
klog.Infof("PROXY: %#q\n", SingleJoiningSlash(p.config.Endpoint.String(), r.URL.Path))
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/server/kube_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"k8s.io/client-go/discovery"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"
)

func (s *Server) GetKubeVersion() string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/gorilla/websocket"

"k8s.io/klog"
"k8s.io/klog/v2"
)

type HandlerWithUser func(*auth.User, http.ResponseWriter, *http.Request)
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/operands_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/openshift/console/pkg/serverutils"
"github.com/operator-framework/kubectl-operator/pkg/action"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"

"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/resource_lister.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/openshift/console/pkg/serverutils"

"k8s.io/klog"
"k8s.io/klog/v2"
)

// ResourceLister handles resource requests
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"

oauthv1client "github.com/openshift/client-go/oauth/clientset/versioned/typed/oauth/v1"
"github.com/openshift/console/pkg/auth"
Expand Down
2 changes: 1 addition & 1 deletion pkg/serverconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/coreos/pkg/flagutil"
"gopkg.in/yaml.v2"
"k8s.io/klog"
"k8s.io/klog/v2"
)

// MultiKeyValue is used for setting multiple key-value entries of a specific flag, eg.:
Expand Down
2 changes: 1 addition & 1 deletion pkg/serverconfig/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/klog"
"k8s.io/klog/v2"
)

// We don't expect that the plugin metrics changes regularly (without a new console rollout).
Expand Down
2 changes: 1 addition & 1 deletion pkg/serverutils/asynccache/asynccache.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog"
"k8s.io/klog/v2"
)

var ( // make these variable so that we can change them in unit tests
Expand Down
2 changes: 1 addition & 1 deletion pkg/serverutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strings"

"k8s.io/klog"
"k8s.io/klog/v2"
)

// Copied from Server package to maintain error response consistency
Expand Down
2 changes: 1 addition & 1 deletion pkg/terminal/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/openshift/console/pkg/auth"
)
Expand Down
10 changes: 5 additions & 5 deletions pkg/usage/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
authv1 "k8s.io/api/authorization/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/klog"
"k8s.io/klog/v2"
)

// We don't expect that the users metrics (console users count) changes often.
Expand Down Expand Up @@ -95,7 +95,7 @@ func (m *Metrics) updateUsersMetric(internalProxiedK8SClient kubernetes.Interfac
time.Sleep(delayBetweenConsoleUserPermissionChecks)

if !strings.HasPrefix(roleBinding.Name, "user-settings-") || !strings.HasSuffix(roleBinding.Name, "-rolebinding") {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Infof("usage.Metrics: Ignore role binding: %q (name doesn't match user-settings-*-rolebinding)\n", roleBinding.Name)
}
continue
Expand All @@ -113,7 +113,7 @@ func (m *Metrics) updateUsersMetric(internalProxiedK8SClient kubernetes.Interfac
}

if user.Name == "kube:admin" {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Infof("usage.Metrics: Count %q as %q...\n", user.Name, KubeadminUserRole)
}
kubeAdmin++
Expand Down Expand Up @@ -141,12 +141,12 @@ func (m *Metrics) updateUsersMetric(internalProxiedK8SClient kubernetes.Interfac
}

if res.Status.Allowed {
if klog.V(4) && clusterAdmins < 10 {
if klog.V(4).Enabled() && clusterAdmins < 10 {
klog.Infof("usage.Metrics: Count %q as %q...\n", user.Name, ClusterAdminUserRole)
}
clusterAdmins++
} else {
if klog.V(4) && developers < 10 {
if klog.V(4).Enabled() && developers < 10 {
klog.Infof("usage.Metrics: Count %q as %q...\n", user.Name, DeveloperUserRole)
}
developers++
Expand Down
2 changes: 1 addition & 1 deletion pkg/usersettings/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/openshift/console/pkg/auth"
"github.com/openshift/console/pkg/serverutils"
Expand Down

0 comments on commit eb4ffd1

Please sign in to comment.