Skip to content

Commit 43ea648

Browse files
authored
Merge pull request #1692 from k8s-infra-cherrypick-robot/cherry-pick-1687-to-release-0.10
✨ Improve startup logs
2 parents 307b8e1 + 88a57ab commit 43ea648

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

pkg/builder/webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ func (blder *WebhookBuilder) getValidatingWebhook() *admission.Webhook {
167167
func (blder *WebhookBuilder) registerConversionWebhook() error {
168168
ok, err := conversion.IsConvertible(blder.mgr.GetScheme(), blder.apiType)
169169
if err != nil {
170-
log.Error(err, "conversion check failed", "object", blder.apiType)
170+
log.Error(err, "conversion check failed", "GVK", blder.gvk)
171171
return err
172172
}
173173
if ok {
174174
if !blder.isAlreadyHandled("/convert") {
175175
blder.mgr.GetWebhookServer().Register("/convert", &conversion.Webhook{})
176176
}
177-
log.Info("conversion webhook enabled", "object", blder.apiType)
177+
log.Info("Conversion webhook enabled", "GVK", blder.gvk)
178178
}
179179

180180
return nil

pkg/internal/controller/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (c *Controller) Start(ctx context.Context) error {
175175
// caches to sync so that they have a chance to register their intendeded
176176
// caches.
177177
for _, watch := range c.startWatches {
178-
c.Log.Info("Starting EventSource", "source", watch.src)
178+
c.Log.Info("Starting EventSource", "source", fmt.Sprintf("%s", watch.src))
179179

180180
if err := watch.src.Start(ctx, watch.handler, c.Queue, watch.predicates...); err != nil {
181181
return err

pkg/manager/internal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ func (cm *controllerManager) serveMetrics() {
380380
}
381381
// Run the server
382382
cm.startRunnable(RunnableFunc(func(_ context.Context) error {
383-
cm.logger.Info("starting metrics server", "path", defaultMetricsEndpoint)
383+
cm.logger.Info("Starting metrics server", "path", defaultMetricsEndpoint)
384384
if err := server.Serve(cm.metricsListener); err != nil && err != http.ErrServerClosed {
385385
return err
386386
}

pkg/metrics/listener.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func NewListener(addr string) (net.Listener, error) {
4141
return nil, nil
4242
}
4343

44-
log.Info("metrics server is starting to listen", "addr", addr)
44+
log.Info("Metrics server is starting to listen", "addr", addr)
4545
ln, err := net.Listen("tcp", addr)
4646
if err != nil {
4747
er := fmt.Errorf("error listening on %s: %w", addr, err)

pkg/source/source.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ func (ks *Kind) Start(ctx context.Context, handler handler.EventHandler, queue w
161161
}
162162

163163
func (ks *Kind) String() string {
164-
if ks.Type != nil && ks.Type.GetObjectKind() != nil {
165-
return fmt.Sprintf("kind source: %v", ks.Type.GetObjectKind().GroupVersionKind().String())
164+
if ks.Type != nil {
165+
return fmt.Sprintf("kind source: %T", ks.Type)
166166
}
167-
return "kind source: unknown GVK"
167+
return "kind source: unknown type"
168168
}
169169

170170
// WaitForSync implements SyncingSource to allow controllers to wait with starting

pkg/webhook/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (s *Server) Register(path string, hook http.Handler) {
142142
s.WebhookMux.Handle(path, metrics.InstrumentedHook(path, hook))
143143

144144
regLog := log.WithValues("path", path)
145-
regLog.Info("registering webhook")
145+
regLog.Info("Registering webhook")
146146

147147
// we've already been "started", inject dependencies here.
148148
// Otherwise, InjectFunc will do this for us later.
@@ -210,7 +210,7 @@ func (s *Server) Start(ctx context.Context) error {
210210
s.defaultingOnce.Do(s.setDefaults)
211211

212212
baseHookLog := log.WithName("webhooks")
213-
baseHookLog.Info("starting webhook server")
213+
baseHookLog.Info("Starting webhook server")
214214

215215
certPath := filepath.Join(s.CertDir, s.CertName)
216216
keyPath := filepath.Join(s.CertDir, s.KeyName)
@@ -259,7 +259,7 @@ func (s *Server) Start(ctx context.Context) error {
259259
return err
260260
}
261261

262-
log.Info("serving webhook server", "host", s.Host, "port", s.Port)
262+
log.Info("Serving webhook server", "host", s.Host, "port", s.Port)
263263

264264
srv := &http.Server{
265265
Handler: s.WebhookMux,

0 commit comments

Comments
 (0)