diff --git a/pkg/api/types.go b/pkg/api/types.go index b8f0962befa..5ed942e19d2 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -17,6 +17,8 @@ limitations under the License. package api import ( + "time" + "github.com/GoogleCloudPlatform/kubernetes/pkg/util" ) @@ -361,7 +363,7 @@ type ContainerStateWaiting struct { } type ContainerStateRunning struct { - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` } type ContainerStateTerminated struct { @@ -369,8 +371,8 @@ type ContainerStateTerminated struct { Signal int `json:"signal,omitempty" yaml:"signal,omitempty"` Reason string `json:"reason,omitempty" yaml:"reason,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"` - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` - FinishedAt util.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"` + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` + FinishedAt time.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"` } // ContainerState holds a possible state of container. diff --git a/pkg/api/v1beta1/types.go b/pkg/api/v1beta1/types.go index e258bf3b612..0d7a3a69fe2 100644 --- a/pkg/api/v1beta1/types.go +++ b/pkg/api/v1beta1/types.go @@ -17,6 +17,8 @@ limitations under the License. package v1beta1 import ( + "time" + "github.com/GoogleCloudPlatform/kubernetes/pkg/util" ) @@ -326,16 +328,19 @@ type ContainerStateWaiting struct { } type ContainerStateRunning struct { - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which the container was last (re-)started"` + // TODO: change to util.Time + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which the container was last (re-)started"` } type ContainerStateTerminated struct { - ExitCode int `json:"exitCode" yaml:"exitCode" description:"exit status from the last termination of the container"` - Signal int `json:"signal,omitempty" yaml:"signal,omitempty" description:"signal from the last termination of the container"` - Reason string `json:"reason,omitempty" yaml:"reason,omitempty" description:"(brief) reason from the last termination of the container"` - Message string `json:"message,omitempty" yaml:"message,omitempty" description:"message regarding the last termination of the container"` - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which previous execution of the container started"` - FinishedAt util.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty" description:"time at which the container last terminated"` + ExitCode int `json:"exitCode" yaml:"exitCode" description:"exit status from the last termination of the container"` + Signal int `json:"signal,omitempty" yaml:"signal,omitempty" description:"signal from the last termination of the container"` + Reason string `json:"reason,omitempty" yaml:"reason,omitempty" description:"(brief) reason from the last termination of the container"` + Message string `json:"message,omitempty" yaml:"message,omitempty" description:"message regarding the last termination of the container"` + // TODO: change to util.Time + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which previous execution of the container started"` + // TODO: change to util.Time + FinishedAt time.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty" description:"time at which the container last terminated"` } // ContainerState holds a possible state of container. diff --git a/pkg/api/v1beta2/types.go b/pkg/api/v1beta2/types.go index 764f898314b..91db025fbe9 100644 --- a/pkg/api/v1beta2/types.go +++ b/pkg/api/v1beta2/types.go @@ -17,6 +17,8 @@ limitations under the License. package v1beta2 import ( + "time" + "github.com/GoogleCloudPlatform/kubernetes/pkg/util" ) @@ -291,16 +293,19 @@ type ContainerStateWaiting struct { } type ContainerStateRunning struct { - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which the container was last (re-)started"` + // TODO: change to util.Time + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which the container was last (re-)started"` } type ContainerStateTerminated struct { - ExitCode int `json:"exitCode" yaml:"exitCode" description:"exit status from the last termination of the container"` - Signal int `json:"signal,omitempty" yaml:"signal,omitempty" description:"signal from the last termination of the container"` - Reason string `json:"reason,omitempty" yaml:"reason,omitempty" description:"(brief) reason from the last termination of the container"` - Message string `json:"message,omitempty" yaml:"message,omitempty" description:"message regarding the last termination of the container"` - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which previous execution of the container started"` - FinishedAt util.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty" description:"time at which the container last terminated"` + ExitCode int `json:"exitCode" yaml:"exitCode" description:"exit status from the last termination of the container"` + Signal int `json:"signal,omitempty" yaml:"signal,omitempty" description:"signal from the last termination of the container"` + Reason string `json:"reason,omitempty" yaml:"reason,omitempty" description:"(brief) reason from the last termination of the container"` + Message string `json:"message,omitempty" yaml:"message,omitempty" description:"message regarding the last termination of the container"` + // TODO: change to util.Time + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which previous execution of the container started"` + // TODO: change to util.Time + FinishedAt time.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty" description:"time at which the container last terminated"` } // ContainerState holds a possible state of container. diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index ea11f8c3c3a..92b982114d4 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -17,6 +17,8 @@ limitations under the License. package v1beta3 import ( + "time" + "github.com/GoogleCloudPlatform/kubernetes/pkg/util" ) @@ -390,7 +392,7 @@ type ContainerStateWaiting struct { } type ContainerStateRunning struct { - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` } type ContainerStateTerminated struct { @@ -398,8 +400,8 @@ type ContainerStateTerminated struct { Signal int `json:"signal,omitempty" yaml:"signal,omitempty"` Reason string `json:"reason,omitempty" yaml:"reason,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"` - StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` - FinishedAt util.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"` + StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"` + FinishedAt time.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"` } // ContainerState holds a possible state of container. diff --git a/pkg/kubelet/dockertools/docker.go b/pkg/kubelet/dockertools/docker.go index f46def4c2b9..8f0c26ecda8 100644 --- a/pkg/kubelet/dockertools/docker.go +++ b/pkg/kubelet/dockertools/docker.go @@ -387,7 +387,7 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str waiting := true if inspectResult.State.Running { containerStatus.State.Running = &api.ContainerStateRunning{ - StartedAt: util.Time{inspectResult.State.StartedAt}, + StartedAt: inspectResult.State.StartedAt, } if containerName == "net" && inspectResult.NetworkSettings != nil { containerStatus.PodIP = inspectResult.NetworkSettings.IPAddress @@ -398,8 +398,8 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str containerStatus.State.Termination = &api.ContainerStateTerminated{ ExitCode: inspectResult.State.ExitCode, Reason: "", - StartedAt: util.Time{inspectResult.State.StartedAt}, - FinishedAt: util.Time{inspectResult.State.FinishedAt}, + StartedAt: inspectResult.State.StartedAt, + FinishedAt: inspectResult.State.FinishedAt, } if tPath != "" { path, found := inspectResult.Volumes[tPath] diff --git a/pkg/registry/pod/rest_test.go b/pkg/registry/pod/rest_test.go index e6d0b7e35c1..cb06b8f63f8 100644 --- a/pkg/registry/pod/rest_test.go +++ b/pkg/registry/pod/rest_test.go @@ -578,7 +578,7 @@ func TestFillPodInfo(t *testing.T) { "net": { State: api.ContainerState{ Running: &api.ContainerStateRunning{ - StartedAt: util.Time{expectedTime}, + StartedAt: expectedTime, }, }, RestartCount: 1,