mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #2586 from dchen1107/cleanup
Using util.Time for ContainerStatus
This commit is contained in:
commit
610ab9a0db
@ -17,8 +17,6 @@ limitations under the License.
|
||||
package api
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
)
|
||||
|
||||
@ -363,7 +361,7 @@ type ContainerStateWaiting struct {
|
||||
}
|
||||
|
||||
type ContainerStateRunning struct {
|
||||
StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
}
|
||||
|
||||
type ContainerStateTerminated struct {
|
||||
@ -371,8 +369,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 time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
FinishedAt time.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
|
||||
StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
FinishedAt util.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
|
||||
}
|
||||
|
||||
// ContainerState holds a possible state of container.
|
||||
|
@ -17,8 +17,6 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
)
|
||||
|
||||
@ -328,19 +326,16 @@ type ContainerStateWaiting struct {
|
||||
}
|
||||
|
||||
type ContainerStateRunning struct {
|
||||
// TODO: change to util.Time
|
||||
StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which the container was last (re-)started"`
|
||||
StartedAt util.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"`
|
||||
// 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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// ContainerState holds a possible state of container.
|
||||
|
@ -17,8 +17,6 @@ limitations under the License.
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
)
|
||||
|
||||
@ -293,19 +291,16 @@ type ContainerStateWaiting struct {
|
||||
}
|
||||
|
||||
type ContainerStateRunning struct {
|
||||
// TODO: change to util.Time
|
||||
StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty" description:"time at which the container was last (re-)started"`
|
||||
StartedAt util.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"`
|
||||
// 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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// ContainerState holds a possible state of container.
|
||||
|
@ -17,8 +17,6 @@ limitations under the License.
|
||||
package v1beta3
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
)
|
||||
|
||||
@ -392,7 +390,7 @@ type ContainerStateWaiting struct {
|
||||
}
|
||||
|
||||
type ContainerStateRunning struct {
|
||||
StartedAt time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
}
|
||||
|
||||
type ContainerStateTerminated struct {
|
||||
@ -400,8 +398,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 time.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
FinishedAt time.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
|
||||
StartedAt util.Time `json:"startedAt,omitempty" yaml:"startedAt,omitempty"`
|
||||
FinishedAt util.Time `json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
|
||||
}
|
||||
|
||||
// ContainerState holds a possible state of container.
|
||||
|
@ -387,7 +387,7 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str
|
||||
waiting := true
|
||||
if inspectResult.State.Running {
|
||||
containerStatus.State.Running = &api.ContainerStateRunning{
|
||||
StartedAt: inspectResult.State.StartedAt,
|
||||
StartedAt: util.Time{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: inspectResult.State.StartedAt,
|
||||
FinishedAt: inspectResult.State.FinishedAt,
|
||||
StartedAt: util.Time{inspectResult.State.StartedAt},
|
||||
FinishedAt: util.Time{inspectResult.State.FinishedAt},
|
||||
}
|
||||
if tPath != "" {
|
||||
path, found := inspectResult.Volumes[tPath]
|
||||
|
@ -578,7 +578,7 @@ func TestFillPodInfo(t *testing.T) {
|
||||
"net": {
|
||||
State: api.ContainerState{
|
||||
Running: &api.ContainerStateRunning{
|
||||
StartedAt: expectedTime,
|
||||
StartedAt: util.Time{expectedTime},
|
||||
},
|
||||
},
|
||||
RestartCount: 1,
|
||||
|
Loading…
Reference in New Issue
Block a user