mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
commit
51dedff4f3
2
go.mod
2
go.mod
@ -109,7 +109,7 @@ require (
|
||||
k8s.io/csi-translation-lib v0.0.0
|
||||
k8s.io/dynamic-resource-allocation v0.0.0
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kms v0.0.0
|
||||
k8s.io/kube-aggregator v0.0.0
|
||||
k8s.io/kube-controller-manager v0.0.0
|
||||
|
3
go.sum
3
go.sum
@ -1252,8 +1252,9 @@ k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/system-validators v1.8.0 h1:tq05tdO9zdJZnNF3SXrq6LE7Knc/KfJm5wk68467JDg=
|
||||
|
@ -789,8 +789,11 @@ func Test_managerImpl_processShutdownEvent(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
logger, _ := ktesting.NewTestContext(t)
|
||||
|
||||
logger := ktesting.NewLogger(t,
|
||||
ktesting.NewConfig(
|
||||
ktesting.BufferLogs(true),
|
||||
),
|
||||
)
|
||||
m := &managerImpl{
|
||||
logger: logger,
|
||||
recorder: tt.fields.recorder,
|
||||
|
@ -30,7 +30,7 @@ require (
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
|
4
staging/src/k8s.io/api/go.sum
generated
4
staging/src/k8s.io/api/go.sum
generated
@ -91,8 +91,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
|
||||
|
@ -29,7 +29,7 @@ require (
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/code-generator v0.0.0
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
|
||||
|
@ -745,8 +745,8 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -22,7 +22,7 @@ require (
|
||||
golang.org/x/net v0.7.0
|
||||
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
|
||||
gopkg.in/inf.v0 v0.9.1
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
|
||||
|
4
staging/src/k8s.io/apimachinery/go.sum
generated
4
staging/src/k8s.io/apimachinery/go.sum
generated
@ -191,8 +191,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -46,7 +46,7 @@ require (
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kms v0.0.0
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
|
4
staging/src/k8s.io/apiserver/go.sum
generated
4
staging/src/k8s.io/apiserver/go.sum
generated
@ -874,8 +874,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -62,7 +62,7 @@ require (
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
)
|
||||
|
4
staging/src/k8s.io/cli-runtime/go.sum
generated
4
staging/src/k8s.io/cli-runtime/go.sum
generated
@ -487,8 +487,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -26,7 +26,7 @@ require (
|
||||
google.golang.org/protobuf v1.28.1
|
||||
k8s.io/api v0.0.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
|
||||
|
4
staging/src/k8s.io/client-go/go.sum
generated
4
staging/src/k8s.io/client-go/go.sum
generated
@ -473,8 +473,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -16,7 +16,7 @@ require (
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/component-helpers v0.0.0
|
||||
k8s.io/controller-manager v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
)
|
||||
|
||||
|
4
staging/src/k8s.io/cloud-provider/go.sum
generated
4
staging/src/k8s.io/cloud-provider/go.sum
generated
@ -708,8 +708,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -9,7 +9,7 @@ require (
|
||||
gopkg.in/square/go-jose.v2 v2.2.2
|
||||
k8s.io/api v0.0.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
4
staging/src/k8s.io/cluster-bootstrap/go.sum
generated
4
staging/src/k8s.io/cluster-bootstrap/go.sum
generated
@ -78,8 +78,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
|
||||
|
@ -43,7 +43,7 @@ require (
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
|
@ -457,8 +457,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -10,7 +10,7 @@ require (
|
||||
github.com/spf13/pflag v1.0.5
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
|
||||
)
|
||||
|
||||
|
4
staging/src/k8s.io/code-generator/go.sum
generated
4
staging/src/k8s.io/code-generator/go.sum
generated
@ -184,8 +184,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
|
||||
|
@ -26,7 +26,7 @@ require (
|
||||
golang.org/x/sys v0.5.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
|
||||
)
|
||||
|
4
staging/src/k8s.io/component-base/go.sum
generated
4
staging/src/k8s.io/component-base/go.sum
generated
@ -654,8 +654,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -9,7 +9,7 @@ require (
|
||||
k8s.io/api v0.0.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
)
|
||||
|
||||
|
4
staging/src/k8s.io/component-helpers/go.sum
generated
4
staging/src/k8s.io/component-helpers/go.sum
generated
@ -457,8 +457,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -13,7 +13,7 @@ require (
|
||||
k8s.io/apiserver v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
)
|
||||
|
||||
|
4
staging/src/k8s.io/controller-manager/go.sum
generated
4
staging/src/k8s.io/controller-manager/go.sum
generated
@ -699,8 +699,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -8,7 +8,7 @@ require (
|
||||
github.com/stretchr/testify v1.8.1
|
||||
k8s.io/api v0.0.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
4
staging/src/k8s.io/csi-translation-lib/go.sum
generated
4
staging/src/k8s.io/csi-translation-lib/go.sum
generated
@ -76,8 +76,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
|
||||
|
@ -12,7 +12,7 @@ require (
|
||||
k8s.io/api v0.0.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kubelet v0.0.0
|
||||
)
|
||||
|
||||
|
@ -494,8 +494,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -9,7 +9,7 @@ require (
|
||||
google.golang.org/grpc v1.51.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
)
|
||||
|
||||
|
4
staging/src/k8s.io/kms/go.sum
generated
4
staging/src/k8s.io/kms/go.sum
generated
@ -162,7 +162,7 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
|
@ -19,7 +19,7 @@ require (
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/code-generator v0.0.0
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3
|
||||
|
4
staging/src/k8s.io/kube-aggregator/go.sum
generated
4
staging/src/k8s.io/kube-aggregator/go.sum
generated
@ -712,8 +712,8 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -25,7 +25,7 @@ require (
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
k8s.io/component-base v0.0.0 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
|
@ -74,8 +74,8 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
|
||||
|
@ -24,7 +24,7 @@ require (
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
|
4
staging/src/k8s.io/kube-proxy/go.sum
generated
4
staging/src/k8s.io/kube-proxy/go.sum
generated
@ -75,8 +75,8 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
|
||||
|
@ -23,7 +23,7 @@ require (
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
|
4
staging/src/k8s.io/kube-scheduler/go.sum
generated
4
staging/src/k8s.io/kube-scheduler/go.sum
generated
@ -68,8 +68,8 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
|
||||
|
@ -36,7 +36,7 @@ require (
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/component-helpers v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
|
||||
k8s.io/metrics v0.0.0
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
|
4
staging/src/k8s.io/kubectl/go.sum
generated
4
staging/src/k8s.io/kubectl/go.sum
generated
@ -531,8 +531,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -38,7 +38,7 @@ require (
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
|
4
staging/src/k8s.io/kubelet/go.sum
generated
4
staging/src/k8s.io/kubelet/go.sum
generated
@ -551,8 +551,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
|
@ -27,7 +27,7 @@ require (
|
||||
k8s.io/cloud-provider v0.0.0
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/csi-translation-lib v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
)
|
||||
|
4
staging/src/k8s.io/legacy-cloud-providers/go.sum
generated
4
staging/src/k8s.io/legacy-cloud-providers/go.sum
generated
@ -807,8 +807,8 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -48,7 +48,7 @@ require (
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
|
4
staging/src/k8s.io/metrics/go.sum
generated
4
staging/src/k8s.io/metrics/go.sum
generated
@ -466,8 +466,8 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -7,7 +7,7 @@ go 1.19
|
||||
require (
|
||||
github.com/moby/sys/mountinfo v0.6.2
|
||||
github.com/stretchr/testify v1.8.1
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
)
|
||||
|
||||
|
4
staging/src/k8s.io/mount-utils/go.sum
generated
4
staging/src/k8s.io/mount-utils/go.sum
generated
@ -37,7 +37,7 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
|
@ -31,7 +31,7 @@ require (
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
|
@ -164,8 +164,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
|
||||
|
@ -15,7 +15,7 @@ require (
|
||||
k8s.io/apiserver v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/component-base v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
)
|
||||
|
4
staging/src/k8s.io/pod-security-admission/go.sum
generated
4
staging/src/k8s.io/pod-security-admission/go.sum
generated
@ -702,8 +702,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -97,7 +97,7 @@ require (
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.0.0 // indirect
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/kms v0.0.0 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.1 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
|
4
staging/src/k8s.io/sample-apiserver/go.sum
generated
4
staging/src/k8s.io/sample-apiserver/go.sum
generated
@ -710,8 +710,8 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -56,7 +56,7 @@ require (
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.0.0 // indirect
|
||||
k8s.io/apimachinery v0.0.0 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
|
4
staging/src/k8s.io/sample-cli-plugin/go.sum
generated
4
staging/src/k8s.io/sample-cli-plugin/go.sum
generated
@ -487,8 +487,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -9,7 +9,7 @@ require (
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/client-go v0.0.0
|
||||
k8s.io/code-generator v0.0.0
|
||||
k8s.io/klog/v2 v2.80.1
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
4
staging/src/k8s.io/sample-controller/go.sum
generated
4
staging/src/k8s.io/sample-controller/go.sum
generated
@ -471,8 +471,8 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
|
||||
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU=
|
||||
k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
|
||||
|
@ -27,15 +27,19 @@ import (
|
||||
|
||||
logsapi "k8s.io/component-base/logs/api/v1"
|
||||
logsjson "k8s.io/component-base/logs/json"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/klog/v2/test"
|
||||
)
|
||||
|
||||
func init() {
|
||||
test.InitKlog()
|
||||
// hack/make-rules/test-integration.sh expects that all unit tests
|
||||
// support -v and -vmodule.
|
||||
klog.InitFlags(nil)
|
||||
}
|
||||
|
||||
// TestJsonOutput tests the JSON logger, directly and as backend for klog.
|
||||
func TestJSONOutput(t *testing.T) {
|
||||
test.InitKlog(t)
|
||||
newLogger := func(out io.Writer, v int, vmodule string) logr.Logger {
|
||||
logger, _ := logsjson.NewJSONLogger(logsapi.VerbosityLevel(v), logsjson.AddNopSync(out), nil,
|
||||
&zapcore.EncoderConfig{
|
||||
|
30
vendor/k8s.io/klog/v2/contextual.go
generated
vendored
30
vendor/k8s.io/klog/v2/contextual.go
generated
vendored
@ -70,11 +70,14 @@ func SetLogger(logger logr.Logger) {
|
||||
// routing log entries through klogr into klog and then into the actual Logger
|
||||
// backend.
|
||||
func SetLoggerWithOptions(logger logr.Logger, opts ...LoggerOption) {
|
||||
logging.logger = &logger
|
||||
logging.loggerOptions = loggerOptions{}
|
||||
for _, opt := range opts {
|
||||
opt(&logging.loggerOptions)
|
||||
}
|
||||
logging.logger = &logWriter{
|
||||
Logger: logger,
|
||||
writeKlogBuffer: logging.loggerOptions.writeKlogBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
// ContextualLogger determines whether the logger passed to
|
||||
@ -93,6 +96,22 @@ func FlushLogger(flush func()) LoggerOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WriteKlogBuffer sets a callback that will be invoked by klog to write output
|
||||
// produced by non-structured log calls like Infof.
|
||||
//
|
||||
// The buffer will contain exactly the same data that klog normally would write
|
||||
// into its own output stream(s). In particular this includes the header, if
|
||||
// klog is configured to write one. The callback then can divert that data into
|
||||
// its own output streams. The buffer may or may not end in a line break.
|
||||
//
|
||||
// Without such a callback, klog will call the logger's Info or Error method
|
||||
// with just the message string (i.e. no header).
|
||||
func WriteKlogBuffer(write func([]byte)) LoggerOption {
|
||||
return func(o *loggerOptions) {
|
||||
o.writeKlogBuffer = write
|
||||
}
|
||||
}
|
||||
|
||||
// LoggerOption implements the functional parameter paradigm for
|
||||
// SetLoggerWithOptions.
|
||||
type LoggerOption func(o *loggerOptions)
|
||||
@ -100,6 +119,13 @@ type LoggerOption func(o *loggerOptions)
|
||||
type loggerOptions struct {
|
||||
contextualLogger bool
|
||||
flush func()
|
||||
writeKlogBuffer func([]byte)
|
||||
}
|
||||
|
||||
// logWriter combines a logger (always set) with a write callback (optional).
|
||||
type logWriter struct {
|
||||
Logger
|
||||
writeKlogBuffer func([]byte)
|
||||
}
|
||||
|
||||
// ClearLogger removes a backing Logger implementation if one was set earlier
|
||||
@ -152,7 +178,7 @@ func Background() Logger {
|
||||
if logging.loggerOptions.contextualLogger {
|
||||
// Is non-nil because logging.loggerOptions.contextualLogger is
|
||||
// only true if a logger was set.
|
||||
return *logging.logger
|
||||
return logging.logger.Logger
|
||||
}
|
||||
|
||||
return klogLogger
|
||||
|
75
vendor/k8s.io/klog/v2/internal/buffer/buffer.go
generated
vendored
75
vendor/k8s.io/klog/v2/internal/buffer/buffer.go
generated
vendored
@ -40,44 +40,33 @@ type Buffer struct {
|
||||
next *Buffer
|
||||
}
|
||||
|
||||
// Buffers manages the reuse of individual buffer instances. It is thread-safe.
|
||||
type Buffers struct {
|
||||
// mu protects the free list. It is separate from the main mutex
|
||||
// so buffers can be grabbed and printed to without holding the main lock,
|
||||
// for better parallelization.
|
||||
mu sync.Mutex
|
||||
|
||||
// freeList is a list of byte buffers, maintained under mu.
|
||||
freeList *Buffer
|
||||
var buffers = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return new(Buffer)
|
||||
},
|
||||
}
|
||||
|
||||
// GetBuffer returns a new, ready-to-use buffer.
|
||||
func (bl *Buffers) GetBuffer() *Buffer {
|
||||
bl.mu.Lock()
|
||||
b := bl.freeList
|
||||
if b != nil {
|
||||
bl.freeList = b.next
|
||||
}
|
||||
bl.mu.Unlock()
|
||||
if b == nil {
|
||||
b = new(Buffer)
|
||||
} else {
|
||||
b.next = nil
|
||||
b.Reset()
|
||||
}
|
||||
func GetBuffer() *Buffer {
|
||||
b := buffers.Get().(*Buffer)
|
||||
b.Reset()
|
||||
return b
|
||||
}
|
||||
|
||||
// PutBuffer returns a buffer to the free list.
|
||||
func (bl *Buffers) PutBuffer(b *Buffer) {
|
||||
func PutBuffer(b *Buffer) {
|
||||
if b.Len() >= 256 {
|
||||
// Let big buffers die a natural death.
|
||||
// Let big buffers die a natural death, without relying on
|
||||
// sync.Pool behavior. The documentation implies that items may
|
||||
// get deallocated while stored there ("If the Pool holds the
|
||||
// only reference when this [= be removed automatically]
|
||||
// happens, the item might be deallocated."), but
|
||||
// https://github.com/golang/go/issues/23199 leans more towards
|
||||
// having such a size limit.
|
||||
return
|
||||
}
|
||||
bl.mu.Lock()
|
||||
b.next = bl.freeList
|
||||
bl.freeList = b
|
||||
bl.mu.Unlock()
|
||||
|
||||
buffers.Put(b)
|
||||
}
|
||||
|
||||
// Some custom tiny helper functions to print the log header efficiently.
|
||||
@ -121,7 +110,8 @@ func (buf *Buffer) someDigits(i, d int) int {
|
||||
return copy(buf.Tmp[i:], buf.Tmp[j:])
|
||||
}
|
||||
|
||||
// FormatHeader formats a log header using the provided file name and line number.
|
||||
// FormatHeader formats a log header using the provided file name and line number
|
||||
// and writes it into the buffer.
|
||||
func (buf *Buffer) FormatHeader(s severity.Severity, file string, line int, now time.Time) {
|
||||
if line < 0 {
|
||||
line = 0 // not a real line number, but acceptable to someDigits
|
||||
@ -157,3 +147,30 @@ func (buf *Buffer) FormatHeader(s severity.Severity, file string, line int, now
|
||||
buf.Tmp[n+2] = ' '
|
||||
buf.Write(buf.Tmp[:n+3])
|
||||
}
|
||||
|
||||
// SprintHeader formats a log header and returns a string. This is a simpler
|
||||
// version of FormatHeader for use in ktesting.
|
||||
func (buf *Buffer) SprintHeader(s severity.Severity, now time.Time) string {
|
||||
if s > severity.FatalLog {
|
||||
s = severity.InfoLog // for safety.
|
||||
}
|
||||
|
||||
// Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.
|
||||
// It's worth about 3X. Fprintf is hard.
|
||||
_, month, day := now.Date()
|
||||
hour, minute, second := now.Clock()
|
||||
// Lmmdd hh:mm:ss.uuuuuu threadid file:line]
|
||||
buf.Tmp[0] = severity.Char[s]
|
||||
buf.twoDigits(1, int(month))
|
||||
buf.twoDigits(3, day)
|
||||
buf.Tmp[5] = ' '
|
||||
buf.twoDigits(6, hour)
|
||||
buf.Tmp[8] = ':'
|
||||
buf.twoDigits(9, minute)
|
||||
buf.Tmp[11] = ':'
|
||||
buf.twoDigits(12, second)
|
||||
buf.Tmp[14] = '.'
|
||||
buf.nDigits(6, 15, now.Nanosecond()/1000, '0')
|
||||
buf.Tmp[21] = ']'
|
||||
return string(buf.Tmp[:22])
|
||||
}
|
||||
|
215
vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go
generated
vendored
215
vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go
generated
vendored
@ -24,6 +24,10 @@ import (
|
||||
"github.com/go-logr/logr"
|
||||
)
|
||||
|
||||
type textWriter interface {
|
||||
WriteText(*bytes.Buffer)
|
||||
}
|
||||
|
||||
// WithValues implements LogSink.WithValues. The old key/value pairs are
|
||||
// assumed to be well-formed, the new ones are checked and padded if
|
||||
// necessary. It returns a new slice.
|
||||
@ -91,11 +95,66 @@ func MergeKVs(first, second []interface{}) []interface{} {
|
||||
return merged
|
||||
}
|
||||
|
||||
type Formatter struct {
|
||||
AnyToStringHook AnyToStringFunc
|
||||
}
|
||||
|
||||
type AnyToStringFunc func(v interface{}) string
|
||||
|
||||
// MergeKVsInto is a variant of MergeKVs which directly formats the key/value
|
||||
// pairs into a buffer.
|
||||
func (f Formatter) MergeAndFormatKVs(b *bytes.Buffer, first, second []interface{}) {
|
||||
if len(first) == 0 && len(second) == 0 {
|
||||
// Nothing to do at all.
|
||||
return
|
||||
}
|
||||
|
||||
if len(first) == 0 && len(second)%2 == 0 {
|
||||
// Nothing to be overridden, second slice is well-formed
|
||||
// and can be used directly.
|
||||
for i := 0; i < len(second); i += 2 {
|
||||
f.KVFormat(b, second[i], second[i+1])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Determine which keys are in the second slice so that we can skip
|
||||
// them when iterating over the first one. The code intentionally
|
||||
// favors performance over completeness: we assume that keys are string
|
||||
// constants and thus compare equal when the string values are equal. A
|
||||
// string constant being overridden by, for example, a fmt.Stringer is
|
||||
// not handled.
|
||||
overrides := map[interface{}]bool{}
|
||||
for i := 0; i < len(second); i += 2 {
|
||||
overrides[second[i]] = true
|
||||
}
|
||||
for i := 0; i < len(first); i += 2 {
|
||||
key := first[i]
|
||||
if overrides[key] {
|
||||
continue
|
||||
}
|
||||
f.KVFormat(b, key, first[i+1])
|
||||
}
|
||||
// Round down.
|
||||
l := len(second)
|
||||
l = l / 2 * 2
|
||||
for i := 1; i < l; i += 2 {
|
||||
f.KVFormat(b, second[i-1], second[i])
|
||||
}
|
||||
if len(second)%2 == 1 {
|
||||
f.KVFormat(b, second[len(second)-1], missingValue)
|
||||
}
|
||||
}
|
||||
|
||||
func MergeAndFormatKVs(b *bytes.Buffer, first, second []interface{}) {
|
||||
Formatter{}.MergeAndFormatKVs(b, first, second)
|
||||
}
|
||||
|
||||
const missingValue = "(MISSING)"
|
||||
|
||||
// KVListFormat serializes all key/value pairs into the provided buffer.
|
||||
// A space gets inserted before the first pair and between each pair.
|
||||
func KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
|
||||
func (f Formatter) KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
|
||||
for i := 0; i < len(keysAndValues); i += 2 {
|
||||
var v interface{}
|
||||
k := keysAndValues[i]
|
||||
@ -104,69 +163,93 @@ func KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
|
||||
} else {
|
||||
v = missingValue
|
||||
}
|
||||
b.WriteByte(' ')
|
||||
// Keys are assumed to be well-formed according to
|
||||
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments
|
||||
// for the sake of performance. Keys with spaces,
|
||||
// special characters, etc. will break parsing.
|
||||
if sK, ok := k.(string); ok {
|
||||
// Avoid one allocation when the key is a string, which
|
||||
// normally it should be.
|
||||
b.WriteString(sK)
|
||||
} else {
|
||||
b.WriteString(fmt.Sprintf("%s", k))
|
||||
}
|
||||
|
||||
// The type checks are sorted so that more frequently used ones
|
||||
// come first because that is then faster in the common
|
||||
// cases. In Kubernetes, ObjectRef (a Stringer) is more common
|
||||
// than plain strings
|
||||
// (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235).
|
||||
switch v := v.(type) {
|
||||
case fmt.Stringer:
|
||||
writeStringValue(b, true, StringerToString(v))
|
||||
case string:
|
||||
writeStringValue(b, true, v)
|
||||
case error:
|
||||
writeStringValue(b, true, ErrorToString(v))
|
||||
case logr.Marshaler:
|
||||
value := MarshalerToValue(v)
|
||||
// A marshaler that returns a string is useful for
|
||||
// delayed formatting of complex values. We treat this
|
||||
// case like a normal string. This is useful for
|
||||
// multi-line support.
|
||||
//
|
||||
// We could do this by recursively formatting a value,
|
||||
// but that comes with the risk of infinite recursion
|
||||
// if a marshaler returns itself. Instead we call it
|
||||
// only once and rely on it returning the intended
|
||||
// value directly.
|
||||
switch value := value.(type) {
|
||||
case string:
|
||||
writeStringValue(b, true, value)
|
||||
default:
|
||||
writeStringValue(b, false, fmt.Sprintf("%+v", value))
|
||||
}
|
||||
case []byte:
|
||||
// In https://github.com/kubernetes/klog/pull/237 it was decided
|
||||
// to format byte slices with "%+q". The advantages of that are:
|
||||
// - readable output if the bytes happen to be printable
|
||||
// - non-printable bytes get represented as unicode escape
|
||||
// sequences (\uxxxx)
|
||||
//
|
||||
// The downsides are that we cannot use the faster
|
||||
// strconv.Quote here and that multi-line output is not
|
||||
// supported. If developers know that a byte array is
|
||||
// printable and they want multi-line output, they can
|
||||
// convert the value to string before logging it.
|
||||
b.WriteByte('=')
|
||||
b.WriteString(fmt.Sprintf("%+q", v))
|
||||
default:
|
||||
writeStringValue(b, false, fmt.Sprintf("%+v", v))
|
||||
}
|
||||
f.KVFormat(b, k, v)
|
||||
}
|
||||
}
|
||||
|
||||
func KVListFormat(b *bytes.Buffer, keysAndValues ...interface{}) {
|
||||
Formatter{}.KVListFormat(b, keysAndValues...)
|
||||
}
|
||||
|
||||
// KVFormat serializes one key/value pair into the provided buffer.
|
||||
// A space gets inserted before the pair.
|
||||
func (f Formatter) KVFormat(b *bytes.Buffer, k, v interface{}) {
|
||||
b.WriteByte(' ')
|
||||
// Keys are assumed to be well-formed according to
|
||||
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments
|
||||
// for the sake of performance. Keys with spaces,
|
||||
// special characters, etc. will break parsing.
|
||||
if sK, ok := k.(string); ok {
|
||||
// Avoid one allocation when the key is a string, which
|
||||
// normally it should be.
|
||||
b.WriteString(sK)
|
||||
} else {
|
||||
b.WriteString(fmt.Sprintf("%s", k))
|
||||
}
|
||||
|
||||
// The type checks are sorted so that more frequently used ones
|
||||
// come first because that is then faster in the common
|
||||
// cases. In Kubernetes, ObjectRef (a Stringer) is more common
|
||||
// than plain strings
|
||||
// (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235).
|
||||
switch v := v.(type) {
|
||||
case textWriter:
|
||||
writeTextWriterValue(b, v)
|
||||
case fmt.Stringer:
|
||||
writeStringValue(b, true, StringerToString(v))
|
||||
case string:
|
||||
writeStringValue(b, true, v)
|
||||
case error:
|
||||
writeStringValue(b, true, ErrorToString(v))
|
||||
case logr.Marshaler:
|
||||
value := MarshalerToValue(v)
|
||||
// A marshaler that returns a string is useful for
|
||||
// delayed formatting of complex values. We treat this
|
||||
// case like a normal string. This is useful for
|
||||
// multi-line support.
|
||||
//
|
||||
// We could do this by recursively formatting a value,
|
||||
// but that comes with the risk of infinite recursion
|
||||
// if a marshaler returns itself. Instead we call it
|
||||
// only once and rely on it returning the intended
|
||||
// value directly.
|
||||
switch value := value.(type) {
|
||||
case string:
|
||||
writeStringValue(b, true, value)
|
||||
default:
|
||||
writeStringValue(b, false, f.AnyToString(value))
|
||||
}
|
||||
case []byte:
|
||||
// In https://github.com/kubernetes/klog/pull/237 it was decided
|
||||
// to format byte slices with "%+q". The advantages of that are:
|
||||
// - readable output if the bytes happen to be printable
|
||||
// - non-printable bytes get represented as unicode escape
|
||||
// sequences (\uxxxx)
|
||||
//
|
||||
// The downsides are that we cannot use the faster
|
||||
// strconv.Quote here and that multi-line output is not
|
||||
// supported. If developers know that a byte array is
|
||||
// printable and they want multi-line output, they can
|
||||
// convert the value to string before logging it.
|
||||
b.WriteByte('=')
|
||||
b.WriteString(fmt.Sprintf("%+q", v))
|
||||
default:
|
||||
writeStringValue(b, false, f.AnyToString(v))
|
||||
}
|
||||
}
|
||||
|
||||
func KVFormat(b *bytes.Buffer, k, v interface{}) {
|
||||
Formatter{}.KVFormat(b, k, v)
|
||||
}
|
||||
|
||||
// AnyToString is the historic fallback formatter.
|
||||
func (f Formatter) AnyToString(v interface{}) string {
|
||||
if f.AnyToStringHook != nil {
|
||||
return f.AnyToStringHook(v)
|
||||
}
|
||||
return fmt.Sprintf("%+v", v)
|
||||
}
|
||||
|
||||
// StringerToString converts a Stringer to a string,
|
||||
// handling panics if they occur.
|
||||
func StringerToString(s fmt.Stringer) (ret string) {
|
||||
@ -203,6 +286,16 @@ func ErrorToString(err error) (ret string) {
|
||||
return
|
||||
}
|
||||
|
||||
func writeTextWriterValue(b *bytes.Buffer, v textWriter) {
|
||||
b.WriteRune('=')
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
fmt.Fprintf(b, `"<panic: %s>"`, err)
|
||||
}
|
||||
}()
|
||||
v.WriteText(b)
|
||||
}
|
||||
|
||||
func writeStringValue(b *bytes.Buffer, quote bool, v string) {
|
||||
data := []byte(v)
|
||||
index := bytes.IndexByte(data, '\n')
|
||||
|
78
vendor/k8s.io/klog/v2/k8s_references.go
generated
vendored
78
vendor/k8s.io/klog/v2/k8s_references.go
generated
vendored
@ -17,8 +17,10 @@ limitations under the License.
|
||||
package klog
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
)
|
||||
@ -31,11 +33,30 @@ type ObjectRef struct {
|
||||
|
||||
func (ref ObjectRef) String() string {
|
||||
if ref.Namespace != "" {
|
||||
return fmt.Sprintf("%s/%s", ref.Namespace, ref.Name)
|
||||
var builder strings.Builder
|
||||
builder.Grow(len(ref.Namespace) + len(ref.Name) + 1)
|
||||
builder.WriteString(ref.Namespace)
|
||||
builder.WriteRune('/')
|
||||
builder.WriteString(ref.Name)
|
||||
return builder.String()
|
||||
}
|
||||
return ref.Name
|
||||
}
|
||||
|
||||
func (ref ObjectRef) WriteText(out *bytes.Buffer) {
|
||||
out.WriteRune('"')
|
||||
ref.writeUnquoted(out)
|
||||
out.WriteRune('"')
|
||||
}
|
||||
|
||||
func (ref ObjectRef) writeUnquoted(out *bytes.Buffer) {
|
||||
if ref.Namespace != "" {
|
||||
out.WriteString(ref.Namespace)
|
||||
out.WriteRune('/')
|
||||
}
|
||||
out.WriteString(ref.Name)
|
||||
}
|
||||
|
||||
// MarshalLog ensures that loggers with support for structured output will log
|
||||
// as a struct by removing the String method via a custom type.
|
||||
func (ref ObjectRef) MarshalLog() interface{} {
|
||||
@ -117,31 +138,31 @@ var _ fmt.Stringer = kobjSlice{}
|
||||
var _ logr.Marshaler = kobjSlice{}
|
||||
|
||||
func (ks kobjSlice) String() string {
|
||||
objectRefs, err := ks.process()
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
objectRefs, errStr := ks.process()
|
||||
if errStr != "" {
|
||||
return errStr
|
||||
}
|
||||
return fmt.Sprintf("%v", objectRefs)
|
||||
}
|
||||
|
||||
func (ks kobjSlice) MarshalLog() interface{} {
|
||||
objectRefs, err := ks.process()
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
objectRefs, errStr := ks.process()
|
||||
if errStr != "" {
|
||||
return errStr
|
||||
}
|
||||
return objectRefs
|
||||
}
|
||||
|
||||
func (ks kobjSlice) process() ([]interface{}, error) {
|
||||
func (ks kobjSlice) process() (objs []interface{}, err string) {
|
||||
s := reflect.ValueOf(ks.arg)
|
||||
switch s.Kind() {
|
||||
case reflect.Invalid:
|
||||
// nil parameter, print as nil.
|
||||
return nil, nil
|
||||
return nil, ""
|
||||
case reflect.Slice:
|
||||
// Okay, handle below.
|
||||
default:
|
||||
return nil, fmt.Errorf("<KObjSlice needs a slice, got type %T>", ks.arg)
|
||||
return nil, fmt.Sprintf("<KObjSlice needs a slice, got type %T>", ks.arg)
|
||||
}
|
||||
objectRefs := make([]interface{}, 0, s.Len())
|
||||
for i := 0; i < s.Len(); i++ {
|
||||
@ -151,8 +172,41 @@ func (ks kobjSlice) process() ([]interface{}, error) {
|
||||
} else if v, ok := item.(KMetadata); ok {
|
||||
objectRefs = append(objectRefs, KObj(v))
|
||||
} else {
|
||||
return nil, fmt.Errorf("<KObjSlice needs a slice of values implementing KMetadata, got type %T>", item)
|
||||
return nil, fmt.Sprintf("<KObjSlice needs a slice of values implementing KMetadata, got type %T>", item)
|
||||
}
|
||||
}
|
||||
return objectRefs, ""
|
||||
}
|
||||
|
||||
var nilToken = []byte("<nil>")
|
||||
|
||||
func (ks kobjSlice) WriteText(out *bytes.Buffer) {
|
||||
s := reflect.ValueOf(ks.arg)
|
||||
switch s.Kind() {
|
||||
case reflect.Invalid:
|
||||
// nil parameter, print as empty slice.
|
||||
out.WriteString("[]")
|
||||
return
|
||||
case reflect.Slice:
|
||||
// Okay, handle below.
|
||||
default:
|
||||
fmt.Fprintf(out, `"<KObjSlice needs a slice, got type %T>"`, ks.arg)
|
||||
return
|
||||
}
|
||||
out.Write([]byte{'['})
|
||||
defer out.Write([]byte{']'})
|
||||
for i := 0; i < s.Len(); i++ {
|
||||
if i > 0 {
|
||||
out.Write([]byte{' '})
|
||||
}
|
||||
item := s.Index(i).Interface()
|
||||
if item == nil {
|
||||
out.Write(nilToken)
|
||||
} else if v, ok := item.(KMetadata); ok {
|
||||
KObj(v).writeUnquoted(out)
|
||||
} else {
|
||||
fmt.Fprintf(out, "<KObjSlice needs a slice of values implementing KMetadata, got type %T>", item)
|
||||
return
|
||||
}
|
||||
}
|
||||
return objectRefs, nil
|
||||
}
|
||||
|
135
vendor/k8s.io/klog/v2/klog.go
generated
vendored
135
vendor/k8s.io/klog/v2/klog.go
generated
vendored
@ -91,8 +91,6 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
|
||||
"k8s.io/klog/v2/internal/buffer"
|
||||
"k8s.io/klog/v2/internal/clock"
|
||||
"k8s.io/klog/v2/internal/dbg"
|
||||
@ -453,7 +451,7 @@ type settings struct {
|
||||
|
||||
// logger is the global Logger chosen by users of klog, nil if
|
||||
// none is available.
|
||||
logger *Logger
|
||||
logger *logWriter
|
||||
|
||||
// loggerOptions contains the options that were supplied for
|
||||
// globalLogger.
|
||||
@ -525,6 +523,11 @@ func (s settings) deepCopy() settings {
|
||||
}
|
||||
s.vmodule.filter = filter
|
||||
|
||||
if s.logger != nil {
|
||||
logger := *s.logger
|
||||
s.logger = &logger
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
@ -532,11 +535,6 @@ func (s settings) deepCopy() settings {
|
||||
type loggingT struct {
|
||||
settings
|
||||
|
||||
// bufferCache maintains the free list. It uses its own mutex
|
||||
// so buffers can be grabbed and printed to without holding the main lock,
|
||||
// for better parallelization.
|
||||
bufferCache buffer.Buffers
|
||||
|
||||
// flushD holds a flushDaemon that frequently flushes log file buffers.
|
||||
// Uses its own mutex.
|
||||
flushD *flushDaemon
|
||||
@ -664,7 +662,7 @@ func (l *loggingT) header(s severity.Severity, depth int) (*buffer.Buffer, strin
|
||||
|
||||
// formatHeader formats a log header using the provided file name and line number.
|
||||
func (l *loggingT) formatHeader(s severity.Severity, file string, line int) *buffer.Buffer {
|
||||
buf := l.bufferCache.GetBuffer()
|
||||
buf := buffer.GetBuffer()
|
||||
if l.skipHeaders {
|
||||
return buf
|
||||
}
|
||||
@ -673,17 +671,18 @@ func (l *loggingT) formatHeader(s severity.Severity, file string, line int) *buf
|
||||
return buf
|
||||
}
|
||||
|
||||
func (l *loggingT) println(s severity.Severity, logger *logr.Logger, filter LogFilter, args ...interface{}) {
|
||||
func (l *loggingT) println(s severity.Severity, logger *logWriter, filter LogFilter, args ...interface{}) {
|
||||
l.printlnDepth(s, logger, filter, 1, args...)
|
||||
}
|
||||
|
||||
func (l *loggingT) printlnDepth(s severity.Severity, logger *logr.Logger, filter LogFilter, depth int, args ...interface{}) {
|
||||
func (l *loggingT) printlnDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) {
|
||||
buf, file, line := l.header(s, depth)
|
||||
// if logger is set, we clear the generated header as we rely on the backing
|
||||
// logger implementation to print headers
|
||||
if logger != nil {
|
||||
l.bufferCache.PutBuffer(buf)
|
||||
buf = l.bufferCache.GetBuffer()
|
||||
// If a logger is set and doesn't support writing a formatted buffer,
|
||||
// we clear the generated header as we rely on the backing
|
||||
// logger implementation to print headers.
|
||||
if logger != nil && logger.writeKlogBuffer == nil {
|
||||
buffer.PutBuffer(buf)
|
||||
buf = buffer.GetBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
args = filter.Filter(args)
|
||||
@ -692,17 +691,18 @@ func (l *loggingT) printlnDepth(s severity.Severity, logger *logr.Logger, filter
|
||||
l.output(s, logger, buf, depth, file, line, false)
|
||||
}
|
||||
|
||||
func (l *loggingT) print(s severity.Severity, logger *logr.Logger, filter LogFilter, args ...interface{}) {
|
||||
func (l *loggingT) print(s severity.Severity, logger *logWriter, filter LogFilter, args ...interface{}) {
|
||||
l.printDepth(s, logger, filter, 1, args...)
|
||||
}
|
||||
|
||||
func (l *loggingT) printDepth(s severity.Severity, logger *logr.Logger, filter LogFilter, depth int, args ...interface{}) {
|
||||
func (l *loggingT) printDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, args ...interface{}) {
|
||||
buf, file, line := l.header(s, depth)
|
||||
// if logr is set, we clear the generated header as we rely on the backing
|
||||
// logr implementation to print headers
|
||||
if logger != nil {
|
||||
l.bufferCache.PutBuffer(buf)
|
||||
buf = l.bufferCache.GetBuffer()
|
||||
// If a logger is set and doesn't support writing a formatted buffer,
|
||||
// we clear the generated header as we rely on the backing
|
||||
// logger implementation to print headers.
|
||||
if logger != nil && logger.writeKlogBuffer == nil {
|
||||
buffer.PutBuffer(buf)
|
||||
buf = buffer.GetBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
args = filter.Filter(args)
|
||||
@ -714,17 +714,18 @@ func (l *loggingT) printDepth(s severity.Severity, logger *logr.Logger, filter L
|
||||
l.output(s, logger, buf, depth, file, line, false)
|
||||
}
|
||||
|
||||
func (l *loggingT) printf(s severity.Severity, logger *logr.Logger, filter LogFilter, format string, args ...interface{}) {
|
||||
func (l *loggingT) printf(s severity.Severity, logger *logWriter, filter LogFilter, format string, args ...interface{}) {
|
||||
l.printfDepth(s, logger, filter, 1, format, args...)
|
||||
}
|
||||
|
||||
func (l *loggingT) printfDepth(s severity.Severity, logger *logr.Logger, filter LogFilter, depth int, format string, args ...interface{}) {
|
||||
func (l *loggingT) printfDepth(s severity.Severity, logger *logWriter, filter LogFilter, depth int, format string, args ...interface{}) {
|
||||
buf, file, line := l.header(s, depth)
|
||||
// if logr is set, we clear the generated header as we rely on the backing
|
||||
// logr implementation to print headers
|
||||
if logger != nil {
|
||||
l.bufferCache.PutBuffer(buf)
|
||||
buf = l.bufferCache.GetBuffer()
|
||||
// If a logger is set and doesn't support writing a formatted buffer,
|
||||
// we clear the generated header as we rely on the backing
|
||||
// logger implementation to print headers.
|
||||
if logger != nil && logger.writeKlogBuffer == nil {
|
||||
buffer.PutBuffer(buf)
|
||||
buf = buffer.GetBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
format, args = filter.FilterF(format, args)
|
||||
@ -739,13 +740,14 @@ func (l *loggingT) printfDepth(s severity.Severity, logger *logr.Logger, filter
|
||||
// printWithFileLine behaves like print but uses the provided file and line number. If
|
||||
// alsoLogToStderr is true, the log message always appears on standard error; it
|
||||
// will also appear in the log file unless --logtostderr is set.
|
||||
func (l *loggingT) printWithFileLine(s severity.Severity, logger *logr.Logger, filter LogFilter, file string, line int, alsoToStderr bool, args ...interface{}) {
|
||||
func (l *loggingT) printWithFileLine(s severity.Severity, logger *logWriter, filter LogFilter, file string, line int, alsoToStderr bool, args ...interface{}) {
|
||||
buf := l.formatHeader(s, file, line)
|
||||
// if logr is set, we clear the generated header as we rely on the backing
|
||||
// logr implementation to print headers
|
||||
if logger != nil {
|
||||
l.bufferCache.PutBuffer(buf)
|
||||
buf = l.bufferCache.GetBuffer()
|
||||
// If a logger is set and doesn't support writing a formatted buffer,
|
||||
// we clear the generated header as we rely on the backing
|
||||
// logger implementation to print headers.
|
||||
if logger != nil && logger.writeKlogBuffer == nil {
|
||||
buffer.PutBuffer(buf)
|
||||
buf = buffer.GetBuffer()
|
||||
}
|
||||
if filter != nil {
|
||||
args = filter.Filter(args)
|
||||
@ -758,7 +760,7 @@ func (l *loggingT) printWithFileLine(s severity.Severity, logger *logr.Logger, f
|
||||
}
|
||||
|
||||
// if loggr is specified, will call loggr.Error, otherwise output with logging module.
|
||||
func (l *loggingT) errorS(err error, logger *logr.Logger, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
|
||||
func (l *loggingT) errorS(err error, logger *logWriter, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
|
||||
if filter != nil {
|
||||
msg, keysAndValues = filter.FilterS(msg, keysAndValues)
|
||||
}
|
||||
@ -770,7 +772,7 @@ func (l *loggingT) errorS(err error, logger *logr.Logger, filter LogFilter, dept
|
||||
}
|
||||
|
||||
// if loggr is specified, will call loggr.Info, otherwise output with logging module.
|
||||
func (l *loggingT) infoS(logger *logr.Logger, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
|
||||
func (l *loggingT) infoS(logger *logWriter, filter LogFilter, depth int, msg string, keysAndValues ...interface{}) {
|
||||
if filter != nil {
|
||||
msg, keysAndValues = filter.FilterS(msg, keysAndValues)
|
||||
}
|
||||
@ -785,7 +787,7 @@ func (l *loggingT) infoS(logger *logr.Logger, filter LogFilter, depth int, msg s
|
||||
// set log severity by s
|
||||
func (l *loggingT) printS(err error, s severity.Severity, depth int, msg string, keysAndValues ...interface{}) {
|
||||
// Only create a new buffer if we don't have one cached.
|
||||
b := l.bufferCache.GetBuffer()
|
||||
b := buffer.GetBuffer()
|
||||
// The message is always quoted, even if it contains line breaks.
|
||||
// If developers want multi-line output, they should use a small, fixed
|
||||
// message and put the multi-line output into a value.
|
||||
@ -796,7 +798,7 @@ func (l *loggingT) printS(err error, s severity.Severity, depth int, msg string,
|
||||
serialize.KVListFormat(&b.Buffer, keysAndValues...)
|
||||
l.printDepth(s, logging.logger, nil, depth+1, &b.Buffer)
|
||||
// Make the buffer available for reuse.
|
||||
l.bufferCache.PutBuffer(b)
|
||||
buffer.PutBuffer(b)
|
||||
}
|
||||
|
||||
// redirectBuffer is used to set an alternate destination for the logs
|
||||
@ -851,7 +853,7 @@ func LogToStderr(stderr bool) {
|
||||
}
|
||||
|
||||
// output writes the data to the log files and releases the buffer.
|
||||
func (l *loggingT) output(s severity.Severity, log *logr.Logger, buf *buffer.Buffer, depth int, file string, line int, alsoToStderr bool) {
|
||||
func (l *loggingT) output(s severity.Severity, logger *logWriter, buf *buffer.Buffer, depth int, file string, line int, alsoToStderr bool) {
|
||||
var isLocked = true
|
||||
l.mu.Lock()
|
||||
defer func() {
|
||||
@ -867,13 +869,17 @@ func (l *loggingT) output(s severity.Severity, log *logr.Logger, buf *buffer.Buf
|
||||
}
|
||||
}
|
||||
data := buf.Bytes()
|
||||
if log != nil {
|
||||
// TODO: set 'severity' and caller information as structured log info
|
||||
// keysAndValues := []interface{}{"severity", severityName[s], "file", file, "line", line}
|
||||
if s == severity.ErrorLog {
|
||||
logging.logger.WithCallDepth(depth+3).Error(nil, string(data))
|
||||
if logger != nil {
|
||||
if logger.writeKlogBuffer != nil {
|
||||
logger.writeKlogBuffer(data)
|
||||
} else {
|
||||
log.WithCallDepth(depth + 3).Info(string(data))
|
||||
// TODO: set 'severity' and caller information as structured log info
|
||||
// keysAndValues := []interface{}{"severity", severityName[s], "file", file, "line", line}
|
||||
if s == severity.ErrorLog {
|
||||
logger.WithCallDepth(depth+3).Error(nil, string(data))
|
||||
} else {
|
||||
logger.WithCallDepth(depth + 3).Info(string(data))
|
||||
}
|
||||
}
|
||||
} else if l.toStderr {
|
||||
os.Stderr.Write(data)
|
||||
@ -948,7 +954,7 @@ func (l *loggingT) output(s severity.Severity, log *logr.Logger, buf *buffer.Buf
|
||||
timeoutFlush(ExitFlushTimeout)
|
||||
OsExit(255) // C++ uses -1, which is silly because it's anded with 255 anyway.
|
||||
}
|
||||
l.bufferCache.PutBuffer(buf)
|
||||
buffer.PutBuffer(buf)
|
||||
|
||||
if stats := severityStats[s]; stats != nil {
|
||||
atomic.AddInt64(&stats.lines, 1)
|
||||
@ -1282,7 +1288,7 @@ func (l *loggingT) setV(pc uintptr) Level {
|
||||
// See the documentation of V for more information.
|
||||
type Verbose struct {
|
||||
enabled bool
|
||||
logr *logr.Logger
|
||||
logger *logWriter
|
||||
}
|
||||
|
||||
func newVerbose(level Level, b bool) Verbose {
|
||||
@ -1290,7 +1296,7 @@ func newVerbose(level Level, b bool) Verbose {
|
||||
return Verbose{b, nil}
|
||||
}
|
||||
v := logging.logger.V(int(level))
|
||||
return Verbose{b, &v}
|
||||
return Verbose{b, &logWriter{Logger: v, writeKlogBuffer: logging.loggerOptions.writeKlogBuffer}}
|
||||
}
|
||||
|
||||
// V reports whether verbosity at the call site is at least the requested level.
|
||||
@ -1313,6 +1319,13 @@ func newVerbose(level Level, b bool) Verbose {
|
||||
// less than or equal to the value of the -vmodule pattern matching the source file
|
||||
// containing the call.
|
||||
func V(level Level) Verbose {
|
||||
return VDepth(1, level)
|
||||
}
|
||||
|
||||
// VDepth is a variant of V that accepts a number of stack frames that will be
|
||||
// skipped when checking the -vmodule patterns. VDepth(0) is equivalent to
|
||||
// V().
|
||||
func VDepth(depth int, level Level) Verbose {
|
||||
// This function tries hard to be cheap unless there's work to do.
|
||||
// The fast path is two atomic loads and compares.
|
||||
|
||||
@ -1329,7 +1342,7 @@ func V(level Level) Verbose {
|
||||
// but if V logging is enabled we're slow anyway.
|
||||
logging.mu.Lock()
|
||||
defer logging.mu.Unlock()
|
||||
if runtime.Callers(2, logging.pcs[:]) == 0 {
|
||||
if runtime.Callers(2+depth, logging.pcs[:]) == 0 {
|
||||
return newVerbose(level, false)
|
||||
}
|
||||
// runtime.Callers returns "return PCs", but we want
|
||||
@ -1357,7 +1370,7 @@ func (v Verbose) Enabled() bool {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) Info(args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.print(severity.InfoLog, v.logr, logging.filter, args...)
|
||||
logging.print(severity.InfoLog, v.logger, logging.filter, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1365,7 +1378,7 @@ func (v Verbose) Info(args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) InfoDepth(depth int, args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.printDepth(severity.InfoLog, v.logr, logging.filter, depth, args...)
|
||||
logging.printDepth(severity.InfoLog, v.logger, logging.filter, depth, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1373,7 +1386,7 @@ func (v Verbose) InfoDepth(depth int, args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) Infoln(args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.println(severity.InfoLog, v.logr, logging.filter, args...)
|
||||
logging.println(severity.InfoLog, v.logger, logging.filter, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1381,7 +1394,7 @@ func (v Verbose) Infoln(args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) InfolnDepth(depth int, args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.printlnDepth(severity.InfoLog, v.logr, logging.filter, depth, args...)
|
||||
logging.printlnDepth(severity.InfoLog, v.logger, logging.filter, depth, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1389,7 +1402,7 @@ func (v Verbose) InfolnDepth(depth int, args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) Infof(format string, args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.printf(severity.InfoLog, v.logr, logging.filter, format, args...)
|
||||
logging.printf(severity.InfoLog, v.logger, logging.filter, format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1397,7 +1410,7 @@ func (v Verbose) Infof(format string, args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) InfofDepth(depth int, format string, args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.printfDepth(severity.InfoLog, v.logr, logging.filter, depth, format, args...)
|
||||
logging.printfDepth(severity.InfoLog, v.logger, logging.filter, depth, format, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1405,7 +1418,7 @@ func (v Verbose) InfofDepth(depth int, format string, args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) InfoS(msg string, keysAndValues ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.infoS(v.logr, logging.filter, 0, msg, keysAndValues...)
|
||||
logging.infoS(v.logger, logging.filter, 0, msg, keysAndValues...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1419,14 +1432,14 @@ func InfoSDepth(depth int, msg string, keysAndValues ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) InfoSDepth(depth int, msg string, keysAndValues ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.infoS(v.logr, logging.filter, depth, msg, keysAndValues...)
|
||||
logging.infoS(v.logger, logging.filter, depth, msg, keysAndValues...)
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: Use ErrorS instead.
|
||||
func (v Verbose) Error(err error, msg string, args ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.errorS(err, v.logr, logging.filter, 0, msg, args...)
|
||||
logging.errorS(err, v.logger, logging.filter, 0, msg, args...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1434,7 +1447,7 @@ func (v Verbose) Error(err error, msg string, args ...interface{}) {
|
||||
// See the documentation of V for usage.
|
||||
func (v Verbose) ErrorS(err error, msg string, keysAndValues ...interface{}) {
|
||||
if v.enabled {
|
||||
logging.errorS(err, v.logr, logging.filter, 0, msg, keysAndValues...)
|
||||
logging.errorS(err, v.logger, logging.filter, 0, msg, keysAndValues...)
|
||||
}
|
||||
}
|
||||
|
||||
|
12
vendor/k8s.io/klog/v2/klogr.go
generated
vendored
12
vendor/k8s.io/klog/v2/klogr.go
generated
vendored
@ -42,19 +42,21 @@ func (l *klogger) Init(info logr.RuntimeInfo) {
|
||||
l.callDepth += info.CallDepth
|
||||
}
|
||||
|
||||
func (l klogger) Info(level int, msg string, kvList ...interface{}) {
|
||||
func (l *klogger) Info(level int, msg string, kvList ...interface{}) {
|
||||
merged := serialize.MergeKVs(l.values, kvList)
|
||||
if l.prefix != "" {
|
||||
msg = l.prefix + ": " + msg
|
||||
}
|
||||
V(Level(level)).InfoSDepth(l.callDepth+1, msg, merged...)
|
||||
// Skip this function.
|
||||
VDepth(l.callDepth+1, Level(level)).InfoSDepth(l.callDepth+1, msg, merged...)
|
||||
}
|
||||
|
||||
func (l klogger) Enabled(level int) bool {
|
||||
return V(Level(level)).Enabled()
|
||||
func (l *klogger) Enabled(level int) bool {
|
||||
// Skip this function and logr.Logger.Info where Enabled is called.
|
||||
return VDepth(l.callDepth+2, Level(level)).Enabled()
|
||||
}
|
||||
|
||||
func (l klogger) Error(err error, msg string, kvList ...interface{}) {
|
||||
func (l *klogger) Error(err error, msg string, kvList ...interface{}) {
|
||||
merged := serialize.MergeKVs(l.values, kvList)
|
||||
if l.prefix != "" {
|
||||
msg = l.prefix + ": " + msg
|
||||
|
46
vendor/k8s.io/klog/v2/ktesting/options.go
generated
vendored
46
vendor/k8s.io/klog/v2/ktesting/options.go
generated
vendored
@ -20,6 +20,7 @@ import (
|
||||
"flag"
|
||||
"strconv"
|
||||
|
||||
"k8s.io/klog/v2/internal/serialize"
|
||||
"k8s.io/klog/v2/internal/verbosity"
|
||||
)
|
||||
|
||||
@ -38,6 +39,20 @@ type Config struct {
|
||||
co configOptions
|
||||
}
|
||||
|
||||
// Verbosity returns a value instance that can be used to query (via String) or
|
||||
// modify (via Set) the verbosity threshold. This is thread-safe and can be
|
||||
// done at runtime.
|
||||
func (c *Config) Verbosity() flag.Value {
|
||||
return c.vstate.V()
|
||||
}
|
||||
|
||||
// VModule returns a value instance that can be used to query (via String) or
|
||||
// modify (via Set) the vmodule settings. This is thread-safe and can be done
|
||||
// at runtime.
|
||||
func (c *Config) VModule() flag.Value {
|
||||
return c.vstate.VModule()
|
||||
}
|
||||
|
||||
// ConfigOption implements functional parameters for NewConfig.
|
||||
//
|
||||
// # Experimental
|
||||
@ -47,9 +62,25 @@ type Config struct {
|
||||
type ConfigOption func(co *configOptions)
|
||||
|
||||
type configOptions struct {
|
||||
anyToString serialize.AnyToStringFunc
|
||||
verbosityFlagName string
|
||||
vmoduleFlagName string
|
||||
verbosityDefault int
|
||||
bufferLogs bool
|
||||
}
|
||||
|
||||
// AnyToString overrides the default formatter for values that are not
|
||||
// supported directly by klog. The default is `fmt.Sprintf("%+v")`.
|
||||
// The formatter must not panic.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func AnyToString(anyToString func(value interface{}) string) ConfigOption {
|
||||
return func(co *configOptions) {
|
||||
co.anyToString = anyToString
|
||||
}
|
||||
}
|
||||
|
||||
// VerbosityFlagName overrides the default -testing.v for the verbosity level.
|
||||
@ -94,6 +125,21 @@ func Verbosity(level int) ConfigOption {
|
||||
}
|
||||
}
|
||||
|
||||
// BufferLogs controls whether log entries are captured in memory in addition
|
||||
// to being printed. Off by default. Unit tests that want to verify that
|
||||
// log entries are emitted as expected can turn this on and then retrieve
|
||||
// the captured log through the Underlier LogSink interface.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func BufferLogs(enabled bool) ConfigOption {
|
||||
return func(co *configOptions) {
|
||||
co.bufferLogs = enabled
|
||||
}
|
||||
}
|
||||
|
||||
// NewConfig returns a configuration with recommended defaults and optional
|
||||
// modifications. Command line flags are not bound to any FlagSet yet.
|
||||
//
|
||||
|
68
vendor/k8s.io/klog/v2/ktesting/testinglogger.go
generated
vendored
68
vendor/k8s.io/klog/v2/ktesting/testinglogger.go
generated
vendored
@ -42,7 +42,7 @@ limitations under the License.
|
||||
package ktesting
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -50,8 +50,10 @@ import (
|
||||
"github.com/go-logr/logr"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/klog/v2/internal/buffer"
|
||||
"k8s.io/klog/v2/internal/dbg"
|
||||
"k8s.io/klog/v2/internal/serialize"
|
||||
"k8s.io/klog/v2/internal/severity"
|
||||
"k8s.io/klog/v2/internal/verbosity"
|
||||
)
|
||||
|
||||
@ -80,6 +82,23 @@ func (n NopTL) Log(args ...interface{}) {}
|
||||
|
||||
var _ TL = NopTL{}
|
||||
|
||||
// BufferTL implements TL with an in-memory buffer.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
type BufferTL struct {
|
||||
strings.Builder
|
||||
}
|
||||
|
||||
func (n *BufferTL) Helper() {}
|
||||
func (n *BufferTL) Log(args ...interface{}) {
|
||||
n.Builder.WriteString(fmt.Sprintln(args...))
|
||||
}
|
||||
|
||||
var _ TL = &BufferTL{}
|
||||
|
||||
// NewLogger constructs a new logger for the given test interface.
|
||||
//
|
||||
// Beware that testing.T does not support logging after the test that
|
||||
@ -88,6 +107,9 @@ var _ TL = NopTL{}
|
||||
// that output will be printed via the global klog logger with
|
||||
// `<test name> leaked goroutine` as prefix.
|
||||
//
|
||||
// Verbosity can be modified at any time through the Config.V and
|
||||
// Config.VModule API.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
@ -99,6 +121,9 @@ func NewLogger(t TL, c *Config) logr.Logger {
|
||||
config: c,
|
||||
},
|
||||
}
|
||||
if c.co.anyToString != nil {
|
||||
l.shared.formatter.AnyToStringHook = c.co.anyToString
|
||||
}
|
||||
|
||||
type testCleanup interface {
|
||||
Cleanup(func())
|
||||
@ -230,19 +255,19 @@ type Underlier interface {
|
||||
GetBuffer() Buffer
|
||||
}
|
||||
|
||||
type buffer struct {
|
||||
type logBuffer struct {
|
||||
mutex sync.Mutex
|
||||
text strings.Builder
|
||||
log Log
|
||||
}
|
||||
|
||||
func (b *buffer) String() string {
|
||||
func (b *logBuffer) String() string {
|
||||
b.mutex.Lock()
|
||||
defer b.mutex.Unlock()
|
||||
return b.text.String()
|
||||
}
|
||||
|
||||
func (b *buffer) Data() Log {
|
||||
func (b *logBuffer) Data() Log {
|
||||
b.mutex.Lock()
|
||||
defer b.mutex.Unlock()
|
||||
return b.log.DeepCopy()
|
||||
@ -261,9 +286,10 @@ type tloggerShared struct {
|
||||
// it logs after test completion.
|
||||
goroutineWarningDone bool
|
||||
|
||||
formatter serialize.Formatter
|
||||
testName string
|
||||
config *Config
|
||||
buffer buffer
|
||||
buffer logBuffer
|
||||
callDepth int
|
||||
}
|
||||
|
||||
@ -318,10 +344,9 @@ func (l tlogger) Info(level int, msg string, kvList ...interface{}) {
|
||||
}
|
||||
|
||||
l.shared.t.Helper()
|
||||
buffer := &bytes.Buffer{}
|
||||
merged := serialize.MergeKVs(l.values, kvList)
|
||||
serialize.KVListFormat(buffer, merged...)
|
||||
l.log(LogInfo, msg, level, buffer, nil, kvList)
|
||||
buf := buffer.GetBuffer()
|
||||
l.shared.formatter.MergeAndFormatKVs(&buf.Buffer, l.values, kvList)
|
||||
l.log(LogInfo, msg, level, buf, nil, kvList)
|
||||
}
|
||||
|
||||
func (l tlogger) Enabled(level int) bool {
|
||||
@ -337,28 +362,35 @@ func (l tlogger) Error(err error, msg string, kvList ...interface{}) {
|
||||
}
|
||||
|
||||
l.shared.t.Helper()
|
||||
buffer := &bytes.Buffer{}
|
||||
buf := buffer.GetBuffer()
|
||||
if err != nil {
|
||||
serialize.KVListFormat(buffer, "err", err)
|
||||
l.shared.formatter.KVFormat(&buf.Buffer, "err", err)
|
||||
}
|
||||
merged := serialize.MergeKVs(l.values, kvList)
|
||||
serialize.KVListFormat(buffer, merged...)
|
||||
l.log(LogError, msg, 0, buffer, err, kvList)
|
||||
l.shared.formatter.MergeAndFormatKVs(&buf.Buffer, l.values, kvList)
|
||||
l.log(LogError, msg, 0, buf, err, kvList)
|
||||
}
|
||||
|
||||
func (l tlogger) log(what LogType, msg string, level int, buffer *bytes.Buffer, err error, kvList []interface{}) {
|
||||
func (l tlogger) log(what LogType, msg string, level int, buf *buffer.Buffer, err error, kvList []interface{}) {
|
||||
l.shared.t.Helper()
|
||||
args := []interface{}{what}
|
||||
s := severity.InfoLog
|
||||
if what == LogError {
|
||||
s = severity.ErrorLog
|
||||
}
|
||||
args := []interface{}{buf.SprintHeader(s, time.Now())}
|
||||
if l.prefix != "" {
|
||||
args = append(args, l.prefix+":")
|
||||
}
|
||||
args = append(args, msg)
|
||||
if buffer.Len() > 0 {
|
||||
if buf.Len() > 0 {
|
||||
// Skip leading space inserted by serialize.KVListFormat.
|
||||
args = append(args, string(buffer.Bytes()[1:]))
|
||||
args = append(args, string(buf.Bytes()[1:]))
|
||||
}
|
||||
l.shared.t.Log(args...)
|
||||
|
||||
if !l.shared.config.co.bufferLogs {
|
||||
return
|
||||
}
|
||||
|
||||
l.shared.buffer.mutex.Lock()
|
||||
defer l.shared.buffer.mutex.Unlock()
|
||||
|
||||
|
874
vendor/k8s.io/klog/v2/test/output.go
generated
vendored
874
vendor/k8s.io/klog/v2/test/output.go
generated
vendored
@ -39,24 +39,41 @@ import (
|
||||
"github.com/go-logr/logr"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/klog/v2/textlogger"
|
||||
)
|
||||
|
||||
// InitKlog must be called once in an init function of a test package to
|
||||
// configure klog for testing with Output.
|
||||
// InitKlog must be called in a test to configure klog for testing.
|
||||
// The previous klog configuration will be restored automatically
|
||||
// after the test.
|
||||
//
|
||||
// The returned flag set has the klog flags registered. It can
|
||||
// be used to make further changes to the klog configuration.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func InitKlog() {
|
||||
func InitKlog(tb testing.TB) *flag.FlagSet {
|
||||
state := klog.CaptureState()
|
||||
tb.Cleanup(state.Restore)
|
||||
|
||||
expectNoError := func(err error) {
|
||||
if err != nil {
|
||||
tb.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// klog gets configured so that it writes to a single output file that
|
||||
// will be set during tests with SetOutput.
|
||||
klog.InitFlags(nil)
|
||||
flag.Set("v", "10")
|
||||
flag.Set("log_file", "/dev/null")
|
||||
flag.Set("logtostderr", "false")
|
||||
flag.Set("alsologtostderr", "false")
|
||||
flag.Set("stderrthreshold", "10")
|
||||
var fs flag.FlagSet
|
||||
klog.InitFlags(&fs)
|
||||
expectNoError(fs.Set("v", "10"))
|
||||
expectNoError(fs.Set("log_file", "/dev/null"))
|
||||
expectNoError(fs.Set("logtostderr", "false"))
|
||||
expectNoError(fs.Set("alsologtostderr", "false"))
|
||||
expectNoError(fs.Set("stderrthreshold", "10"))
|
||||
|
||||
return &fs
|
||||
}
|
||||
|
||||
// OutputConfig contains optional settings for Output.
|
||||
@ -92,6 +109,405 @@ type OutputConfig struct {
|
||||
SupportsVModule bool
|
||||
}
|
||||
|
||||
type testcase struct {
|
||||
withHelper bool // use wrappers that get skipped during stack unwinding
|
||||
withNames []string
|
||||
// For a first WithValues call: logger1 := logger.WithValues()
|
||||
withValues []interface{}
|
||||
// For another WithValues call: logger2 := logger1.WithValues()
|
||||
moreValues []interface{}
|
||||
// For another WithValues call on the same logger as before: logger3 := logger1.WithValues()
|
||||
evenMoreValues []interface{}
|
||||
v int
|
||||
vmodule string
|
||||
text string
|
||||
values []interface{}
|
||||
err error
|
||||
expectedOutput string
|
||||
}
|
||||
|
||||
var tests = map[string]testcase{
|
||||
"log with values": {
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"call depth": {
|
||||
text: "helper",
|
||||
withHelper: true,
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "helper" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"verbosity enabled": {
|
||||
text: "you see me",
|
||||
v: 9,
|
||||
expectedOutput: `I output.go:<LINE>] "you see me"
|
||||
`,
|
||||
},
|
||||
"verbosity disabled": {
|
||||
text: "you don't see me",
|
||||
v: 11,
|
||||
},
|
||||
"vmodule": {
|
||||
text: "v=11: you see me because of -vmodule output=11",
|
||||
v: 11,
|
||||
vmodule: "output=11",
|
||||
expectedOutput: `I output.go:<LINE>] "v=11: you see me because of -vmodule output=11"
|
||||
`,
|
||||
},
|
||||
"other vmodule": {
|
||||
text: "v=11: you still don't see me because of -vmodule output_helper=11",
|
||||
v: 11,
|
||||
vmodule: "output_helper=11",
|
||||
},
|
||||
"vmodule with helper": {
|
||||
text: "v=11: you see me because of -vmodule output=11",
|
||||
withHelper: true,
|
||||
v: 11,
|
||||
vmodule: "output=11",
|
||||
expectedOutput: `I output.go:<LINE>] "v=11: you see me because of -vmodule output=11"
|
||||
`,
|
||||
},
|
||||
"other vmodule with helper": {
|
||||
text: "v=11: you still don't see me because of -vmodule output_helper=11",
|
||||
withHelper: true,
|
||||
v: 11,
|
||||
vmodule: "output_helper=11",
|
||||
},
|
||||
"log with name and values": {
|
||||
withNames: []string{"me"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "me: test" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"log with multiple names and values": {
|
||||
withNames: []string{"hello", "world"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "hello/world: test" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"override single value": {
|
||||
withValues: []interface{}{"akey", "avalue"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue2"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="avalue2"
|
||||
`,
|
||||
},
|
||||
"override WithValues": {
|
||||
withValues: []interface{}{"duration", time.Hour, "X", "y"},
|
||||
text: "test",
|
||||
values: []interface{}{"duration", time.Minute, "A", "b"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" X="y" duration="1m0s" A="b"
|
||||
`,
|
||||
},
|
||||
"odd WithValues": {
|
||||
withValues: []interface{}{"keyWithoutValue"},
|
||||
moreValues: []interface{}{"anotherKeyWithoutValue"},
|
||||
text: "odd WithValues",
|
||||
expectedOutput: `I output.go:<LINE>] "odd WithValues" keyWithoutValue="(MISSING)"
|
||||
I output.go:<LINE>] "odd WithValues" keyWithoutValue="(MISSING)" anotherKeyWithoutValue="(MISSING)"
|
||||
I output.go:<LINE>] "odd WithValues" keyWithoutValue="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"multiple WithValues": {
|
||||
withValues: []interface{}{"firstKey", 1},
|
||||
moreValues: []interface{}{"secondKey", 2},
|
||||
evenMoreValues: []interface{}{"secondKey", 3},
|
||||
text: "test",
|
||||
expectedOutput: `I output.go:<LINE>] "test" firstKey=1
|
||||
I output.go:<LINE>] "test" firstKey=1 secondKey=2
|
||||
I output.go:<LINE>] "test" firstKey=1
|
||||
I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
`,
|
||||
},
|
||||
"empty WithValues": {
|
||||
withValues: []interface{}{},
|
||||
text: "test",
|
||||
expectedOutput: `I output.go:<LINE>] "test"
|
||||
`,
|
||||
},
|
||||
"print duplicate keys in arguments": {
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue", "akey", "avalue2"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="avalue" akey="avalue2"
|
||||
`,
|
||||
},
|
||||
"preserve order of key/value pairs": {
|
||||
withValues: []interface{}{"akey9", "avalue9", "akey8", "avalue8", "akey1", "avalue1"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey5", "avalue5", "akey4", "avalue4"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey9="avalue9" akey8="avalue8" akey1="avalue1" akey5="avalue5" akey4="avalue4"
|
||||
`,
|
||||
},
|
||||
"handle odd-numbers of KVs": {
|
||||
text: "odd arguments",
|
||||
values: []interface{}{"akey", "avalue", "akey2"},
|
||||
expectedOutput: `I output.go:<LINE>] "odd arguments" akey="avalue" akey2="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"html characters": {
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "<&>"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="<&>"
|
||||
`,
|
||||
},
|
||||
"quotation": {
|
||||
text: `"quoted"`,
|
||||
values: []interface{}{"key", `"quoted value"`},
|
||||
expectedOutput: `I output.go:<LINE>] "\"quoted\"" key="\"quoted value\""
|
||||
`,
|
||||
},
|
||||
"handle odd-numbers of KVs in both log values and Info args": {
|
||||
withValues: []interface{}{"basekey1", "basevar1", "basekey2"},
|
||||
text: "both odd",
|
||||
values: []interface{}{"akey", "avalue", "akey2"},
|
||||
expectedOutput: `I output.go:<LINE>] "both odd" basekey1="basevar1" basekey2="(MISSING)" akey="avalue" akey2="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"KObj": {
|
||||
text: "test",
|
||||
values: []interface{}{"pod", klog.KObj(&kmeta{Name: "pod-1", Namespace: "kube-system"})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pod="kube-system/pod-1"
|
||||
`,
|
||||
},
|
||||
"KObjs": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjs([]interface{}{
|
||||
&kmeta{Name: "pod-1", Namespace: "kube-system"},
|
||||
&kmeta{Name: "pod-2", Namespace: "kube-system"},
|
||||
})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods=[kube-system/pod-1 kube-system/pod-2]
|
||||
`,
|
||||
},
|
||||
"KObjSlice okay": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice([]interface{}{
|
||||
&kmeta{Name: "pod-1", Namespace: "kube-system"},
|
||||
&kmeta{Name: "pod-2", Namespace: "kube-system"},
|
||||
})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods=[kube-system/pod-1 kube-system/pod-2]
|
||||
`,
|
||||
},
|
||||
"KObjSlice nil arg": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice(nil)},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods=[]
|
||||
`,
|
||||
},
|
||||
"KObjSlice int arg": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice(1)},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods="<KObjSlice needs a slice, got type int>"
|
||||
`,
|
||||
},
|
||||
"KObjSlice nil entry": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice([]interface{}{
|
||||
&kmeta{Name: "pod-1", Namespace: "kube-system"},
|
||||
nil,
|
||||
})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods=[kube-system/pod-1 <nil>]
|
||||
`,
|
||||
},
|
||||
"KObjSlice ints": {
|
||||
text: "test",
|
||||
values: []interface{}{"ints",
|
||||
klog.KObjSlice([]int{1, 2, 3})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" ints=[<KObjSlice needs a slice of values implementing KMetadata, got type int>]
|
||||
`,
|
||||
},
|
||||
"regular error types as value": {
|
||||
text: "test",
|
||||
values: []interface{}{"err", errors.New("whoops")},
|
||||
expectedOutput: `I output.go:<LINE>] "test" err="whoops"
|
||||
`,
|
||||
},
|
||||
"ignore MarshalJSON": {
|
||||
text: "test",
|
||||
values: []interface{}{"err", &customErrorJSON{"whoops"}},
|
||||
expectedOutput: `I output.go:<LINE>] "test" err="whoops"
|
||||
`,
|
||||
},
|
||||
"regular error types when using logr.Error": {
|
||||
text: "test",
|
||||
err: errors.New("whoops"),
|
||||
expectedOutput: `E output.go:<LINE>] "test" err="whoops"
|
||||
`,
|
||||
},
|
||||
"Error() for nil": {
|
||||
text: "error nil",
|
||||
err: (*customErrorJSON)(nil),
|
||||
expectedOutput: `E output.go:<LINE>] "error nil" err="<panic: runtime error: invalid memory address or nil pointer dereference>"
|
||||
`,
|
||||
},
|
||||
"String() for nil": {
|
||||
text: "stringer nil",
|
||||
values: []interface{}{"stringer", (*stringer)(nil)},
|
||||
expectedOutput: `I output.go:<LINE>] "stringer nil" stringer="<panic: runtime error: invalid memory address or nil pointer dereference>"
|
||||
`,
|
||||
},
|
||||
"MarshalLog() for nil": {
|
||||
text: "marshaler nil",
|
||||
values: []interface{}{"obj", (*klog.ObjectRef)(nil)},
|
||||
expectedOutput: `I output.go:<LINE>] "marshaler nil" obj="<panic: value method k8s.io/klog/v2.ObjectRef.WriteText called using nil *ObjectRef pointer>"
|
||||
`,
|
||||
},
|
||||
"Error() that panics": {
|
||||
text: "error panic",
|
||||
err: faultyError{},
|
||||
expectedOutput: `E output.go:<LINE>] "error panic" err="<panic: fake Error panic>"
|
||||
`,
|
||||
},
|
||||
"String() that panics": {
|
||||
text: "stringer panic",
|
||||
values: []interface{}{"stringer", faultyStringer{}},
|
||||
expectedOutput: `I output.go:<LINE>] "stringer panic" stringer="<panic: fake String panic>"
|
||||
`,
|
||||
},
|
||||
"MarshalLog() that panics": {
|
||||
text: "marshaler panic",
|
||||
values: []interface{}{"obj", faultyMarshaler{}},
|
||||
expectedOutput: `I output.go:<LINE>] "marshaler panic" obj="<panic: fake MarshalLog panic>"
|
||||
`,
|
||||
},
|
||||
"MarshalLog() that returns itself": {
|
||||
text: "marshaler recursion",
|
||||
values: []interface{}{"obj", recursiveMarshaler{}},
|
||||
expectedOutput: `I output.go:<LINE>] "marshaler recursion" obj={}
|
||||
`,
|
||||
},
|
||||
"handle integer keys": {
|
||||
withValues: []interface{}{1, "value", 2, "value2"},
|
||||
text: "integer keys",
|
||||
values: []interface{}{"akey", "avalue", "akey2"},
|
||||
expectedOutput: `I output.go:<LINE>] "integer keys" %!s(int=1)="value" %!s(int=2)="value2" akey="avalue" akey2="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"struct keys": {
|
||||
withValues: []interface{}{struct{ name string }{"name"}, "value", "test", "other value"},
|
||||
text: "struct keys",
|
||||
values: []interface{}{"key", "val"},
|
||||
expectedOutput: `I output.go:<LINE>] "struct keys" {name}="value" test="other value" key="val"
|
||||
`,
|
||||
},
|
||||
"map keys": {
|
||||
withValues: []interface{}{},
|
||||
text: "map keys",
|
||||
values: []interface{}{map[string]bool{"test": true}, "test"},
|
||||
expectedOutput: `I output.go:<LINE>] "map keys" map[test:%!s(bool=true)]="test"
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
func printWithLogger(logger logr.Logger, test testcase) {
|
||||
for _, name := range test.withNames {
|
||||
logger = logger.WithName(name)
|
||||
}
|
||||
// When we have multiple WithValues calls, we test
|
||||
// first with the initial set of additional values, then
|
||||
// the combination, then again the original logger.
|
||||
// It must not have been modified. This produces
|
||||
// three log entries.
|
||||
logger = logger.WithValues(test.withValues...) // <WITH-VALUES>
|
||||
loggers := []logr.Logger{logger}
|
||||
if test.moreValues != nil {
|
||||
loggers = append(loggers, logger.WithValues(test.moreValues...), logger) // <WITH-VALUES-2>
|
||||
}
|
||||
if test.evenMoreValues != nil {
|
||||
loggers = append(loggers, logger.WithValues(test.evenMoreValues...)) // <WITH-VALUES-3>
|
||||
}
|
||||
for _, logger := range loggers {
|
||||
if test.withHelper {
|
||||
loggerHelper(logger.V(test.v), test.text, test.values) // <LINE>
|
||||
} else if test.err != nil {
|
||||
logger.Error(test.err, test.text, test.values...) // <LINE>
|
||||
} else {
|
||||
logger.V(test.v).Info(test.text, test.values...) // <LINE>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _, _, printWithLoggerLine, _ = runtime.Caller(0) // anchor for finding the line numbers above
|
||||
|
||||
func initPrintWithKlog(tb testing.TB, test testcase) {
|
||||
if test.withHelper && test.vmodule != "" {
|
||||
tb.Skip("klog does not support -vmodule properly when using helper functions")
|
||||
}
|
||||
|
||||
state := klog.CaptureState()
|
||||
tb.Cleanup(state.Restore)
|
||||
|
||||
var fs flag.FlagSet
|
||||
klog.InitFlags(&fs)
|
||||
if err := fs.Set("v", "10"); err != nil {
|
||||
tb.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if err := fs.Set("vmodule", test.vmodule); err != nil {
|
||||
tb.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func printWithKlog(test testcase) {
|
||||
kv := []interface{}{}
|
||||
haveKeyInValues := func(key interface{}) bool {
|
||||
for i := 0; i < len(test.values); i += 2 {
|
||||
if key == test.values[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
appendKV := func(withValues []interface{}) {
|
||||
if len(withValues)%2 != 0 {
|
||||
withValues = append(withValues, "(MISSING)")
|
||||
}
|
||||
for i := 0; i < len(withValues); i += 2 {
|
||||
if !haveKeyInValues(withValues[i]) {
|
||||
kv = append(kv, withValues[i], withValues[i+1])
|
||||
}
|
||||
}
|
||||
}
|
||||
// Here we need to emulate the handling of WithValues above.
|
||||
appendKV(test.withValues)
|
||||
kvs := [][]interface{}{copySlice(kv)}
|
||||
if test.moreValues != nil {
|
||||
appendKV(test.moreValues)
|
||||
kvs = append(kvs, copySlice(kv), copySlice(kvs[0]))
|
||||
}
|
||||
if test.evenMoreValues != nil {
|
||||
kv = copySlice(kvs[0])
|
||||
appendKV(test.evenMoreValues)
|
||||
kvs = append(kvs, copySlice(kv))
|
||||
}
|
||||
for _, kv := range kvs {
|
||||
if len(test.values) > 0 {
|
||||
kv = append(kv, test.values...)
|
||||
}
|
||||
text := test.text
|
||||
if len(test.withNames) > 0 {
|
||||
text = strings.Join(test.withNames, "/") + ": " + text
|
||||
}
|
||||
if test.withHelper {
|
||||
klogHelper(klog.Level(test.v), text, kv)
|
||||
} else if test.err != nil {
|
||||
klog.ErrorS(test.err, text, kv...)
|
||||
} else {
|
||||
klog.V(klog.Level(test.v)).InfoS(text, kv...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _, _, printWithKlogLine, _ = runtime.Caller(0) // anchor for finding the line numbers above
|
||||
|
||||
// Output covers various special cases of emitting log output.
|
||||
// It can be used for arbitrary logr.Logger implementations.
|
||||
//
|
||||
@ -109,369 +525,9 @@ type OutputConfig struct {
|
||||
// later release. The test cases and thus the expected output also may
|
||||
// change.
|
||||
func Output(t *testing.T, config OutputConfig) {
|
||||
tests := map[string]struct {
|
||||
withHelper bool // use wrappers that get skipped during stack unwinding
|
||||
withNames []string
|
||||
// For a first WithValues call: logger1 := logger.WithValues()
|
||||
withValues []interface{}
|
||||
// For another WithValues call: logger2 := logger1.WithValues()
|
||||
moreValues []interface{}
|
||||
// For another WithValues call on the same logger as before: logger3 := logger1.WithValues()
|
||||
evenMoreValues []interface{}
|
||||
v int
|
||||
vmodule string
|
||||
text string
|
||||
values []interface{}
|
||||
err error
|
||||
expectedOutput string
|
||||
}{
|
||||
"log with values": {
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"call depth": {
|
||||
text: "helper",
|
||||
withHelper: true,
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "helper" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"verbosity enabled": {
|
||||
text: "you see me",
|
||||
v: 9,
|
||||
expectedOutput: `I output.go:<LINE>] "you see me"
|
||||
`,
|
||||
},
|
||||
"verbosity disabled": {
|
||||
text: "you don't see me",
|
||||
v: 11,
|
||||
},
|
||||
"vmodule": {
|
||||
text: "v=11: you see me because of -vmodule output=11",
|
||||
v: 11,
|
||||
vmodule: "output=11",
|
||||
},
|
||||
"other vmodule": {
|
||||
text: "v=11: you still don't see me because of -vmodule output_helper=11",
|
||||
v: 11,
|
||||
vmodule: "output_helper=11",
|
||||
},
|
||||
"log with name and values": {
|
||||
withNames: []string{"me"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "me: test" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"log with multiple names and values": {
|
||||
withNames: []string{"hello", "world"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue"},
|
||||
expectedOutput: `I output.go:<LINE>] "hello/world: test" akey="avalue"
|
||||
`,
|
||||
},
|
||||
"override single value": {
|
||||
withValues: []interface{}{"akey", "avalue"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue2"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="avalue2"
|
||||
`,
|
||||
},
|
||||
"override WithValues": {
|
||||
withValues: []interface{}{"duration", time.Hour, "X", "y"},
|
||||
text: "test",
|
||||
values: []interface{}{"duration", time.Minute, "A", "b"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" X="y" duration="1m0s" A="b"
|
||||
`,
|
||||
},
|
||||
"odd WithValues": {
|
||||
withValues: []interface{}{"keyWithoutValue"},
|
||||
moreValues: []interface{}{"anotherKeyWithoutValue"},
|
||||
text: "odd WithValues",
|
||||
expectedOutput: `I output.go:<LINE>] "odd WithValues" keyWithoutValue="(MISSING)"
|
||||
I output.go:<LINE>] "odd WithValues" keyWithoutValue="(MISSING)" anotherKeyWithoutValue="(MISSING)"
|
||||
I output.go:<LINE>] "odd WithValues" keyWithoutValue="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"multiple WithValues": {
|
||||
withValues: []interface{}{"firstKey", 1},
|
||||
moreValues: []interface{}{"secondKey", 2},
|
||||
evenMoreValues: []interface{}{"secondKey", 3},
|
||||
text: "test",
|
||||
expectedOutput: `I output.go:<LINE>] "test" firstKey=1
|
||||
I output.go:<LINE>] "test" firstKey=1 secondKey=2
|
||||
I output.go:<LINE>] "test" firstKey=1
|
||||
I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
`,
|
||||
},
|
||||
"empty WithValues": {
|
||||
withValues: []interface{}{},
|
||||
text: "test",
|
||||
expectedOutput: `I output.go:<LINE>] "test"
|
||||
`,
|
||||
},
|
||||
"print duplicate keys in arguments": {
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "avalue", "akey", "avalue2"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="avalue" akey="avalue2"
|
||||
`,
|
||||
},
|
||||
"preserve order of key/value pairs": {
|
||||
withValues: []interface{}{"akey9", "avalue9", "akey8", "avalue8", "akey1", "avalue1"},
|
||||
text: "test",
|
||||
values: []interface{}{"akey5", "avalue5", "akey4", "avalue4"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey9="avalue9" akey8="avalue8" akey1="avalue1" akey5="avalue5" akey4="avalue4"
|
||||
`,
|
||||
},
|
||||
"handle odd-numbers of KVs": {
|
||||
text: "odd arguments",
|
||||
values: []interface{}{"akey", "avalue", "akey2"},
|
||||
expectedOutput: `I output.go:<LINE>] "odd arguments" akey="avalue" akey2="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"html characters": {
|
||||
text: "test",
|
||||
values: []interface{}{"akey", "<&>"},
|
||||
expectedOutput: `I output.go:<LINE>] "test" akey="<&>"
|
||||
`,
|
||||
},
|
||||
"quotation": {
|
||||
text: `"quoted"`,
|
||||
values: []interface{}{"key", `"quoted value"`},
|
||||
expectedOutput: `I output.go:<LINE>] "\"quoted\"" key="\"quoted value\""
|
||||
`,
|
||||
},
|
||||
"handle odd-numbers of KVs in both log values and Info args": {
|
||||
withValues: []interface{}{"basekey1", "basevar1", "basekey2"},
|
||||
text: "both odd",
|
||||
values: []interface{}{"akey", "avalue", "akey2"},
|
||||
expectedOutput: `I output.go:<LINE>] "both odd" basekey1="basevar1" basekey2="(MISSING)" akey="avalue" akey2="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"KObj": {
|
||||
text: "test",
|
||||
values: []interface{}{"pod", klog.KObj(&kmeta{Name: "pod-1", Namespace: "kube-system"})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pod="kube-system/pod-1"
|
||||
`,
|
||||
},
|
||||
"KObjs": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjs([]interface{}{
|
||||
&kmeta{Name: "pod-1", Namespace: "kube-system"},
|
||||
&kmeta{Name: "pod-2", Namespace: "kube-system"},
|
||||
})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods=[kube-system/pod-1 kube-system/pod-2]
|
||||
`,
|
||||
},
|
||||
"KObjSlice okay": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice([]interface{}{
|
||||
&kmeta{Name: "pod-1", Namespace: "kube-system"},
|
||||
&kmeta{Name: "pod-2", Namespace: "kube-system"},
|
||||
})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods="[kube-system/pod-1 kube-system/pod-2]"
|
||||
`,
|
||||
},
|
||||
"KObjSlice nil arg": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice(nil)},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods="[]"
|
||||
`,
|
||||
},
|
||||
"KObjSlice int arg": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice(1)},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods="<KObjSlice needs a slice, got type int>"
|
||||
`,
|
||||
},
|
||||
"KObjSlice nil entry": {
|
||||
text: "test",
|
||||
values: []interface{}{"pods",
|
||||
klog.KObjSlice([]interface{}{
|
||||
&kmeta{Name: "pod-1", Namespace: "kube-system"},
|
||||
nil,
|
||||
})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" pods="[kube-system/pod-1 <nil>]"
|
||||
`,
|
||||
},
|
||||
"KObjSlice ints": {
|
||||
text: "test",
|
||||
values: []interface{}{"ints",
|
||||
klog.KObjSlice([]int{1, 2, 3})},
|
||||
expectedOutput: `I output.go:<LINE>] "test" ints="<KObjSlice needs a slice of values implementing KMetadata, got type int>"
|
||||
`,
|
||||
},
|
||||
"regular error types as value": {
|
||||
text: "test",
|
||||
values: []interface{}{"err", errors.New("whoops")},
|
||||
expectedOutput: `I output.go:<LINE>] "test" err="whoops"
|
||||
`,
|
||||
},
|
||||
"ignore MarshalJSON": {
|
||||
text: "test",
|
||||
values: []interface{}{"err", &customErrorJSON{"whoops"}},
|
||||
expectedOutput: `I output.go:<LINE>] "test" err="whoops"
|
||||
`,
|
||||
},
|
||||
"regular error types when using logr.Error": {
|
||||
text: "test",
|
||||
err: errors.New("whoops"),
|
||||
expectedOutput: `E output.go:<LINE>] "test" err="whoops"
|
||||
`,
|
||||
},
|
||||
"Error() for nil": {
|
||||
text: "error nil",
|
||||
err: (*customErrorJSON)(nil),
|
||||
expectedOutput: `E output.go:<LINE>] "error nil" err="<panic: runtime error: invalid memory address or nil pointer dereference>"
|
||||
`,
|
||||
},
|
||||
"String() for nil": {
|
||||
text: "stringer nil",
|
||||
values: []interface{}{"stringer", (*stringer)(nil)},
|
||||
expectedOutput: `I output.go:<LINE>] "stringer nil" stringer="<panic: runtime error: invalid memory address or nil pointer dereference>"
|
||||
`,
|
||||
},
|
||||
"MarshalLog() for nil": {
|
||||
text: "marshaler nil",
|
||||
values: []interface{}{"obj", (*klog.ObjectRef)(nil)},
|
||||
expectedOutput: `I output.go:<LINE>] "marshaler nil" obj="<panic: value method k8s.io/klog/v2.ObjectRef.String called using nil *ObjectRef pointer>"
|
||||
`,
|
||||
},
|
||||
"Error() that panics": {
|
||||
text: "error panic",
|
||||
err: faultyError{},
|
||||
expectedOutput: `E output.go:<LINE>] "error panic" err="<panic: fake Error panic>"
|
||||
`,
|
||||
},
|
||||
"String() that panics": {
|
||||
text: "stringer panic",
|
||||
values: []interface{}{"stringer", faultyStringer{}},
|
||||
expectedOutput: `I output.go:<LINE>] "stringer panic" stringer="<panic: fake String panic>"
|
||||
`,
|
||||
},
|
||||
"MarshalLog() that panics": {
|
||||
text: "marshaler panic",
|
||||
values: []interface{}{"obj", faultyMarshaler{}},
|
||||
expectedOutput: `I output.go:<LINE>] "marshaler panic" obj="<panic: fake MarshalLog panic>"
|
||||
`,
|
||||
},
|
||||
"MarshalLog() that returns itself": {
|
||||
text: "marshaler recursion",
|
||||
values: []interface{}{"obj", recursiveMarshaler{}},
|
||||
expectedOutput: `I output.go:<LINE>] "marshaler recursion" obj={}
|
||||
`,
|
||||
},
|
||||
"handle integer keys": {
|
||||
withValues: []interface{}{1, "value", 2, "value2"},
|
||||
text: "integer keys",
|
||||
values: []interface{}{"akey", "avalue", "akey2"},
|
||||
expectedOutput: `I output.go:<LINE>] "integer keys" %!s(int=1)="value" %!s(int=2)="value2" akey="avalue" akey2="(MISSING)"
|
||||
`,
|
||||
},
|
||||
"struct keys": {
|
||||
withValues: []interface{}{struct{ name string }{"name"}, "value", "test", "other value"},
|
||||
text: "struct keys",
|
||||
values: []interface{}{"key", "val"},
|
||||
expectedOutput: `I output.go:<LINE>] "struct keys" {name}="value" test="other value" key="val"
|
||||
`,
|
||||
},
|
||||
"map keys": {
|
||||
withValues: []interface{}{},
|
||||
text: "map keys",
|
||||
values: []interface{}{map[string]bool{"test": true}, "test"},
|
||||
expectedOutput: `I output.go:<LINE>] "map keys" map[test:%!s(bool=true)]="test"
|
||||
`,
|
||||
},
|
||||
}
|
||||
for n, test := range tests {
|
||||
t.Run(n, func(t *testing.T) {
|
||||
defer klog.ClearLogger()
|
||||
|
||||
printWithLogger := func(logger logr.Logger) {
|
||||
for _, name := range test.withNames {
|
||||
logger = logger.WithName(name)
|
||||
}
|
||||
// When we have multiple WithValues calls, we test
|
||||
// first with the initial set of additional values, then
|
||||
// the combination, then again the original logger.
|
||||
// It must not have been modified. This produces
|
||||
// three log entries.
|
||||
logger = logger.WithValues(test.withValues...) // <WITH-VALUES>
|
||||
loggers := []logr.Logger{logger}
|
||||
if test.moreValues != nil {
|
||||
loggers = append(loggers, logger.WithValues(test.moreValues...), logger) // <WITH-VALUES-2>
|
||||
}
|
||||
if test.evenMoreValues != nil {
|
||||
loggers = append(loggers, logger.WithValues(test.evenMoreValues...)) // <WITH-VALUES-3>
|
||||
}
|
||||
for _, logger := range loggers {
|
||||
if test.withHelper {
|
||||
loggerHelper(logger, test.text, test.values) // <LINE>
|
||||
} else if test.err != nil {
|
||||
logger.Error(test.err, test.text, test.values...) // <LINE>
|
||||
} else {
|
||||
logger.V(test.v).Info(test.text, test.values...) // <LINE>
|
||||
}
|
||||
}
|
||||
}
|
||||
_, _, printWithLoggerLine, _ := runtime.Caller(0)
|
||||
|
||||
printWithKlog := func() {
|
||||
kv := []interface{}{}
|
||||
haveKeyInValues := func(key interface{}) bool {
|
||||
for i := 0; i < len(test.values); i += 2 {
|
||||
if key == test.values[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
appendKV := func(withValues []interface{}) {
|
||||
if len(withValues)%2 != 0 {
|
||||
withValues = append(withValues, "(MISSING)")
|
||||
}
|
||||
for i := 0; i < len(withValues); i += 2 {
|
||||
if !haveKeyInValues(withValues[i]) {
|
||||
kv = append(kv, withValues[i], withValues[i+1])
|
||||
}
|
||||
}
|
||||
}
|
||||
// Here we need to emulate the handling of WithValues above.
|
||||
appendKV(test.withValues)
|
||||
kvs := [][]interface{}{copySlice(kv)}
|
||||
if test.moreValues != nil {
|
||||
appendKV(test.moreValues)
|
||||
kvs = append(kvs, copySlice(kv), copySlice(kvs[0]))
|
||||
}
|
||||
if test.evenMoreValues != nil {
|
||||
kv = copySlice(kvs[0])
|
||||
appendKV(test.evenMoreValues)
|
||||
kvs = append(kvs, copySlice(kv))
|
||||
}
|
||||
for _, kv := range kvs {
|
||||
if len(test.values) > 0 {
|
||||
kv = append(kv, test.values...)
|
||||
}
|
||||
text := test.text
|
||||
if len(test.withNames) > 0 {
|
||||
text = strings.Join(test.withNames, "/") + ": " + text
|
||||
}
|
||||
if test.withHelper {
|
||||
klogHelper(text, kv)
|
||||
} else if test.err != nil {
|
||||
klog.ErrorS(test.err, text, kv...)
|
||||
} else {
|
||||
klog.V(klog.Level(test.v)).InfoS(text, kv...)
|
||||
}
|
||||
}
|
||||
}
|
||||
_, _, printWithKlogLine, _ := runtime.Caller(0)
|
||||
initPrintWithKlog(t, test)
|
||||
|
||||
testOutput := func(t *testing.T, expectedLine int, print func(buffer *bytes.Buffer)) {
|
||||
var tmpWriteBuffer bytes.Buffer
|
||||
@ -514,16 +570,16 @@ I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
|
||||
if config.NewLogger == nil {
|
||||
// Test klog.
|
||||
testOutput(t, printWithKlogLine, func(buffer *bytes.Buffer) {
|
||||
printWithKlog()
|
||||
testOutput(t, printWithKlogLine-1, func(buffer *bytes.Buffer) {
|
||||
printWithKlog(test)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if config.AsBackend {
|
||||
testOutput(t, printWithKlogLine, func(buffer *bytes.Buffer) {
|
||||
klog.SetLogger(config.NewLogger(buffer, 10, ""))
|
||||
printWithKlog()
|
||||
testOutput(t, printWithKlogLine-1, func(buffer *bytes.Buffer) {
|
||||
setLogger(config.NewLogger(buffer, 10, test.vmodule))
|
||||
printWithKlog(test)
|
||||
})
|
||||
return
|
||||
}
|
||||
@ -532,8 +588,8 @@ I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
t.Skip("vmodule not supported")
|
||||
}
|
||||
|
||||
testOutput(t, printWithLoggerLine, func(buffer *bytes.Buffer) {
|
||||
printWithLogger(config.NewLogger(buffer, 10, test.vmodule))
|
||||
testOutput(t, printWithLoggerLine-1, func(buffer *bytes.Buffer) {
|
||||
printWithLogger(config.NewLogger(buffer, 10, test.vmodule), test)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -710,10 +766,11 @@ I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
for i, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
var buffer bytes.Buffer
|
||||
haveWriteKlogBuffer := false
|
||||
if config.NewLogger == nil {
|
||||
klog.SetOutput(&buffer)
|
||||
} else {
|
||||
klog.SetLogger(config.NewLogger(&buffer, 10, ""))
|
||||
haveWriteKlogBuffer = setLogger(config.NewLogger(&buffer, 10, ""))
|
||||
defer klog.ClearLogger()
|
||||
}
|
||||
test.logFunc()
|
||||
@ -734,6 +791,7 @@ I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
// result, including a trailing newline, to
|
||||
// Logger.Info.
|
||||
if config.NewLogger != nil &&
|
||||
!haveWriteKlogBuffer &&
|
||||
!strings.HasSuffix(test.name, "S") &&
|
||||
!strings.HasSuffix(test.name, "SDepth") {
|
||||
// klog: I output.go:<LINE>] hello world
|
||||
@ -767,6 +825,66 @@ I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
}
|
||||
}
|
||||
|
||||
// Benchmark covers various special cases of emitting log output.
|
||||
// It can be used for arbitrary logr.Logger implementations.
|
||||
//
|
||||
// Loggers will be tested with direct calls to Info or
|
||||
// as backend for klog.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release. The test cases and thus the expected output also may
|
||||
// change.
|
||||
func Benchmark(b *testing.B, config OutputConfig) {
|
||||
for n, test := range tests {
|
||||
b.Run(n, func(b *testing.B) {
|
||||
state := klog.CaptureState()
|
||||
defer state.Restore()
|
||||
klog.SetOutput(io.Discard)
|
||||
initPrintWithKlog(b, test)
|
||||
b.ResetTimer()
|
||||
|
||||
if config.NewLogger == nil {
|
||||
// Test klog.
|
||||
for i := 0; i < b.N; i++ {
|
||||
printWithKlog(test)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if config.AsBackend {
|
||||
setLogger(config.NewLogger(io.Discard, 10, ""))
|
||||
for i := 0; i < b.N; i++ {
|
||||
printWithKlog(test)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if test.vmodule != "" && !config.SupportsVModule {
|
||||
b.Skip("vmodule not supported")
|
||||
}
|
||||
|
||||
logger := config.NewLogger(io.Discard, 10, test.vmodule)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
printWithLogger(logger, test)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func setLogger(logger logr.Logger) bool {
|
||||
haveWriteKlogBuffer := false
|
||||
var opts []klog.LoggerOption
|
||||
if writer, ok := logger.GetSink().(textlogger.KlogBufferWriter); ok {
|
||||
opts = append(opts, klog.WriteKlogBuffer(writer.WriteKlogBuffer))
|
||||
haveWriteKlogBuffer = true
|
||||
}
|
||||
klog.SetLoggerWithOptions(logger, opts...)
|
||||
return haveWriteKlogBuffer
|
||||
}
|
||||
|
||||
func copySlice(in []interface{}) []interface{} {
|
||||
return append([]interface{}{}, in...)
|
||||
}
|
||||
|
4
vendor/k8s.io/klog/v2/test/output_helper.go
generated
vendored
4
vendor/k8s.io/klog/v2/test/output_helper.go
generated
vendored
@ -27,6 +27,6 @@ func loggerHelper(logger logr.Logger, msg string, kv []interface{}) {
|
||||
logger.Info(msg, kv...)
|
||||
}
|
||||
|
||||
func klogHelper(msg string, kv []interface{}) {
|
||||
klog.InfoSDepth(1, msg, kv...)
|
||||
func klogHelper(level klog.Level, msg string, kv []interface{}) {
|
||||
klog.V(level).InfoSDepth(1, msg, kv...)
|
||||
}
|
||||
|
17
vendor/k8s.io/klog/v2/test/zapr.go
generated
vendored
17
vendor/k8s.io/klog/v2/test/zapr.go
generated
vendored
@ -73,11 +73,7 @@ func ZaprOutputMappingDirect() map[string]string {
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"test","v":0,"pods":[{"name":"pod-1","namespace":"kube-system"},{"name":"pod-2","namespace":"kube-system"}]}
|
||||
`,
|
||||
|
||||
`I output.go:<LINE>] "test" pods="[kube-system/pod-1 kube-system/pod-2]"
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"test","v":0,"pods":[{"name":"pod-1","namespace":"kube-system"},{"name":"pod-2","namespace":"kube-system"}]}
|
||||
`,
|
||||
|
||||
`I output.go:<LINE>] "test" pods="[]"
|
||||
`I output.go:<LINE>] "test" pods=[]
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"test","v":0,"pods":null}
|
||||
`,
|
||||
|
||||
@ -85,11 +81,11 @@ func ZaprOutputMappingDirect() map[string]string {
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"test","v":0,"pods":"<KObjSlice needs a slice, got type int>"}
|
||||
`,
|
||||
|
||||
`I output.go:<LINE>] "test" ints="<KObjSlice needs a slice of values implementing KMetadata, got type int>"
|
||||
`I output.go:<LINE>] "test" ints=[<KObjSlice needs a slice of values implementing KMetadata, got type int>]
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"test","v":0,"ints":"<KObjSlice needs a slice of values implementing KMetadata, got type int>"}
|
||||
`,
|
||||
|
||||
`I output.go:<LINE>] "test" pods="[kube-system/pod-1 <nil>]"
|
||||
`I output.go:<LINE>] "test" pods=[kube-system/pod-1 <nil>]
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"test","v":0,"pods":[{"name":"pod-1","namespace":"kube-system"},null]}
|
||||
`,
|
||||
|
||||
@ -140,7 +136,7 @@ I output.go:<LINE>] "odd WithValues" keyWithoutValue="(MISSING)"
|
||||
{"caller":"test/output.go:<LINE>","msg":"both odd","basekey1":"basevar1","v":0,"akey":"avalue"}
|
||||
`,
|
||||
|
||||
`I output.go:<LINE>] "marshaler nil" obj="<panic: value method k8s.io/klog/v2.ObjectRef.String called using nil *ObjectRef pointer>"
|
||||
`I output.go:<LINE>] "marshaler nil" obj="<panic: value method k8s.io/klog/v2.ObjectRef.WriteText called using nil *ObjectRef pointer>"
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"marshaler nil","v":0,"objError":"PANIC=value method k8s.io/klog/v2.ObjectRef.MarshalLog called using nil *ObjectRef pointer"}
|
||||
`,
|
||||
|
||||
@ -319,6 +315,11 @@ I output.go:<LINE>] "test" firstKey=1 secondKey=3
|
||||
`: `{"caller":"test/output.go:<LINE>","msg":"non-string key argument passed to logging, ignoring all later arguments","invalid key":{"test":true}}
|
||||
{"caller":"test/output.go:<LINE>","msg":"map keys","v":0}
|
||||
`,
|
||||
|
||||
// zapr does not support vmodule checks and thus always
|
||||
// discards these messages.
|
||||
`I output.go:<LINE>] "v=11: you see me because of -vmodule output=11"
|
||||
`: ``,
|
||||
} {
|
||||
mapping[key] = value
|
||||
}
|
||||
|
153
vendor/k8s.io/klog/v2/textlogger/options.go
generated
vendored
Normal file
153
vendor/k8s.io/klog/v2/textlogger/options.go
generated
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package textlogger
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"k8s.io/klog/v2/internal/verbosity"
|
||||
)
|
||||
|
||||
// Config influences logging in a text logger. To make this configurable via
|
||||
// command line flags, instantiate this once per program and use AddFlags to
|
||||
// bind command line flags to the instance before passing it to NewTestContext.
|
||||
//
|
||||
// Must be constructed with NewConfig.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
type Config struct {
|
||||
vstate *verbosity.VState
|
||||
co configOptions
|
||||
}
|
||||
|
||||
// Verbosity returns a value instance that can be used to query (via String) or
|
||||
// modify (via Set) the verbosity threshold. This is thread-safe and can be
|
||||
// done at runtime.
|
||||
func (c *Config) Verbosity() flag.Value {
|
||||
return c.vstate.V()
|
||||
}
|
||||
|
||||
// VModule returns a value instance that can be used to query (via String) or
|
||||
// modify (via Set) the vmodule settings. This is thread-safe and can be done
|
||||
// at runtime.
|
||||
func (c *Config) VModule() flag.Value {
|
||||
return c.vstate.VModule()
|
||||
}
|
||||
|
||||
// ConfigOption implements functional parameters for NewConfig.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
type ConfigOption func(co *configOptions)
|
||||
|
||||
type configOptions struct {
|
||||
verbosityFlagName string
|
||||
vmoduleFlagName string
|
||||
verbosityDefault int
|
||||
output io.Writer
|
||||
}
|
||||
|
||||
// VerbosityFlagName overrides the default -v for the verbosity level.
|
||||
func VerbosityFlagName(name string) ConfigOption {
|
||||
return func(co *configOptions) {
|
||||
|
||||
co.verbosityFlagName = name
|
||||
}
|
||||
}
|
||||
|
||||
// VModulFlagName overrides the default -vmodule for the per-module
|
||||
// verbosity levels.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func VModuleFlagName(name string) ConfigOption {
|
||||
return func(co *configOptions) {
|
||||
co.vmoduleFlagName = name
|
||||
}
|
||||
}
|
||||
|
||||
// Verbosity overrides the default verbosity level of 0.
|
||||
// See https://github.com/kubernetes/community/blob/9406b4352fe2d5810cb21cc3cb059ce5886de157/contributors/devel/sig-instrumentation/logging.md#logging-conventions
|
||||
// for log level conventions in Kubernetes.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func Verbosity(level int) ConfigOption {
|
||||
return func(co *configOptions) {
|
||||
co.verbosityDefault = level
|
||||
}
|
||||
}
|
||||
|
||||
// Output overrides stderr as the output stream.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func Output(output io.Writer) ConfigOption {
|
||||
return func(co *configOptions) {
|
||||
co.output = output
|
||||
}
|
||||
}
|
||||
|
||||
// NewConfig returns a configuration with recommended defaults and optional
|
||||
// modifications. Command line flags are not bound to any FlagSet yet.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func NewConfig(opts ...ConfigOption) *Config {
|
||||
c := &Config{
|
||||
vstate: verbosity.New(),
|
||||
co: configOptions{
|
||||
verbosityFlagName: "v",
|
||||
vmoduleFlagName: "vmodule",
|
||||
verbosityDefault: 0,
|
||||
output: os.Stderr,
|
||||
},
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(&c.co)
|
||||
}
|
||||
|
||||
c.Verbosity().Set(strconv.FormatInt(int64(c.co.verbosityDefault), 10))
|
||||
return c
|
||||
}
|
||||
|
||||
// AddFlags registers the command line flags that control the configuration.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
func (c *Config) AddFlags(fs *flag.FlagSet) {
|
||||
fs.Var(c.Verbosity(), c.co.verbosityFlagName, "number for the log level verbosity of the testing logger")
|
||||
fs.Var(c.VModule(), c.co.vmoduleFlagName, "comma-separated list of pattern=N log level settings for files matching the patterns")
|
||||
}
|
173
vendor/k8s.io/klog/v2/textlogger/textlogger.go
generated
vendored
Normal file
173
vendor/k8s.io/klog/v2/textlogger/textlogger.go
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
Copyright 2020 Intel Coporation.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package textlogger contains an implementation of the logr interface
|
||||
// which is producing the exact same output as klog.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This package is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
package textlogger
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
|
||||
"k8s.io/klog/v2/internal/buffer"
|
||||
"k8s.io/klog/v2/internal/serialize"
|
||||
"k8s.io/klog/v2/internal/severity"
|
||||
"k8s.io/klog/v2/internal/verbosity"
|
||||
)
|
||||
|
||||
var (
|
||||
// TimeNow is used to retrieve the current time. May be changed for testing.
|
||||
//
|
||||
// Experimental
|
||||
//
|
||||
// Notice: This variable is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release.
|
||||
TimeNow = time.Now
|
||||
)
|
||||
|
||||
// NewLogger constructs a new logger.
|
||||
//
|
||||
// Verbosity can be modified at any time through the Config.V and
|
||||
// Config.VModule API.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// Notice: This function is EXPERIMENTAL and may be changed or removed in a
|
||||
// later release. The behavior of the returned Logger may change.
|
||||
func NewLogger(c *Config) logr.Logger {
|
||||
return logr.New(&tlogger{
|
||||
prefix: "",
|
||||
values: nil,
|
||||
config: c,
|
||||
})
|
||||
}
|
||||
|
||||
type tlogger struct {
|
||||
callDepth int
|
||||
prefix string
|
||||
values []interface{}
|
||||
config *Config
|
||||
}
|
||||
|
||||
func (l *tlogger) Init(info logr.RuntimeInfo) {
|
||||
l.callDepth = info.CallDepth
|
||||
}
|
||||
|
||||
func (l *tlogger) WithCallDepth(depth int) logr.LogSink {
|
||||
newLogger := *l
|
||||
newLogger.callDepth += depth
|
||||
return &newLogger
|
||||
}
|
||||
|
||||
func (l *tlogger) Enabled(level int) bool {
|
||||
// Skip this function and the Logger.Info call, then
|
||||
// also any additional stack frames from WithCallDepth.
|
||||
return l.config.vstate.Enabled(verbosity.Level(level), 2+l.callDepth)
|
||||
}
|
||||
|
||||
func (l *tlogger) Info(level int, msg string, kvList ...interface{}) {
|
||||
l.print(nil, severity.InfoLog, msg, kvList)
|
||||
}
|
||||
|
||||
func (l *tlogger) Error(err error, msg string, kvList ...interface{}) {
|
||||
l.print(err, severity.ErrorLog, msg, kvList)
|
||||
}
|
||||
|
||||
func (l *tlogger) print(err error, s severity.Severity, msg string, kvList []interface{}) {
|
||||
// Only create a new buffer if we don't have one cached.
|
||||
b := buffer.GetBuffer()
|
||||
defer buffer.PutBuffer(b)
|
||||
|
||||
// Determine caller.
|
||||
// +1 for this frame, +1 for Info/Error.
|
||||
_, file, line, ok := runtime.Caller(l.callDepth + 2)
|
||||
if !ok {
|
||||
file = "???"
|
||||
line = 1
|
||||
} else {
|
||||
if slash := strings.LastIndex(file, "/"); slash >= 0 {
|
||||
path := file
|
||||
file = path[slash+1:]
|
||||
}
|
||||
}
|
||||
|
||||
// Format header.
|
||||
now := TimeNow()
|
||||
b.FormatHeader(s, file, line, now)
|
||||
|
||||
// Inject WithName names into message.
|
||||
if l.prefix != "" {
|
||||
msg = l.prefix + ": " + msg
|
||||
}
|
||||
|
||||
// The message is always quoted, even if it contains line breaks.
|
||||
// If developers want multi-line output, they should use a small, fixed
|
||||
// message and put the multi-line output into a value.
|
||||
b.WriteString(strconv.Quote(msg))
|
||||
if err != nil {
|
||||
serialize.KVFormat(&b.Buffer, "err", err)
|
||||
}
|
||||
serialize.MergeAndFormatKVs(&b.Buffer, l.values, kvList)
|
||||
if b.Len() == 0 || b.Bytes()[b.Len()-1] != '\n' {
|
||||
b.WriteByte('\n')
|
||||
}
|
||||
l.config.co.output.Write(b.Bytes())
|
||||
}
|
||||
|
||||
func (l *tlogger) WriteKlogBuffer(data []byte) {
|
||||
l.config.co.output.Write(data)
|
||||
}
|
||||
|
||||
// WithName returns a new logr.Logger with the specified name appended. klogr
|
||||
// uses '/' characters to separate name elements. Callers should not pass '/'
|
||||
// in the provided name string, but this library does not actually enforce that.
|
||||
func (l *tlogger) WithName(name string) logr.LogSink {
|
||||
new := *l
|
||||
if len(l.prefix) > 0 {
|
||||
new.prefix = l.prefix + "/"
|
||||
}
|
||||
new.prefix += name
|
||||
return &new
|
||||
}
|
||||
|
||||
func (l *tlogger) WithValues(kvList ...interface{}) logr.LogSink {
|
||||
new := *l
|
||||
new.values = serialize.WithValues(l.values, kvList)
|
||||
return &new
|
||||
}
|
||||
|
||||
// KlogBufferWriter is implemented by the textlogger LogSink.
|
||||
type KlogBufferWriter interface {
|
||||
// WriteKlogBuffer takes a pre-formatted buffer prepared by klog and
|
||||
// writes it unchanged to the output stream. Can be used with
|
||||
// klog.WriteKlogBuffer when setting a logger through
|
||||
// klog.SetLoggerWithOptions.
|
||||
WriteKlogBuffer([]byte)
|
||||
}
|
||||
|
||||
var _ logr.LogSink = &tlogger{}
|
||||
var _ logr.CallDepthLogSink = &tlogger{}
|
||||
var _ KlogBufferWriter = &tlogger{}
|
3
vendor/modules.txt
vendored
3
vendor/modules.txt
vendored
@ -2087,7 +2087,7 @@ k8s.io/gengo/generator
|
||||
k8s.io/gengo/namer
|
||||
k8s.io/gengo/parser
|
||||
k8s.io/gengo/types
|
||||
# k8s.io/klog/v2 v2.80.1
|
||||
# k8s.io/klog/v2 v2.90.1
|
||||
## explicit; go 1.13
|
||||
k8s.io/klog/v2
|
||||
k8s.io/klog/v2/internal/buffer
|
||||
@ -2099,6 +2099,7 @@ k8s.io/klog/v2/internal/verbosity
|
||||
k8s.io/klog/v2/ktesting
|
||||
k8s.io/klog/v2/ktesting/init
|
||||
k8s.io/klog/v2/test
|
||||
k8s.io/klog/v2/textlogger
|
||||
# k8s.io/kms v0.0.0 => ./staging/src/k8s.io/kms
|
||||
## explicit; go 1.19
|
||||
k8s.io/kms/apis/v1beta1
|
||||
|
Loading…
Reference in New Issue
Block a user