mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +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
|
||||
}
|
||||
|
||||
// We add this function, because apiserver only supports *RFC3339* now, which means that the timestamp returned by
|
||||
// apiserver has no nanosecond information. However, the timestamp returned by metav1.Now() contains nanosecond,
|
||||
// so when we do comparison between status from apiserver and cached status, isPodStatusByKubeletEqual() will always return false.
|
||||
// There is related issue #15262 and PR #15263 about this.
|
||||
// In fact, the best way to solve this is to do it on api side. However, for now, we normalize the status locally in
|
||||
// kubelet temporarily.
|
||||
// TODO(random-liu): Remove timestamp related logic after apiserver supports nanosecond or makes it consistent.
|
||||
// normalizeStatus normalizes nanosecond precision timestamps in podStatus
|
||||
// down to second precision (*RFC339NANO* -> *RFC3339*). This must be done
|
||||
// before comparing podStatus to the status returned by apiserver because
|
||||
// apiserver does not support RFC339NANO.
|
||||
// Related issue #15262/PR #15263 to move apiserver to RFC339NANO is closed.
|
||||
func normalizeStatus(pod *v1.Pod, status *v1.PodStatus) *v1.PodStatus {
|
||||
bytesPerStatus := kubecontainer.MaxPodTerminationMessageLogLength
|
||||
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),
|
||||
// a reconciliation is not needed, syncBatch should do nothing.
|
||||
// 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")
|
||||
normalizedStartTime := testPod.Status.StartTime.Rfc3339Copy()
|
||||
testPod.Status.StartTime = &normalizedStartTime
|
||||
|
Loading…
Reference in New Issue
Block a user