Skip to content

Commit

Permalink
style: capitalize first word in log messages
Browse files Browse the repository at this point in the history
Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and David Ko committed Apr 14, 2023
1 parent eb3b13d commit ef90a2c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
24 changes: 12 additions & 12 deletions cmd/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ support bundle contents using native k8s tooling like kubectl`,
if resetHome {
err = os.RemoveAll(simHome)
if err != nil {
logrus.Fatalf("error during reset of sim-home: %v", err)
logrus.Fatalf("Error during reset of sim-home: %v", err)
}
}

Expand All @@ -54,26 +54,26 @@ support bundle contents using native k8s tooling like kubectl`,

generatedCerts, err := certs.GenerateCerts([]string{"localhost"}, simHome)
if err != nil {
logrus.Fatalf("error generating certificates %v", err)
logrus.Fatalf("Error generating certificates %v", err)
}
a.Certs = generatedCerts

etcdConfig, err := etcd.RunEmbeddedEtcd(ctx, filepath.Join(simHome), generatedCerts)
if err != nil {
logrus.Fatalf("error setting up embedded etcdserver %v", err)
logrus.Fatalf("Error setting up embedded etcdserver %v", err)
}
a.Etcd = etcdConfig

err = a.GenerateKubeConfig(filepath.Join(simHome, "admin.kubeconfig"))
if err != nil {
logrus.Fatalf("error generating kubeconfig %v", err)
logrus.Fatalf("Error generating kubeconfig %v", err)
}

eg, egctx := errgroup.WithContext(ctx)

k, err := kubelet.NewKubeletSimulator(egctx, generatedCerts, bundlePath)
if err != nil {
logrus.Fatalf("error initialisting kubelet simulator: %v", err)
logrus.Fatalf("Error initialisting kubelet simulator: %v", err)
}

serviceClusterIP, err := GetServiceClusterIP(bundlePath)
Expand All @@ -96,7 +96,7 @@ support bundle contents using native k8s tooling like kubectl`,

o, err := objects.NewObjectManager(ctx, a.Config, bundlePath)
if err != nil {
logrus.Fatalf("error creating object manager %v", err)
logrus.Fatalf("Error creating object manager %v", err)
}

err = o.WaitForNamespaces(30 * time.Second)
Expand All @@ -108,35 +108,35 @@ support bundle contents using native k8s tooling like kubectl`,
err = o.CreateUnstructuredClusterObjects()

if err != nil {
logrus.Fatalf("error loading cluster scoped objects %v", err)
logrus.Fatalf("Error loading cluster scoped objects %v", err)
}

err = o.CreateUnstructuredObjects()
if err != nil {
logrus.Fatalf("error loading namespacedobjects %v", err)
logrus.Fatalf("Error loading namespacedobjects %v", err)
}

err = o.CreateNodeZipObjects()
if err != nil {
logrus.Fatalf("error loading node zip objects %v", err)
logrus.Fatalf("Error loading node zip objects %v", err)
}

// ignore the error creation
_ = o.CreatedFailedObjectsList()
logrus.Info("all resources loaded successfully")
logrus.Info("All resources loaded successfully")
}

err = eg.Wait()
if err != nil {
logrus.Fatalf("error from apiserver or kublet subroutine: %v", err)
logrus.Fatalf("Error from apiserver or kublet subroutine: %v", err)
}
},
}

func init() {
home, err := homedir.Dir()
if err != nil {
logrus.Fatalf("error querying home directory %v", err)
logrus.Fatalf("Error querying home directory %v", err)
}

dir := filepath.Join(home, ".sim")
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (a *AgentDaemonSet) getDaemonSetName() string {

func (a *AgentDaemonSet) Create(image string, managerURL string) (*appsv1.DaemonSet, error) {
dsName := a.getDaemonSetName()
logrus.Debugf("creating daemonset %s with image %s", dsName, image)
logrus.Debugf("Creating daemonset %s with image %s", dsName, image)

// get manager pod for owner reference
labels := fmt.Sprintf("app=%s,%s=%s", types.SupportBundleManager, types.SupportBundleLabelKey, a.sbm.BundleName)
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewCluster(ctx context.Context, sbm *SupportBundleManager) *Cluster {
}

func (c *Cluster) GenerateClusterBundle(bundleDir string) (string, error) {
logrus.Debug("generating cluster bundle...")
logrus.Debug("Generating cluster bundle...")
namespace, err := c.sbm.k8s.GetNamespace(c.sbm.PodNamespace)
if err != nil {
return "", errors.Wrap(err, "cannot get deployed namespace")
Expand Down
4 changes: 2 additions & 2 deletions pkg/manager/collectors/harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ func (module harvesterModule) toObj(b []byte, groupVersion, kind string, resourc
switch resource {
case "secrets":
currentItems, _ := jsonParsed.S("items").Data().([]interface{})
logrus.Debugf("whole items: %v", currentItems)
logrus.Debugf("Whole items: %v", currentItems)
var newItems []interface{}
for _, item := range currentItems {
gItem := gabs.Wrap(item)
if find := gItem.S("type").Data().(string) == "rke.cattle.io/machine-plan"; find {
logrus.Debugf("prepare to append item: %v", gItem.Data().(map[string]interface{}))
logrus.Debugf("Prepare to append item: %v", gItem.Data().(map[string]interface{}))
newItems = append(newItems, item)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/httpserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (s *HttpServer) createNodeBundle(w http.ResponseWriter, req *http.Request)
return
}

logrus.Debugf("handle create node bundle for %s", node)
logrus.Debugf("Handle create node bundle for %s", node)
nodesDir := filepath.Join(s.manager.getWorkingDir(), "nodes")
err := os.MkdirAll(nodesDir, os.FileMode(0775))
if err != nil {
Expand Down
18 changes: 9 additions & 9 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ func (m *SupportBundleManager) Run() error {
}

for i, phase := range phases {
logrus.Infof("running phase %s", phase.Name)
logrus.Infof("Running phase %s", phase.Name)
m.status.SetPhase(phase.Name)
if err := phase.Run(); err != nil {
m.status.SetError(err.Error())
logrus.Errorf("failed to run phase %s: %s", phase.Name, err.Error())
logrus.Errorf("Failed to run phase %s: %s", phase.Name, err.Error())
break
}

progress := 100 * (i + 1) / len(phases)
m.status.SetProgress(progress)
logrus.Infof("succeed to run phase %s. Progress (%d).", phase.Name, progress)
logrus.Infof("Succeed to run phase %s. Progress (%d).", phase.Name, progress)
}

<-m.context.Done()
Expand Down Expand Up @@ -212,7 +212,7 @@ func (m *SupportBundleManager) phaseCollectNodeBundles() error {
if err != nil {
// Ignore error here, since in some failure cases we might not receive all node bundles.
// A support bundle with partital data is also useful.
logrus.Error(err)
logrus.WithError(err).Error("Failed to collect node bundles")
}
return nil
}
Expand All @@ -222,7 +222,7 @@ func (m *SupportBundleManager) phasePackaging() error {
}

func (m *SupportBundleManager) phaseDone() error {
logrus.Infof("support bundle %s ready to download", m.getBundlefile())
logrus.Infof("Support bundle %s ready to download", m.getBundlefile())
return nil
}

Expand Down Expand Up @@ -272,7 +272,7 @@ func (m *SupportBundleManager) collectNodeBundles() error {
}

<-m.ch
logrus.Info("all node bundles are received.")
logrus.Info("All node bundles are received.")

// Clean up when everything is fine. If something went wrong, keep ds for debugging.
// The ds will be garbage-collected when manager pod is gone.
Expand All @@ -297,15 +297,15 @@ func (m *SupportBundleManager) completeNode(node string) {

_, ok := m.expectedNodes[node]
if ok {
logrus.Debugf("complete node %s", node)
logrus.Debugf("Complete node %s", node)
delete(m.expectedNodes, node)
} else {
logrus.Warnf("complete an unknown node %s", node)
logrus.Warnf("Complete an unknown node %s", node)
}

if len(m.expectedNodes) == 0 {
if !m.done {
logrus.Debugf("all nodes are completed.")
logrus.Debugf("All nodes are completed")
m.ch <- struct{}{}
m.done = true
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/simulator/objects/process_node_zips.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func walkZipFiles(zipFile string) (*v1.Pod, *bundlekit.NodeConfig, error) {
}
nConfig.Spec = nodeConfigSpec
if len(containers) == 0 {
logrus.Warnf("no pod being created for node %s as zip file has no log files associated with this node", filepath.Base(nodeName[0]))
logrus.Warnf("No pod being created for node %s as zip file has no log files associated with this node", filepath.Base(nodeName[0]))
return nil, nConfig, nil
}
pod.Spec.Containers = containers
Expand Down

0 comments on commit ef90a2c

Please sign in to comment.