Skip to content

Commit

Permalink
fix: change log level to info (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 authored Oct 18, 2024
1 parent 4b38e17 commit 0bbe45a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions csr/csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,15 @@ func WatchCastAINodeCSRs(ctx context.Context, log logrus.FieldLogger, client kub

defer w.Stop()

log.Debug("watching for new node csr")
log.Info("watching for new node csr")

for {
select {
case <-ctx.Done():
return
case event, ok := <-w.ResultChan():
if !ok {
log.Debug("watcher closed")
log.Info("watcher closed")
go WatchCastAINodeCSRs(ctx, log, client, c) // start over in case of any error
return
}
Expand All @@ -323,7 +323,7 @@ func WatchCastAINodeCSRs(ctx context.Context, log logrus.FieldLogger, client kub
log.WithFields(logrus.Fields{
"csr": name,
"node_name": csrResult.RequestingUser,
}).Debugf("skipping csr not from kubelet-bootstrap: %v", csrResult.RequestingUser)
}).Infof("skipping csr not from kubelet-bootstrap: %v", csrResult.RequestingUser)
continue
}

Expand All @@ -332,7 +332,7 @@ func WatchCastAINodeCSRs(ctx context.Context, log logrus.FieldLogger, client kub
log.WithFields(logrus.Fields{
"csr": name,
"node_name": cn,
}).Debugf("skipping csr unable to get common name: %v", err)
}).Infof("skipping csr unable to get common name: %v", err)
continue
}
if csrResult.Approved() {
Expand All @@ -343,7 +343,7 @@ func WatchCastAINodeCSRs(ctx context.Context, log logrus.FieldLogger, client kub
log.WithFields(logrus.Fields{
"csr": name,
"node_name": cn,
}).Debug("skipping csr not CAST AI node")
}).Infof("skipping csr not CAST AI node")
continue
}
csrResult.Name = cn
Expand Down
6 changes: 3 additions & 3 deletions csr/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ func (h *ApprovalManager) handle(ctx context.Context, log logrus.FieldLogger, ce
}
log = log.WithField("csr_name", cert.Name)
// Since this new csr may be denied we need to delete it.
log.Debug("deleting old csr")
log.Info("deleting old csr")
if err := cert.DeleteCertificate(ctx, h.clientset); err != nil {
if !apierrors.IsNotFound(err) {
return fmt.Errorf("deleting csr: %w", err)
}
}

// Create a new CSR with the same request data as the original one.
log.Debug("requesting new csr")
log.Info("requesting new csr")
newCert, err := cert.NewCSR(ctx, h.clientset)
if err != nil {
return fmt.Errorf("requesting new csr: %w", err)
}

// Approve new csr.
log.Debug("approving new csr")
log.Info("approving new csr")
resp, err := newCert.ApproveCertificate(ctx, h.clientset)
if err != nil {
return fmt.Errorf("approving csr: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func run(
log.Fatalf("failed to determine if running on GKE: %v", err)
}

log.Debugf("auto approve csr: %v, running on GKE: %v", cfg.AutoApproveCSR, isGKE)
log.Infof("auto approve csr: %v, running on GKE: %v", cfg.AutoApproveCSR, isGKE)
if cfg.AutoApproveCSR && isGKE {
csrMgr := csr.NewApprovalManager(log, clientset)
csrMgr.Start(ctx)
Expand Down

0 comments on commit 0bbe45a

Please sign in to comment.