Skip to content

Commit 0432efc

Browse files
committed
comment fixes
1 parent 5377761 commit 0432efc

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

shared/aux.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ func SystemCtlCmd(service, action string) (string, error) {
553553
}
554554

555555
// Create a directory if it does not exist.
556-
// Optional: If chmodValue is not empty, Run chmod to change permission of the directory.
556+
// Optional: If chmodValue is not empty, run 'chmod' to change permission of the directory.
557557
func CreateDir(dir, chmodValue, ip string) {
558558
cmdPart1 := fmt.Sprintf("test -d '%s' && echo 'directory exists: %s'", dir, dir)
559559
cmdPart2 := "sudo mkdir -p " + dir
@@ -595,7 +595,8 @@ func WaitForSSHReady(ip string) error {
595595
}
596596
}
597597

598-
// Grep for a particular text/string from a filename and log the same.
598+
// Function to log a 'grep' output.
599+
// Grep for a particular text/string (content) in a file (filename) on a node with 'ip' and log the same.
599600
// Ex: Log content:'denied' calls in filename:'/var/log/audit/audit.log' file.
600601
func LogGrepOutput(filename, content, ip string) {
601602
cmd := fmt.Sprintf("sudo cat %s | grep %s", filename, content)

shared/cluster.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ func ExtractKubeImageVersion() string {
723723
return version
724724
}
725725

726-
// Runs and logs kubectl describe pod command
726+
// Runs 'kubectl describe pod' command and logs output.
727727
func DescribePod(cluster *Cluster, pod *Pod) {
728728
cmd := fmt.Sprintf("%s -n %s", pod.Name, pod.NameSpace)
729729
output, describeErr := KubectlCommand(cluster, "node", "describe", "pod", cmd)
@@ -736,7 +736,7 @@ func DescribePod(cluster *Cluster, pod *Pod) {
736736
}
737737
}
738738

739-
// Runs and logs: kubectl logs command output
739+
// Runs 'kubectl logs' command and logs output.
740740
func PodLogs(cluster *Cluster, pod *Pod) {
741741
if pod.NameSpace == "" || pod.Name == "" {
742742
LogLevel("warn", "Name or Namespace info in pod data is empty. kubectl logs cmd may not work")
@@ -753,8 +753,8 @@ func PodLogs(cluster *Cluster, pod *Pod) {
753753
}
754754

755755
// Given a namespace, this function:
756-
// 1. filters ALL pods in the namespace
757-
// 2. logs both kubectl describe pod and kubectl logs output for each pod in the namespace
756+
// 1. Filters ALL pods in the namespace.
757+
// 2. logs both 'kubectl describe pod' and 'kubectl logs' output for each pod in the namespace.
758758
func LogAllPodsForNamespace(namespace string) {
759759
LogLevel("debug", "logging pod logs and describe pod output for all pods with namespace: %s", namespace)
760760
filters := map[string]string{
@@ -773,9 +773,10 @@ func LogAllPodsForNamespace(namespace string) {
773773
}
774774
}
775775

776-
// Search and log for a particular pod(s) given its unique name substring and namespace. Ex: coredns, kube-system
777-
// 1. Filter based on the name substring, and find the right pod(s)
778-
// 2. For the pods matching the name, logs: kubectl describe pod and kubectl logs output
776+
// Search and log for a particular pod(s) given its unique name substring and namespace. Ex: coredns, kube-system.
777+
// 1. Filter based on the name substring, and find the right pod(s).
778+
// 2. For the pods matching the name, logs: 'kubectl describe pod' and 'kubectl logs' output.
779+
// In the given example, it will filter all 'coredns' named pods in 'kube-system' namespace and log their outputs.
779780
func FindPodAndLog(name, namespace string) {
780781
LogLevel("debug",
781782
"find and log(pod logs and describe pod) for pod starting with %s for namespace %s", name, namespace)

0 commit comments

Comments
 (0)