mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #79892 from mikebrow/todo-cleanup-status-manager
update code docs around old todo that is not going to happen
This commit is contained in:
commit
b168ab1f99
@ -582,13 +582,11 @@ func (m *manager) needsReconcile(uid types.UID, status v1.PodStatus) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// We add this function, because apiserver only supports *RFC3339* now, which means that the timestamp returned by
|
// normalizeStatus normalizes nanosecond precision timestamps in podStatus
|
||||||
// apiserver has no nanosecond information. However, the timestamp returned by metav1.Now() contains nanosecond,
|
// down to second precision (*RFC339NANO* -> *RFC3339*). This must be done
|
||||||
// so when we do comparison between status from apiserver and cached status, isPodStatusByKubeletEqual() will always return false.
|
// before comparing podStatus to the status returned by apiserver because
|
||||||
// There is related issue #15262 and PR #15263 about this.
|
// apiserver does not support RFC339NANO.
|
||||||
// In fact, the best way to solve this is to do it on api side. However, for now, we normalize the status locally in
|
// Related issue #15262/PR #15263 to move apiserver to RFC339NANO is closed.
|
||||||
// kubelet temporarily.
|
|
||||||
// TODO(random-liu): Remove timestamp related logic after apiserver supports nanosecond or makes it consistent.
|
|
||||||
func normalizeStatus(pod *v1.Pod, status *v1.PodStatus) *v1.PodStatus {
|
func normalizeStatus(pod *v1.Pod, status *v1.PodStatus) *v1.PodStatus {
|
||||||
bytesPerStatus := kubecontainer.MaxPodTerminationMessageLogLength
|
bytesPerStatus := kubecontainer.MaxPodTerminationMessageLogLength
|
||||||
if containers := len(pod.Spec.Containers) + len(pod.Spec.InitContainers); containers > 0 {
|
if containers := len(pod.Spec.Containers) + len(pod.Spec.InitContainers); containers > 0 {
|
||||||
|
@ -745,7 +745,7 @@ func TestReconcilePodStatus(t *testing.T) {
|
|||||||
// If the pod status is the same, only the timestamp is in Rfc3339 format (lower precision without nanosecond),
|
// If the pod status is the same, only the timestamp is in Rfc3339 format (lower precision without nanosecond),
|
||||||
// a reconciliation is not needed, syncBatch should do nothing.
|
// a reconciliation is not needed, syncBatch should do nothing.
|
||||||
// The StartTime should have been set in SetPodStatus().
|
// The StartTime should have been set in SetPodStatus().
|
||||||
// TODO(random-liu): Remove this later when api becomes consistent for timestamp.
|
// This test is done because the related issue #15262/PR #15263 to move apiserver to RFC339NANO is closed.
|
||||||
t.Logf("Syncbatch should do nothing, as a reconciliation is not required")
|
t.Logf("Syncbatch should do nothing, as a reconciliation is not required")
|
||||||
normalizedStartTime := testPod.Status.StartTime.Rfc3339Copy()
|
normalizedStartTime := testPod.Status.StartTime.Rfc3339Copy()
|
||||||
testPod.Status.StartTime = &normalizedStartTime
|
testPod.Status.StartTime = &normalizedStartTime
|
||||||
|
Loading…
Reference in New Issue
Block a user