Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion providers/kubeconfig/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"sync"

Expand Down Expand Up @@ -201,7 +202,7 @@ func (p *Provider) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result
// Extract and validate kubeconfig data
kubeconfigData, ok := secret.Data[p.opts.KubeconfigSecretKey]
if !ok || len(kubeconfigData) == 0 {
log.Info("Secret does not contain kubeconfig data, skipping", "key", p.opts.KubeconfigSecretKey)
log.Error(errors.New("secret does not contain kubeconfig data, skipping"), "key", p.opts.KubeconfigSecretKey)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, just one nit, our log lines usually start with uppercase, e.g.:

Suggested change
log.Error(errors.New("secret does not contain kubeconfig data, skipping"), "key", p.opts.KubeconfigSecretKey)
log.Error(errors.New("Secret does not contain kubeconfig data, skipping"), "key", p.opts.KubeconfigSecretKey)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or wait, now that I think about it, how does this log line look exactly? I guess log.Error might be wrapping it differently?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Looking closer, I think the correct way to do this is to provide the capitalized message in as the second arg and leave the first arg nil. I've added to the description what the log line now looks like.

return ctrl.Result{}, nil
}

Expand Down