Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1454674

Summary: started time for init container is wrong
Product: OpenShift Container Platform Reporter: Weihua Meng <wmeng>
Component: NodeAssignee: Seth Jennings <sjenning>
Status: CLOSED ERRATA QA Contact: Weihua Meng <wmeng>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.6.0CC: aos-bugs, decarr, jokerman, mmccomas, smunilla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-10 05:25:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Weihua Meng 2017-05-23 09:45:37 UTC
Description of problem:
started time for init container is wrong

Version-Release number of selected component (if applicable):
openshift v3.6.79

How reproducible:
Always

Steps to Reproduce:
1. create a pod with init container

cat pod-init-containers.yaml
apiVersion: v1
kind: Pod
metadata:
  name: init-container
spec:
  containers:
  - name: hello-pod
    image: docker.io/ocpqe/hello-pod
    ports:
    - containerPort: 80
    volumeMounts:
    - name: workdir
      mountPath: /usr/share/nginx/html
  initContainers:
  - name: init
    image: centos:centos7
    command:
    - /bin/bash
    - "-c"
    - "sleep 30"
  restartPolicy: Always
  volumes:
  - name: workdir
    emptyDir: {}

2. wait 1 min, when the pod status is running, exam pod with oc describe 

Actual results:
<---snip--->
Init Containers:
  init:
    Container ID:	docker://96e11db3fef6cc413752b759149839538c9baa49ec99084c8cb42c08243d721e
    Image:		centos:centos7
    Image ID:		docker-pullable://docker.io/centos@sha256:bba1de7c9d900a898e3cadbae040dfe8a633c06bc104a0df76ae24483e03c077
    Port:		
    Command:
      /bin/bash
      -c
      sleep 30
    State:		Terminated
      Reason:		Completed
      Exit Code:	0
      Started:		Mon, 01 Jan 0001 00:00:00 +0000
      Finished:		Tue, 23 May 2017 17:11:51 +0800
    Ready:		True
    Restart Count:	0
<---snip--->

Expected results:
unexpected:
      Started:		Mon, 01 Jan 0001 00:00:00 +0000

expected:
      Started:		Tue, 23 May 2017 17:11:21 +0800

Additional info:
The Started time for init container is correct when init container is running.

Comment 1 Seth Jennings 2017-05-23 21:40:41 UTC
Confirmed.  After init container completion, startedAt is null in the status and the annotation:

pod.beta.kubernetes.io/init-container-statuses: '[{"name":"init","state":{"terminated":{"exitCode":0,"reason":"Completed","startedAt":null,"finishedAt":"2017-05-23T21:27:25Z","containerID":"docker://87ea803bfd647a734289ae521bbd4c74db638ca9790d883a46572ce1f19ada3f"}},"lastState":{},"ready":true,"restartCount":0,"image":"docker.io/centos:centos7","imageID":"docker-pullable://docker.io/centos@sha256:bba1de7c9d900a898e3cadbae040dfe8a633c06bc104a0df76ae24483e03c077","containerID":"docker://87ea803bfd647a734289ae521bbd4c74db638ca9790d883a46572ce1f19ada3f"}]'

initContainerStatuses:
  - containerID: docker://87ea803bfd647a734289ae521bbd4c74db638ca9790d883a46572ce1f19ada3f
    image: docker.io/centos:centos7
    imageID: docker-pullable://docker.io/centos@sha256:bba1de7c9d900a898e3cadbae040dfe8a633c06bc104a0df76ae24483e03c077
    lastState: {}
    name: init
    ready: true
    restartCount: 0
    state:
      terminated:
        containerID: docker://87ea803bfd647a734289ae521bbd4c74db638ca9790d883a46572ce1f19ada3f
        exitCode: 0
        finishedAt: 2017-05-23T21:27:25Z
        reason: Completed
        startedAt: null

Comment 3 Seth Jennings 2017-05-23 22:35:43 UTC
Origin PR:
https://github.com/openshift/origin/pull/14312

Comment 5 Weihua Meng 2017-06-05 07:51:28 UTC
Verified on openshift v3.6.94
Fixed.

    State:		Terminated
      Reason:		Completed
      Exit Code:	0
      Started:		Mon, 05 Jun 2017 15:47:15 +0800
      Finished:		Mon, 05 Jun 2017 15:47:45 +0800

Comment 7 errata-xmlrpc 2017-08-10 05:25:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1716