Merge pull request #101865 from sanwishe/structuredLogdynamiccertificates

Structured Logging migration: for package staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates

Kubernetes-commit: f594c25c70bab163edba38bbf17faf7176577a6c
This commit is contained in:
Kubernetes Publisher 2021-05-13 08:14:26 -07:00
commit 7efdd584a1
8 changed files with 28 additions and 28 deletions

6
Godeps/Godeps.json generated
View File

@ -920,11 +920,11 @@
},
{
"ImportPath": "k8s.io/api",
"Rev": "020341df4dc8"
"Rev": "98c0df6d5181"
},
{
"ImportPath": "k8s.io/apimachinery",
"Rev": "96c076bf1d97"
"Rev": "4c2cee4b928c"
},
{
"ImportPath": "k8s.io/client-go",
@ -932,7 +932,7 @@
},
{
"ImportPath": "k8s.io/component-base",
"Rev": "44faecbf614e"
"Rev": "18af7a2c44df"
},
{
"ImportPath": "k8s.io/gengo",

12
go.mod
View File

@ -38,10 +38,10 @@ require (
google.golang.org/grpc v1.27.1
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/square/go-jose.v2 v2.2.2
k8s.io/api v0.0.0-20210518101613-020341df4dc8
k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97
k8s.io/api v0.0.0-20210518101622-98c0df6d5181
k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c
k8s.io/client-go v0.0.0-20210518102931-3cca9d72c140
k8s.io/component-base v0.0.0-20210518111232-44faecbf614e
k8s.io/component-base v0.0.0-20210518111236-18af7a2c44df
k8s.io/klog/v2 v2.8.0
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
@ -51,8 +51,8 @@ require (
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20210518101613-020341df4dc8
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97
k8s.io/api => k8s.io/api v0.0.0-20210518101622-98c0df6d5181
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c
k8s.io/client-go => k8s.io/client-go v0.0.0-20210518102931-3cca9d72c140
k8s.io/component-base => k8s.io/component-base v0.0.0-20210518111232-44faecbf614e
k8s.io/component-base => k8s.io/component-base v0.0.0-20210518111236-18af7a2c44df
)

12
go.sum
View File

@ -674,14 +674,14 @@ 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 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20210518101613-020341df4dc8 h1:ZRnEhwbQkikrh5x6TweXojo/X728NYotNn0j+tvQMfM=
k8s.io/api v0.0.0-20210518101613-020341df4dc8/go.mod h1:mfjSaVjQka7B+LlvX2q/KG3mXhs8HgdQT3ipatqYfU0=
k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97 h1:hKyy5Pr8MoGjcqM5AYHQjpizciRmC8dz4N3XG4LZwuQ=
k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs=
k8s.io/api v0.0.0-20210518101622-98c0df6d5181 h1:S8KR0gk7hAxCnvp+Z9jvGl4MMaSTxNLwLaHCVzJbsw0=
k8s.io/api v0.0.0-20210518101622-98c0df6d5181/go.mod h1:y+gvByfVKNWO6mErcyYTqghJvmW73GJQPxjlYKfOuio=
k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c h1:4cylLlCjbU4MC+jV8O68gmICP2kk8agE4tceRMAljVs=
k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs=
k8s.io/client-go v0.0.0-20210518102931-3cca9d72c140 h1:GY3mSlGtHMBhojVkVlvYMRGBFJPznw4duMxd8fMQvvg=
k8s.io/client-go v0.0.0-20210518102931-3cca9d72c140/go.mod h1:sGoh5eJ2yx5LuKX3C3Wj5zkHlcfHoueMPwbNP2qyRD8=
k8s.io/component-base v0.0.0-20210518111232-44faecbf614e h1:+LvsEqL+o2/s3SNrTdZm22miglZOm3TPof8oO5pa2F8=
k8s.io/component-base v0.0.0-20210518111232-44faecbf614e/go.mod h1:VYU6k+gXEg7lXm+XCubCKvSlHHI9l+JHRJ0Hw4nrjug=
k8s.io/component-base v0.0.0-20210518111236-18af7a2c44df h1:Qz7sUwbLJpc/VUuBtxZb3seTfKV1hDTx1yAVPI7jnJI=
k8s.io/component-base v0.0.0-20210518111236-18af7a2c44df/go.mod h1:hPm8b9lzwMCIUcu2WyNo0MxrfZcmt+tMkH0FuhUs1Zo=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts=

View File

@ -198,8 +198,8 @@ func (c *ConfigMapCAController) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer c.queue.ShutDown()
klog.Infof("Starting %s", c.name)
defer klog.Infof("Shutting down %s", c.name)
klog.InfoS("Starting controller", "name", c.name)
defer klog.InfoS("Shutting down controller", "name", c.name)
// we have a personal informer that is narrowly scoped, start it.
go c.configMapInformer.Run(stopCh)

View File

@ -114,7 +114,7 @@ func (c *DynamicFileCAContent) loadCABundle() error {
return err
}
c.caBundle.Store(caBundleAndVerifier)
klog.V(2).Infof("Loaded a new CA Bundle and Verifier for %q", c.Name())
klog.V(2).InfoS("Loaded a new CA Bundle and Verifier", "name", c.Name())
for _, listener := range c.listeners {
listener.Enqueue()
@ -152,8 +152,8 @@ func (c *DynamicFileCAContent) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer c.queue.ShutDown()
klog.Infof("Starting %s", c.name)
defer klog.Infof("Shutting down %s", c.name)
klog.InfoS("Starting controller", "name", c.name)
defer klog.InfoS("Shutting down controller", "name", c.name)
// doesn't matter what workers say, only start one.
go wait.Until(c.runWorker, time.Second, stopCh)

View File

@ -107,7 +107,7 @@ func (c *DynamicCertKeyPairContent) loadCertKeyPair() error {
}
c.certKeyPair.Store(newCertKey)
klog.V(2).Infof("Loaded a new cert/key pair for %q", c.Name())
klog.V(2).InfoS("Loaded a new cert/key pair", "name", c.Name())
for _, listener := range c.listeners {
listener.Enqueue()
@ -126,8 +126,8 @@ func (c *DynamicCertKeyPairContent) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer c.queue.ShutDown()
klog.Infof("Starting %s", c.name)
defer klog.Infof("Shutting down %s", c.name)
klog.InfoS("Starting controller", "name", c.name)
defer klog.InfoS("Shutting down controller", "name", c.name)
// doesn't matter what workers say, only start one.
go wait.Until(c.runWorker, time.Second, stopCh)

View File

@ -50,7 +50,7 @@ func (c *DynamicServingCertificateController) BuildNamedCertificates(sniCerts []
byNameExplicit[name] = &cert
}
klog.V(2).Infof("loaded SNI cert [%d/%q]: %s", i, c.sniCerts[i].Name(), GetHumanCertDetail(x509Cert))
klog.V(2).InfoS("Loaded SNI cert", "index", i, "certName", c.sniCerts[i].Name(), "certDetail", GetHumanCertDetail(x509Cert))
if c.eventRecorder != nil {
c.eventRecorder.Eventf(&corev1.ObjectReference{Name: c.sniCerts[i].Name()}, nil, corev1.EventTypeWarning, "TLSConfigChanged", "SNICertificateReload", "loaded SNI cert [%d/%q]: %s with explicit names %v", i, c.sniCerts[i].Name(), GetHumanCertDetail(x509Cert), names)
}

View File

@ -175,7 +175,7 @@ func (c *DynamicServingCertificateController) syncCerts() error {
return fmt.Errorf("unable to load client CA file %q: %v", string(newContent.clientCA.caBundle), err)
}
for i, cert := range newClientCAs {
klog.V(2).Infof("loaded client CA [%d/%q]: %s", i, c.clientCA.Name(), GetHumanCertDetail(cert))
klog.V(2).InfoS("Loaded client CA", "index", i, "certName", c.clientCA.Name(), "certDetail", GetHumanCertDetail(cert))
if c.eventRecorder != nil {
c.eventRecorder.Eventf(&corev1.ObjectReference{Name: c.clientCA.Name()}, nil, corev1.EventTypeWarning, "TLSConfigChanged", "CACertificateReload", "loaded client CA [%d/%q]: %s", i, c.clientCA.Name(), GetHumanCertDetail(cert))
}
@ -197,7 +197,7 @@ func (c *DynamicServingCertificateController) syncCerts() error {
return fmt.Errorf("invalid serving cert: %v", err)
}
klog.V(2).Infof("loaded serving cert [%q]: %s", c.servingCert.Name(), GetHumanCertDetail(x509Cert))
klog.V(2).InfoS("Loaded serving cert", "certName", c.servingCert.Name(), "certDetail", GetHumanCertDetail(x509Cert))
if c.eventRecorder != nil {
c.eventRecorder.Eventf(&corev1.ObjectReference{Name: c.servingCert.Name()}, nil, corev1.EventTypeWarning, "TLSConfigChanged", "ServingCertificateReload", "loaded serving cert [%q]: %s", c.servingCert.Name(), GetHumanCertDetail(x509Cert))
}
@ -237,8 +237,8 @@ func (c *DynamicServingCertificateController) Run(workers int, stopCh <-chan str
defer utilruntime.HandleCrash()
defer c.queue.ShutDown()
klog.Infof("Starting DynamicServingCertificateController")
defer klog.Infof("Shutting down DynamicServingCertificateController")
klog.InfoS("Starting DynamicServingCertificateController")
defer klog.InfoS("Shutting down DynamicServingCertificateController")
// synchronously load once. We will trigger again, so ignoring any error is fine
_ = c.RunOnce()