mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Change my TODO to be the same with others
This commit is contained in:
parent
adb0da005e
commit
b2a72ca384
@ -71,7 +71,7 @@ func ShouldContainerBeRestarted(container *api.Container, pod *api.Pod, podStatu
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO (random-liu) This should be removed soon after rkt implements GetPodStatus.
|
// TODO(random-liu): This should be removed soon after rkt implements GetPodStatus.
|
||||||
func ShouldContainerBeRestartedOldVersion(container *api.Container, pod *api.Pod, podStatus *api.PodStatus) bool {
|
func ShouldContainerBeRestartedOldVersion(container *api.Container, pod *api.Pod, podStatus *api.PodStatus) bool {
|
||||||
// Get all dead container status.
|
// Get all dead container status.
|
||||||
var resultStatus []*api.ContainerStatus
|
var resultStatus []*api.ContainerStatus
|
||||||
@ -99,7 +99,7 @@ func ShouldContainerBeRestartedOldVersion(container *api.Container, pod *api.Pod
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO (random-liu) Convert PodStatus to running Pod, should be deprecated soon
|
// TODO(random-liu): Convert PodStatus to running Pod, should be deprecated soon
|
||||||
func ConvertPodStatusToRunningPod(podStatus *PodStatus) Pod {
|
func ConvertPodStatusToRunningPod(podStatus *PodStatus) Pod {
|
||||||
runningPod := Pod{
|
runningPod := Pod{
|
||||||
ID: podStatus.ID,
|
ID: podStatus.ID,
|
||||||
|
@ -89,7 +89,7 @@ type Runtime interface {
|
|||||||
// GarbageCollect removes dead containers using the specified container gc policy
|
// GarbageCollect removes dead containers using the specified container gc policy
|
||||||
GarbageCollect(gcPolicy ContainerGCPolicy) error
|
GarbageCollect(gcPolicy ContainerGCPolicy) error
|
||||||
// Syncs the running pod into the desired pod.
|
// Syncs the running pod into the desired pod.
|
||||||
// TODO (random-liu) The runningPod will be removed after #17420 is done.
|
// TODO(random-liu): The runningPod will be removed after #17420 is done.
|
||||||
SyncPod(pod *api.Pod, runningPod Pod, apiPodStatus api.PodStatus, podStatus *PodStatus, pullSecrets []api.Secret, backOff *util.Backoff) error
|
SyncPod(pod *api.Pod, runningPod Pod, apiPodStatus api.PodStatus, podStatus *PodStatus, pullSecrets []api.Secret, backOff *util.Backoff) error
|
||||||
// KillPod kills all the containers of a pod. Pod may be nil, running pod must not be.
|
// KillPod kills all the containers of a pod. Pod may be nil, running pod must not be.
|
||||||
KillPod(pod *api.Pod, runningPod Pod) error
|
KillPod(pod *api.Pod, runningPod Pod) error
|
||||||
@ -108,7 +108,7 @@ type Runtime interface {
|
|||||||
// for all container runtimes in kubelet and remove this funciton.
|
// for all container runtimes in kubelet and remove this funciton.
|
||||||
ConvertPodStatusToAPIPodStatus(*api.Pod, *PodStatus) (*api.PodStatus, error)
|
ConvertPodStatusToAPIPodStatus(*api.Pod, *PodStatus) (*api.PodStatus, error)
|
||||||
// Return both PodStatus and api.PodStatus, this is just a temporary function.
|
// Return both PodStatus and api.PodStatus, this is just a temporary function.
|
||||||
// TODO (random-liu) Remove this method later
|
// TODO(random-liu): Remove this method later
|
||||||
GetPodStatusAndAPIPodStatus(*api.Pod) (*PodStatus, *api.PodStatus, error)
|
GetPodStatusAndAPIPodStatus(*api.Pod) (*PodStatus, *api.PodStatus, error)
|
||||||
// PullImage pulls an image from the network to local storage using the supplied
|
// PullImage pulls an image from the network to local storage using the supplied
|
||||||
// secrets if necessary.
|
// secrets if necessary.
|
||||||
|
@ -194,7 +194,7 @@ func (f *FakeDockerClient) ListContainers(options docker.ListContainersOptions)
|
|||||||
if options.All {
|
if options.All {
|
||||||
// Althought the container is not sorted, but the container with the same name should be in order,
|
// Althought the container is not sorted, but the container with the same name should be in order,
|
||||||
// that is enough for us now.
|
// that is enough for us now.
|
||||||
// TODO (random-liu) Is a fully sorted array needed?
|
// TODO(random-liu): Is a fully sorted array needed?
|
||||||
containerList = append(containerList, f.ExitedContainerList...)
|
containerList = append(containerList, f.ExitedContainerList...)
|
||||||
}
|
}
|
||||||
return containerList, err
|
return containerList, err
|
||||||
|
@ -56,7 +56,7 @@ type labelledContainerInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newLabels(container *api.Container, pod *api.Pod, restartCount int) map[string]string {
|
func newLabels(container *api.Container, pod *api.Pod, restartCount int) map[string]string {
|
||||||
// TODO (random-liu) Move more label initialization here
|
// TODO(random-liu): Move more label initialization here
|
||||||
labels := map[string]string{}
|
labels := map[string]string{}
|
||||||
labels[kubernetesPodNameLabel] = pod.Name
|
labels[kubernetesPodNameLabel] = pod.Name
|
||||||
labels[kubernetesPodNamespaceLabel] = pod.Namespace
|
labels[kubernetesPodNamespaceLabel] = pod.Namespace
|
||||||
|
@ -441,7 +441,7 @@ func (dm *DockerManager) ConvertPodStatusToAPIPodStatus(pod *api.Pod, podStatus
|
|||||||
}
|
}
|
||||||
|
|
||||||
containerDone := sets.NewString()
|
containerDone := sets.NewString()
|
||||||
// NOTE: (random-liu) The Pod IP is generated in kubelet.generatePodStatus(), we have no podStatus.IP now
|
// NOTE(random-liu): The Pod IP is generated in kubelet.generatePodStatus(), we have no podStatus.IP now
|
||||||
apiPodStatus.PodIP = podStatus.IP
|
apiPodStatus.PodIP = podStatus.IP
|
||||||
for _, containerStatus := range podStatus.ContainerStatuses {
|
for _, containerStatus := range podStatus.ContainerStatuses {
|
||||||
cName := containerStatus.Name
|
cName := containerStatus.Name
|
||||||
@ -1224,7 +1224,7 @@ func (dm *DockerManager) GetContainerIP(containerID, interfaceName string) (stri
|
|||||||
return string(out), nil
|
return string(out), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: (random-liu) Change running pod to pod status in the future. We can't do it now, because kubelet also uses this function without pod status.
|
// TODO(random-liu): Change running pod to pod status in the future. We can't do it now, because kubelet also uses this function without pod status.
|
||||||
// We can only deprecate this after refactoring kubelet.
|
// We can only deprecate this after refactoring kubelet.
|
||||||
func (dm *DockerManager) KillPod(pod *api.Pod, runningPod kubecontainer.Pod) error {
|
func (dm *DockerManager) KillPod(pod *api.Pod, runningPod kubecontainer.Pod) error {
|
||||||
// Send the kills in parallel since they may take a long time. Len + 1 since there
|
// Send the kills in parallel since they may take a long time. Len + 1 since there
|
||||||
@ -1776,7 +1776,7 @@ func (dm *DockerManager) SyncPod(pod *api.Pod, _ kubecontainer.Pod, _ api.PodSta
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Killing phase: if we want to start new infra container, or nothing is running kill everything (including infra container)
|
// Killing phase: if we want to start new infra container, or nothing is running kill everything (including infra container)
|
||||||
// TODO: (random-liu) We'll use pod status directly in the future
|
// TODO(random-liu): We'll use pod status directly in the future
|
||||||
if err := dm.KillPod(pod, kubecontainer.ConvertPodStatusToRunningPod(podStatus)); err != nil {
|
if err := dm.KillPod(pod, kubecontainer.ConvertPodStatusToRunningPod(podStatus)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1786,7 +1786,7 @@ func (dm *DockerManager) SyncPod(pod *api.Pod, _ kubecontainer.Pod, _ api.PodSta
|
|||||||
for _, containerStatus := range runningContainerStatues {
|
for _, containerStatus := range runningContainerStatues {
|
||||||
_, keep := containerChanges.ContainersToKeep[kubetypes.DockerID(containerStatus.ID.ID)]
|
_, keep := containerChanges.ContainersToKeep[kubetypes.DockerID(containerStatus.ID.ID)]
|
||||||
if !keep {
|
if !keep {
|
||||||
// NOTE: (random-liu) Just log ID or log container status here?
|
// NOTE(random-liu): Just log ID or log container status here?
|
||||||
glog.V(3).Infof("Killing unwanted container %+v", containerStatus)
|
glog.V(3).Infof("Killing unwanted container %+v", containerStatus)
|
||||||
// attempt to find the appropriate container policy
|
// attempt to find the appropriate container policy
|
||||||
var podContainer *api.Container
|
var podContainer *api.Container
|
||||||
@ -2042,8 +2042,8 @@ func (dm *DockerManager) GetPodStatus(uid types.UID, name, namespace string) (*k
|
|||||||
var containerStatuses []*kubecontainer.ContainerStatus
|
var containerStatuses []*kubecontainer.ContainerStatus
|
||||||
// We have added labels like pod name and pod namespace, it seems that we can do filtered list here.
|
// We have added labels like pod name and pod namespace, it seems that we can do filtered list here.
|
||||||
// However, there may be some old containers without these labels, so at least now we can't do that.
|
// However, there may be some old containers without these labels, so at least now we can't do that.
|
||||||
// TODO (random-liu) Do only one list and pass in the list result in the future
|
// TODO(random-liu): Do only one list and pass in the list result in the future
|
||||||
// TODO (random-liu) Add filter when we are sure that all the containers have the labels
|
// TODO(random-liu): Add filter when we are sure that all the containers have the labels
|
||||||
containers, err := dm.client.ListContainers(docker.ListContainersOptions{All: true})
|
containers, err := dm.client.ListContainers(docker.ListContainersOptions{All: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return podStatus, err
|
return podStatus, err
|
||||||
|
@ -3040,7 +3040,7 @@ func GetPhase(spec *api.PodSpec, info []api.ContainerStatus) api.PodPhase {
|
|||||||
|
|
||||||
// By passing the pod directly, this method avoids pod lookup, which requires
|
// By passing the pod directly, this method avoids pod lookup, which requires
|
||||||
// grabbing a lock.
|
// grabbing a lock.
|
||||||
// TODO (random-liu) api.PodStatus is named as podStatus, this maybe confusing, this may happen in other functions
|
// TODO(random-liu): api.PodStatus is named as podStatus, this maybe confusing, this may happen in other functions
|
||||||
// after refactoring, modify them later.
|
// after refactoring, modify them later.
|
||||||
func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
|
func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ func (kl *Kubelet) runPod(pod *api.Pod, retryDelay time.Duration) error {
|
|||||||
|
|
||||||
// isPodRunning returns true if all containers of a manifest are running.
|
// isPodRunning returns true if all containers of a manifest are running.
|
||||||
func (kl *Kubelet) isPodRunning(pod *api.Pod, runningPod container.Pod) (bool, error) {
|
func (kl *Kubelet) isPodRunning(pod *api.Pod, runningPod container.Pod) (bool, error) {
|
||||||
// TODO (random-liu) Change this to new pod status
|
// TODO(random-liu): Change this to new pod status
|
||||||
status, err := kl.containerRuntime.GetAPIPodStatus(pod)
|
status, err := kl.containerRuntime.GetAPIPodStatus(pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Infof("Failed to get the status of pod %q: %v", format.Pod(pod), err)
|
glog.Infof("Failed to get the status of pod %q: %v", format.Pod(pod), err)
|
||||||
|
Loading…
Reference in New Issue
Block a user