From bebca30309c0bed34e412cf5c57a290adfaaa74f Mon Sep 17 00:00:00 2001 From: yuzhiquan Date: Mon, 26 Apr 2021 18:08:49 +0800 Subject: [PATCH] comment should have function name as prefix --- pkg/kubelet/container/runtime.go | 10 +++++----- pkg/kubelet/kubelet_pods.go | 4 ++-- pkg/kubelet/kuberuntime/kuberuntime_container.go | 2 +- pkg/kubelet/kuberuntime/kuberuntime_manager.go | 2 +- pkg/kubelet/pod_workers.go | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/kubelet/container/runtime.go b/pkg/kubelet/container/runtime.go index 52180087a15..b0baa29e4a2 100644 --- a/pkg/kubelet/container/runtime.go +++ b/pkg/kubelet/container/runtime.go @@ -95,7 +95,7 @@ type Runtime interface { // that are terminated, but not deleted will be evicted. Otherwise, only deleted pods will be GC'd. // TODO: Revisit this method and make it cleaner. GarbageCollect(gcPolicy GCPolicy, allSourcesReady bool, evictNonDeletedPods bool) error - // Syncs the running pod into the desired pod. + // SyncPod syncs the running pod into the desired pod. SyncPod(pod *v1.Pod, podStatus *PodStatus, pullSecrets []v1.Secret, backOff *flowcontrol.Backoff) PodSyncResult // KillPod kills all the containers of a pod. Pod may be nil, running pod must not be. // TODO(random-liu): Return PodSyncResult in KillPod. @@ -112,7 +112,7 @@ type Runtime interface { // stream the log. Set 'follow' to false and specify the number of lines (e.g. // "100" or "all") to tail the log. GetContainerLogs(ctx context.Context, pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) (err error) - // Delete a container. If the container is still running, an error is returned. + // DeleteContainer deletes a container. If the container is still running, an error is returned. DeleteContainer(containerID ContainerID) error // ImageService provides methods to image-related methods. ImageService @@ -139,11 +139,11 @@ type ImageService interface { // GetImageRef gets the reference (digest or ID) of the image which has already been in // the local storage. It returns ("", nil) if the image isn't in the local storage. GetImageRef(image ImageSpec) (string, error) - // Gets all images currently on the machine. + // ListImages gets all images currently on the machine. ListImages() ([]Image, error) - // Removes the specified image. + // RemoveImage removes the specified image. RemoveImage(image ImageSpec) error - // Returns Image statistics. + // ImageStats returns Image statistics. ImageStats() (*ImageStats, error) } diff --git a/pkg/kubelet/kubelet_pods.go b/pkg/kubelet/kubelet_pods.go index b610b47ff7f..e4127f861fc 100644 --- a/pkg/kubelet/kubelet_pods.go +++ b/pkg/kubelet/kubelet_pods.go @@ -1156,7 +1156,7 @@ type PodKiller interface { // PerformPodKillingWork performs the actual pod killing work via calling CRI // It returns after its Close() func is called and all outstanding pod killing requests are served PerformPodKillingWork() - // After Close() is called, this pod killer wouldn't accept any more pod killing requests + // Close ensures that after it's called, then this pod killer wouldn't accept any more pod killing requests Close() // IsPodPendingTerminationByPodName checks whether any pod for the given full pod name is pending termination (thread safe) IsPodPendingTerminationByPodName(podFullname string) bool @@ -1205,7 +1205,7 @@ func (pk *podKillerWithChannel) IsPodPendingTerminationByUID(uid types.UID) bool return false } -// IsMirrorPodPendingTerminationByPodName checks whether the given pod is in grace period of termination +// IsPodPendingTerminationByPodName checks whether the given pod is in grace period of termination func (pk *podKillerWithChannel) IsPodPendingTerminationByPodName(podFullname string) bool { pk.podKillingLock.RLock() defer pk.podKillingLock.RUnlock() diff --git a/pkg/kubelet/kuberuntime/kuberuntime_container.go b/pkg/kubelet/kuberuntime/kuberuntime_container.go index 3804e9b04a5..392eb4504bf 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_container.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_container.go @@ -658,7 +658,7 @@ func (m *kubeGenericRuntimeManager) killContainer(pod *v1.Pod, containerID kubec "containerName", containerName, "containerID", containerID.String(), "gracePeriod", gracePeriod) } - klog.V(2).InfoS("Killing container with a grace period override", "pod", klog.KObj(pod), "podUID", pod.UID, + klog.V(2).InfoS("Killing container with a grace period", "pod", klog.KObj(pod), "podUID", pod.UID, "containerName", containerName, "containerID", containerID.String(), "gracePeriod", gracePeriod) err := m.runtimeService.StopContainer(containerID.ID, gracePeriod) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager.go b/pkg/kubelet/kuberuntime/kuberuntime_manager.go index d83e75e300a..ad543e48532 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager.go @@ -152,7 +152,7 @@ type KubeGenericRuntime interface { // LegacyLogProvider gives the ability to use unsupported docker log drivers (e.g. journald) type LegacyLogProvider interface { - // Get the last few lines of the logs for a specific container. + // GetContainerLogTail gets the last few lines of the logs for a specific container. GetContainerLogTail(uid kubetypes.UID, name, namespace string, containerID kubecontainer.ContainerID) (string, error) } diff --git a/pkg/kubelet/pod_workers.go b/pkg/kubelet/pod_workers.go index fcf059f56e3..5072cf18411 100644 --- a/pkg/kubelet/pod_workers.go +++ b/pkg/kubelet/pod_workers.go @@ -193,7 +193,7 @@ func (p *podWorkers) managePodLoop(podUpdates <-chan UpdatePodOptions) { } } -// Apply the new setting to the specified pod. +// UpdatePod apply the new setting to the specified pod. // If the options provide an OnCompleteFunc, the function is invoked if the update is accepted. // Update requests are ignored if a kill pod request is pending. func (p *podWorkers) UpdatePod(options *UpdatePodOptions) {