Skip to content

Commit

Permalink
Improve operator logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyd1988 committed Dec 5, 2023
1 parent ba73e8c commit 7f1af63
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion api/v1/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ func (p *SriovNetworkNodePolicy) Selected(node *corev1.Node) bool {
}
return false
}
log.Info("Selected():", "node", node.Name)
return true
}

Expand Down
4 changes: 2 additions & 2 deletions controllers/sriovnetworknodepolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func renderDsForCR(path string, data *render.RenderData) ([]*uns.Unstructured, e

func (r *SriovNetworkNodePolicyReconciler) renderDevicePluginConfigData(pl *sriovnetworkv1.SriovNetworkNodePolicyList, node *corev1.Node) (dptypes.ResourceConfList, error) {
logger := log.Log.WithName("renderDevicePluginConfigData")
logger.Info("Start to render device plugin config data")
logger.Info("Start to render device plugin config data", "node", node.Name)
rcl := dptypes.ResourceConfList{}
for _, p := range pl.Items {
if p.Name == constants.DefaultPolicyName {
Expand Down Expand Up @@ -720,7 +720,7 @@ func (r *SriovNetworkNodePolicyReconciler) renderDevicePluginConfigData(pl *srio
rawNetDeviceSelectors := json.RawMessage(netDeviceSelectorsMarshal)
rc.Selectors = &rawNetDeviceSelectors
rcl.ResourceList = append(rcl.ResourceList, *rc)
logger.Info("Add resource", "Resource", *rc, "Resource list", rcl.ResourceList)
logger.Info("Add resource", "Resource", *rc)
}
}
return rcl, nil
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"flag"
"fmt"
"go.uber.org/zap/zapcore"
"os"

netattdefv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
Expand Down Expand Up @@ -76,6 +77,7 @@ func main() {
"Enabling this will ensure there is only one active controller manager.")
opts := zap.Options{
Development: true,
TimeEncoder: zapcore.RFC3339NanoTimeEncoder,
}
opts.BindFlags(flag.CommandLine)
flag.Parse()
Expand Down

0 comments on commit 7f1af63

Please sign in to comment.