Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
586cb912
Commit
586cb912
authored
Sep 17, 2015
by
Daniel Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move pkg/util.Time to pkg/api/unversioned.Time
Along with our time.Duration wrapper, as suggested by @lavalamp.
parent
21c7dd42
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
79 changed files
with
363 additions
and
339 deletions
+363
-339
fcfs.go
contrib/mesos/pkg/scheduler/fcfs.go
+1
-0
plugin_test.go
contrib/mesos/pkg/scheduler/plugin_test.go
+1
-2
event_compression.md
docs/design/event_compression.md
+2
-2
expansion.md
docs/design/expansion.md
+1
-1
api-conventions.md
docs/devel/api-conventions.md
+2
-2
compute-resource-metrics-api.md
docs/proposals/compute-resource-metrics-api.md
+1
-1
horizontal-pod-autoscaler.md
docs/proposals/horizontal-pod-autoscaler.md
+1
-1
job.md
docs/proposals/job.md
+5
-5
make_secret.go
examples/https-nginx/make_secret.go
+2
-1
conversion.go
pkg/api/conversion.go
+2
-2
deep_copy_generated.go
pkg/api/deep_copy_generated.go
+22
-22
helpers.go
pkg/api/helpers.go
+2
-2
meta.go
pkg/api/meta.go
+1
-1
meta_test.go
pkg/api/meta/meta_test.go
+4
-4
delete.go
pkg/api/rest/delete.go
+3
-3
resttest.go
pkg/api/rest/resttest/resttest.go
+1
-2
fuzzer.go
pkg/api/testing/fuzzer.go
+1
-1
types.go
pkg/api/types.go
+10
-10
time.go
pkg/api/unversioned/time.go
+1
-1
time_test.go
pkg/api/unversioned/time_test.go
+1
-1
deep_copy_generated.go
pkg/api/v1/deep_copy_generated.go
+22
-22
types.go
pkg/api/v1/types.go
+10
-10
validation_test.go
pkg/api/validation/validation_test.go
+7
-6
deep_copy_generated.go
pkg/apis/experimental/deep_copy_generated.go
+21
-21
types.go
pkg/apis/experimental/types.go
+5
-5
deep_copy_generated.go
pkg/apis/experimental/v1/deep_copy_generated.go
+21
-21
types.go
pkg/apis/experimental/v1/types.go
+5
-5
api_installer.go
pkg/apiserver/api_installer.go
+1
-1
authz.go
pkg/apiserver/authz.go
+1
-0
expiration_cache.go
pkg/client/cache/expiration_cache.go
+2
-1
event.go
pkg/client/record/event.go
+6
-5
events_cache.go
pkg/client/record/events_cache.go
+2
-2
events_cache_test.go
pkg/client/record/events_cache_test.go
+5
-5
fake.go
pkg/client/record/fake.go
+2
-2
events_test.go
pkg/client/unversioned/events_test.go
+4
-4
aws_instancegroups.go
pkg/cloudprovider/providers/aws/aws_instancegroups.go
+1
-0
job_controller.go
pkg/controller/job/job_controller.go
+3
-2
job_controller_test.go
pkg/controller/job/job_controller_test.go
+4
-3
namespace_controller.go
pkg/controller/namespace/namespace_controller.go
+4
-3
namespace_controller_test.go
pkg/controller/namespace/namespace_controller_test.go
+2
-2
nodecontroller.go
pkg/controller/node/nodecontroller.go
+6
-5
nodecontroller_test.go
pkg/controller/node/nodecontroller_test.go
+0
-0
horizontal.go
pkg/controller/podautoscaler/horizontal.go
+2
-1
replication_controller_test.go
pkg/controller/replication/replication_controller_test.go
+1
-1
cmd_test.go
pkg/kubectl/cmd/cmd_test.go
+10
-9
describe_test.go
pkg/kubectl/describe_test.go
+13
-13
resource_printer.go
pkg/kubectl/resource_printer.go
+1
-2
resource_printer_test.go
pkg/kubectl/resource_printer_test.go
+22
-22
service.go
pkg/kubectl/service.go
+2
-1
sorted_event_list_test.go
pkg/kubectl/sorted_event_list_test.go
+7
-7
manager.go
pkg/kubelet/dockertools/manager.go
+10
-9
kubelet.go
pkg/kubelet/kubelet.go
+3
-2
kubelet_test.go
pkg/kubelet/kubelet_test.go
+11
-10
node_manager.go
pkg/kubelet/node_manager.go
+2
-1
node_manager_test.go
pkg/kubelet/node_manager_test.go
+18
-18
oom_watcher.go
pkg/kubelet/oom_watcher.go
+2
-1
oom_watcher_test.go
pkg/kubelet/oom_watcher_test.go
+5
-5
pod_info.go
pkg/kubelet/rkt/pod_info.go
+3
-3
manager.go
pkg/kubelet/status/manager.go
+2
-1
manager_test.go
pkg/kubelet/status/manager_test.go
+4
-4
proxier_test.go
pkg/proxy/iptables/proxier_test.go
+2
-1
etcd.go
pkg/registry/namespace/etcd/etcd.go
+2
-2
etcd_test.go
pkg/registry/namespace/etcd/etcd_test.go
+3
-3
strategy_test.go
pkg/registry/namespace/strategy_test.go
+2
-2
allocator.go
pkg/registry/service/ipallocator/allocator.go
+3
-2
allocator.go
pkg/registry/service/portallocator/allocator.go
+1
-0
codec_test.go
pkg/registry/thirdpartyresourcedata/codec_test.go
+1
-2
cacher_test.go
pkg/storage/cacher_test.go
+5
-4
api_object_versioner.go
pkg/storage/etcd/api_object_versioner.go
+2
-2
api_object_versioner_test.go
pkg/storage/etcd/api_object_versioner_test.go
+2
-2
io_test.go
pkg/util/io/io_test.go
+3
-2
slice.go
pkg/util/slice/slice.go
+2
-1
ssh_test.go
pkg/util/ssh_test.go
+3
-3
util_test.go
pkg/volume/util_test.go
+1
-1
density.go
test/e2e/density.go
+7
-7
google_compute.go
test/e2e/google_compute.go
+2
-1
prompush.go
test/e2e/prompush.go
+1
-0
scheduler_test.go
test/integration/scheduler_test.go
+3
-3
exec.go
third_party/golang/template/exec.go
+2
-2
No files found.
contrib/mesos/pkg/scheduler/fcfs.go
View file @
586cb912
...
@@ -18,6 +18,7 @@ package scheduler
...
@@ -18,6 +18,7 @@ package scheduler
import
(
import
(
"fmt"
"fmt"
log
"github.com/golang/glog"
log
"github.com/golang/glog"
"k8s.io/kubernetes/contrib/mesos/pkg/offers"
"k8s.io/kubernetes/contrib/mesos/pkg/offers"
...
...
contrib/mesos/pkg/scheduler/plugin_test.go
View file @
586cb912
...
@@ -30,7 +30,6 @@ import (
...
@@ -30,7 +30,6 @@ import (
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/cache"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
kutil
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/pkg/watch"
log
"github.com/golang/glog"
log
"github.com/golang/glog"
...
@@ -273,7 +272,7 @@ func (o *EventObserver) Event(object runtime.Object, reason, message string) {
...
@@ -273,7 +272,7 @@ func (o *EventObserver) Event(object runtime.Object, reason, message string) {
func
(
o
*
EventObserver
)
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
(
o
*
EventObserver
)
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
o
.
fifo
<-
Event
{
Object
:
object
,
Reason
:
reason
,
Message
:
fmt
.
Sprintf
(
messageFmt
,
args
...
)}
o
.
fifo
<-
Event
{
Object
:
object
,
Reason
:
reason
,
Message
:
fmt
.
Sprintf
(
messageFmt
,
args
...
)}
}
}
func
(
o
*
EventObserver
)
PastEventf
(
object
runtime
.
Object
,
timestamp
kutil
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
(
o
*
EventObserver
)
PastEventf
(
object
runtime
.
Object
,
timestamp
unversioned
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
o
.
fifo
<-
Event
{
Object
:
object
,
Reason
:
reason
,
Message
:
fmt
.
Sprintf
(
messageFmt
,
args
...
)}
o
.
fifo
<-
Event
{
Object
:
object
,
Reason
:
reason
,
Message
:
fmt
.
Sprintf
(
messageFmt
,
args
...
)}
}
}
...
...
docs/design/event_compression.md
View file @
586cb912
...
@@ -49,9 +49,9 @@ Event compression should be best effort (not guaranteed). Meaning, in the worst
...
@@ -49,9 +49,9 @@ Event compression should be best effort (not guaranteed). Meaning, in the worst
## Design
## Design
Instead of a single Timestamp, each event object
[
contains
](
http://releases.k8s.io/HEAD/pkg/api/types.go#L1111
)
the following fields:
Instead of a single Timestamp, each event object
[
contains
](
http://releases.k8s.io/HEAD/pkg/api/types.go#L1111
)
the following fields:
*
`FirstTimestamp u
til
.Time`
*
`FirstTimestamp u
nversioned
.Time`
*
The date/time of the first occurrence of the event.
*
The date/time of the first occurrence of the event.
*
`LastTimestamp u
til
.Time`
*
`LastTimestamp u
nversioned
.Time`
*
The date/time of the most recent occurrence of the event.
*
The date/time of the most recent occurrence of the event.
*
On first occurrence, this is equal to the FirstTimestamp.
*
On first occurrence, this is equal to the FirstTimestamp.
*
`Count int`
*
`Count int`
...
...
docs/design/expansion.md
View file @
586cb912
...
@@ -265,7 +265,7 @@ type ObjectEventRecorder interface {
...
@@ -265,7 +265,7 @@ type ObjectEventRecorder interface {
Eventf
(
reason
,
messageFmt
string
,
args
...
interface
{})
Eventf
(
reason
,
messageFmt
string
,
args
...
interface
{})
// PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field.
// PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field.
PastEventf
(
timestamp
u
til
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
PastEventf
(
timestamp
u
nversioned
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
}
}
```
```
...
...
docs/devel/api-conventions.md
View file @
586cb912
...
@@ -189,8 +189,8 @@ The `FooCondition` type for some resource type `Foo` may include a subset of the
...
@@ -189,8 +189,8 @@ The `FooCondition` type for some resource type `Foo` may include a subset of the
```
golang
```
golang
Type
FooConditionType
`json:"type" description:"type of Foo condition"`
Type
FooConditionType
`json:"type" description:"type of Foo condition"`
Status
ConditionStatus
`json:"status" description:"status of the condition, one of True, False, Unknown"`
Status
ConditionStatus
`json:"status" description:"status of the condition, one of True, False, Unknown"`
LastHeartbeatTime
u
til
.
Time
`json:"lastHeartbeatTime,omitempty" description:"last time we got an update on a given condition"`
LastHeartbeatTime
u
nversioned
.
Time
`json:"lastHeartbeatTime,omitempty" description:"last time we got an update on a given condition"`
LastTransitionTime
u
til
.
Time
`json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`
LastTransitionTime
u
nversioned
.
Time
`json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`
Reason
string
`json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"`
Reason
string
`json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"`
Message
string
`json:"message,omitempty" description:"human-readable message indicating details about last transition"`
Message
string
`json:"message,omitempty" description:"human-readable message indicating details about last transition"`
```
```
...
...
docs/proposals/compute-resource-metrics-api.md
View file @
586cb912
...
@@ -161,7 +161,7 @@ type MetricsWindows map[time.Duration]DerivedMetrics
...
@@ -161,7 +161,7 @@ type MetricsWindows map[time.Duration]DerivedMetrics
type DerivedMetrics struct {
type DerivedMetrics struct {
// End time of all the time windows in Metrics
// End time of all the time windows in Metrics
EndTime u
til
.Time `json:"endtime"`
EndTime u
nversioned
.Time `json:"endtime"`
Mean ResourceUsage `json:"mean"`
Mean ResourceUsage `json:"mean"`
Max ResourceUsage `json:"max"`
Max ResourceUsage `json:"max"`
...
...
docs/proposals/horizontal-pod-autoscaler.md
View file @
586cb912
...
@@ -162,7 +162,7 @@ type HorizontalPodAutoscalerStatus struct {
...
@@ -162,7 +162,7 @@ type HorizontalPodAutoscalerStatus struct {
// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
// This is used by the autoscaler to control how often the number of pods is changed.
// This is used by the autoscaler to control how often the number of pods is changed.
LastScaleTimestamp *u
til
.Time
LastScaleTimestamp *u
nversioned
.Time
}
}
// ResourceConsumption is an object for specifying average resource consumption of a particular resource.
// ResourceConsumption is an object for specifying average resource consumption of a particular resource.
...
...
docs/proposals/job.md
View file @
586cb912
...
@@ -131,13 +131,13 @@ type JobStatus struct {
...
@@ -131,13 +131,13 @@ type JobStatus struct {
Conditions
[]
JobCondition
Conditions
[]
JobCondition
// CreationTime represents time when the job was created
// CreationTime represents time when the job was created
CreationTime
u
til
.
Time
CreationTime
u
nversioned
.
Time
// StartTime represents time when the job was started
// StartTime represents time when the job was started
StartTime
u
til
.
Time
StartTime
u
nversioned
.
Time
// CompletionTime represents time when the job was completed
// CompletionTime represents time when the job was completed
CompletionTime
u
til
.
Time
CompletionTime
u
nversioned
.
Time
// Active is the number of actively running pods.
// Active is the number of actively running pods.
Active
int
Active
int
...
@@ -162,8 +162,8 @@ const (
...
@@ -162,8 +162,8 @@ const (
type
JobCondition
struct
{
type
JobCondition
struct
{
Type
JobConditionType
Type
JobConditionType
Status
ConditionStatus
Status
ConditionStatus
LastHeartbeatTime
u
til
.
Time
LastHeartbeatTime
u
nversioned
.
Time
LastTransitionTime
u
til
.
Time
LastTransitionTime
u
nversioned
.
Time
Reason
string
Reason
string
Message
string
Message
string
}
}
...
...
examples/https-nginx/make_secret.go
View file @
586cb912
...
@@ -24,10 +24,11 @@ import (
...
@@ -24,10 +24,11 @@ import (
"flag"
"flag"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"log"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"log"
)
)
// TODO:
// TODO:
...
...
pkg/api/conversion.go
View file @
586cb912
...
@@ -18,11 +18,11 @@ package api
...
@@ -18,11 +18,11 @@ package api
import
(
import
(
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
)
// Codec is the identity codec for this package - it can only convert itself
// Codec is the identity codec for this package - it can only convert itself
...
@@ -46,7 +46,7 @@ func init() {
...
@@ -46,7 +46,7 @@ func init() {
},
},
)
)
Scheme
.
AddConversionFuncs
(
Scheme
.
AddConversionFuncs
(
func
(
in
*
u
til
.
Time
,
out
*
util
.
Time
,
s
conversion
.
Scope
)
error
{
func
(
in
*
u
nversioned
.
Time
,
out
*
unversioned
.
Time
,
s
conversion
.
Scope
)
error
{
// Cannot deep copy these, because time.Time has unexported fields.
// Cannot deep copy these, because time.Time has unexported fields.
*
out
=
*
in
*
out
=
*
in
return
nil
return
nil
...
...
pkg/api/deep_copy_generated.go
View file @
586cb912
...
@@ -280,7 +280,7 @@ func deepCopy_api_ContainerState(in ContainerState, out *ContainerState, c *conv
...
@@ -280,7 +280,7 @@ func deepCopy_api_ContainerState(in ContainerState, out *ContainerState, c *conv
}
}
func
deepCopy_api_ContainerStateRunning
(
in
ContainerStateRunning
,
out
*
ContainerStateRunning
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_api_ContainerStateRunning
(
in
ContainerStateRunning
,
out
*
ContainerStateRunning
,
c
*
conversion
.
Cloner
)
error
{
if
err
:=
deepCopy_u
til
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
return
err
return
err
}
}
return
nil
return
nil
...
@@ -291,10 +291,10 @@ func deepCopy_api_ContainerStateTerminated(in ContainerStateTerminated, out *Con
...
@@ -291,10 +291,10 @@ func deepCopy_api_ContainerStateTerminated(in ContainerStateTerminated, out *Con
out
.
Signal
=
in
.
Signal
out
.
Signal
=
in
.
Signal
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
if
err
:=
deepCopy_u
til
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
FinishedAt
,
&
out
.
FinishedAt
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
FinishedAt
,
&
out
.
FinishedAt
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
ContainerID
=
in
.
ContainerID
out
.
ContainerID
=
in
.
ContainerID
...
@@ -503,10 +503,10 @@ func deepCopy_api_Event(in Event, out *Event, c *conversion.Cloner) error {
...
@@ -503,10 +503,10 @@ func deepCopy_api_Event(in Event, out *Event, c *conversion.Cloner) error {
if
err
:=
deepCopy_api_EventSource
(
in
.
Source
,
&
out
.
Source
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_api_EventSource
(
in
.
Source
,
&
out
.
Source
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
FirstTimestamp
,
&
out
.
FirstTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
FirstTimestamp
,
&
out
.
FirstTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastTimestamp
,
&
out
.
LastTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastTimestamp
,
&
out
.
LastTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Count
=
in
.
Count
out
.
Count
=
in
.
Count
...
@@ -913,10 +913,10 @@ func deepCopy_api_NodeAddress(in NodeAddress, out *NodeAddress, c *conversion.Cl
...
@@ -913,10 +913,10 @@ func deepCopy_api_NodeAddress(in NodeAddress, out *NodeAddress, c *conversion.Cl
func
deepCopy_api_NodeCondition
(
in
NodeCondition
,
out
*
NodeCondition
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_api_NodeCondition
(
in
NodeCondition
,
out
*
NodeCondition
,
c
*
conversion
.
Cloner
)
error
{
out
.
Type
=
in
.
Type
out
.
Type
=
in
.
Type
out
.
Status
=
in
.
Status
out
.
Status
=
in
.
Status
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastHeartbeatTime
,
&
out
.
LastHeartbeatTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastHeartbeatTime
,
&
out
.
LastHeartbeatTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
...
@@ -1028,12 +1028,12 @@ func deepCopy_api_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Clone
...
@@ -1028,12 +1028,12 @@ func deepCopy_api_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Clone
out
.
UID
=
in
.
UID
out
.
UID
=
in
.
UID
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
Generation
=
in
.
Generation
out
.
Generation
=
in
.
Generation
if
err
:=
deepCopy_u
til
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
in
.
DeletionTimestamp
!=
nil
{
if
in
.
DeletionTimestamp
!=
nil
{
out
.
DeletionTimestamp
=
new
(
u
til
.
Time
)
out
.
DeletionTimestamp
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -1482,8 +1482,8 @@ func deepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner)
...
@@ -1482,8 +1482,8 @@ func deepCopy_api_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner)
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
out
.
StartTime
=
new
(
u
til
.
Time
)
out
.
StartTime
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -2180,6 +2180,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
...
@@ -2180,6 +2180,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
return
nil
return
nil
}
}
func
deepCopy_unversioned_Time
(
in
unversioned
.
Time
,
out
*
unversioned
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
out
.
Kind
=
in
.
Kind
out
.
Kind
=
in
.
Kind
out
.
APIVersion
=
in
.
APIVersion
out
.
APIVersion
=
in
.
APIVersion
...
@@ -2193,15 +2202,6 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
...
@@ -2193,15 +2202,6 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
return
nil
return
nil
}
}
func
deepCopy_util_Time
(
in
util
.
Time
,
out
*
util
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
init
()
{
func
init
()
{
err
:=
Scheme
.
AddGeneratedDeepCopyFuncs
(
err
:=
Scheme
.
AddGeneratedDeepCopyFuncs
(
deepCopy_api_AWSElasticBlockStoreVolumeSource
,
deepCopy_api_AWSElasticBlockStoreVolumeSource
,
...
@@ -2322,9 +2322,9 @@ func init() {
...
@@ -2322,9 +2322,9 @@ func init() {
deepCopy_api_VolumeSource
,
deepCopy_api_VolumeSource
,
deepCopy_resource_Quantity
,
deepCopy_resource_Quantity
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_Time
,
deepCopy_unversioned_TypeMeta
,
deepCopy_unversioned_TypeMeta
,
deepCopy_util_IntOrString
,
deepCopy_util_IntOrString
,
deepCopy_util_Time
,
)
)
if
err
!=
nil
{
if
err
!=
nil
{
// if one of the deep copy functions is malformed, detect it immediately.
// if one of the deep copy functions is malformed, detect it immediately.
...
...
pkg/api/helpers.go
View file @
586cb912
...
@@ -23,11 +23,11 @@ import (
...
@@ -23,11 +23,11 @@ import (
"strings"
"strings"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
"github.com/davecgh/go-spew/spew"
"github.com/davecgh/go-spew/spew"
...
@@ -67,7 +67,7 @@ var Semantic = conversion.EqualitiesOrDie(
...
@@ -67,7 +67,7 @@ var Semantic = conversion.EqualitiesOrDie(
}
}
return
a
.
Amount
.
Cmp
(
b
.
Amount
)
==
0
return
a
.
Amount
.
Cmp
(
b
.
Amount
)
==
0
},
},
func
(
a
,
b
u
til
.
Time
)
bool
{
func
(
a
,
b
u
nversioned
.
Time
)
bool
{
return
a
.
UTC
()
==
b
.
UTC
()
return
a
.
UTC
()
==
b
.
UTC
()
},
},
func
(
a
,
b
labels
.
Selector
)
bool
{
func
(
a
,
b
labels
.
Selector
)
bool
{
...
...
pkg/api/meta.go
View file @
586cb912
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
// FillObjectMetaSystemFields populates fields that are managed by the system on ObjectMeta.
// FillObjectMetaSystemFields populates fields that are managed by the system on ObjectMeta.
func
FillObjectMetaSystemFields
(
ctx
Context
,
meta
*
ObjectMeta
)
{
func
FillObjectMetaSystemFields
(
ctx
Context
,
meta
*
ObjectMeta
)
{
meta
.
CreationTimestamp
=
u
til
.
Now
()
meta
.
CreationTimestamp
=
u
nversioned
.
Now
()
meta
.
UID
=
util
.
NewUUID
()
meta
.
UID
=
util
.
NewUUID
()
meta
.
SelfLink
=
""
meta
.
SelfLink
=
""
}
}
...
...
pkg/api/meta/meta_test.go
View file @
586cb912
...
@@ -20,8 +20,8 @@ import (
...
@@ -20,8 +20,8 @@ import (
"reflect"
"reflect"
"testing"
"testing"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
)
func
TestGenericTypeMeta
(
t
*
testing
.
T
)
{
func
TestGenericTypeMeta
(
t
*
testing
.
T
)
{
...
@@ -31,7 +31,7 @@ func TestGenericTypeMeta(t *testing.T) {
...
@@ -31,7 +31,7 @@ func TestGenericTypeMeta(t *testing.T) {
Name
string
`json:"name,omitempty"`
Name
string
`json:"name,omitempty"`
GenerateName
string
`json:"generateName,omitempty"`
GenerateName
string
`json:"generateName,omitempty"`
UID
string
`json:"uid,omitempty"`
UID
string
`json:"uid,omitempty"`
CreationTimestamp
u
til
.
Time
`json:"creationTimestamp,omitempty"`
CreationTimestamp
u
nversioned
.
Time
`json:"creationTimestamp,omitempty"`
SelfLink
string
`json:"selfLink,omitempty"`
SelfLink
string
`json:"selfLink,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
APIVersion
string
`json:"apiVersion,omitempty"`
APIVersion
string
`json:"apiVersion,omitempty"`
...
@@ -146,7 +146,7 @@ type InternalTypeMeta struct {
...
@@ -146,7 +146,7 @@ type InternalTypeMeta struct {
Name
string
`json:"name,omitempty"`
Name
string
`json:"name,omitempty"`
GenerateName
string
`json:"generateName,omitempty"`
GenerateName
string
`json:"generateName,omitempty"`
UID
string
`json:"uid,omitempty"`
UID
string
`json:"uid,omitempty"`
CreationTimestamp
u
til
.
Time
`json:"creationTimestamp,omitempty"`
CreationTimestamp
u
nversioned
.
Time
`json:"creationTimestamp,omitempty"`
SelfLink
string
`json:"selfLink,omitempty"`
SelfLink
string
`json:"selfLink,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
APIVersion
string
`json:"apiVersion,omitempty"`
APIVersion
string
`json:"apiVersion,omitempty"`
...
@@ -321,7 +321,7 @@ func TestGenericObjectMeta(t *testing.T) {
...
@@ -321,7 +321,7 @@ func TestGenericObjectMeta(t *testing.T) {
Name
string
`json:"name,omitempty"`
Name
string
`json:"name,omitempty"`
GenerateName
string
`json:"generateName,omitempty"`
GenerateName
string
`json:"generateName,omitempty"`
UID
string
`json:"uid,omitempty"`
UID
string
`json:"uid,omitempty"`
CreationTimestamp
u
til
.
Time
`json:"creationTimestamp,omitempty"`
CreationTimestamp
u
nversioned
.
Time
`json:"creationTimestamp,omitempty"`
SelfLink
string
`json:"selfLink,omitempty"`
SelfLink
string
`json:"selfLink,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
ResourceVersion
string
`json:"resourceVersion,omitempty"`
Labels
map
[
string
]
string
`json:"labels,omitempty"`
Labels
map
[
string
]
string
`json:"labels,omitempty"`
...
...
pkg/api/rest/delete.go
View file @
586cb912
...
@@ -20,8 +20,8 @@ import (
...
@@ -20,8 +20,8 @@ import (
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
)
// RESTDeleteStrategy defines deletion behavior on an object that follows Kubernetes
// RESTDeleteStrategy defines deletion behavior on an object that follows Kubernetes
...
@@ -62,7 +62,7 @@ func BeforeDelete(strategy RESTDeleteStrategy, ctx api.Context, obj runtime.Obje
...
@@ -62,7 +62,7 @@ func BeforeDelete(strategy RESTDeleteStrategy, ctx api.Context, obj runtime.Obje
if
period
>
*
objectMeta
.
DeletionGracePeriodSeconds
{
if
period
>
*
objectMeta
.
DeletionGracePeriodSeconds
{
return
false
,
true
,
nil
return
false
,
true
,
nil
}
}
now
:=
u
til
.
NewTime
(
util
.
Now
()
.
Add
(
time
.
Second
*
time
.
Duration
(
*
options
.
GracePeriodSeconds
)))
now
:=
u
nversioned
.
NewTime
(
unversioned
.
Now
()
.
Add
(
time
.
Second
*
time
.
Duration
(
*
options
.
GracePeriodSeconds
)))
objectMeta
.
DeletionTimestamp
=
&
now
objectMeta
.
DeletionTimestamp
=
&
now
objectMeta
.
DeletionGracePeriodSeconds
=
&
period
objectMeta
.
DeletionGracePeriodSeconds
=
&
period
options
.
GracePeriodSeconds
=
&
period
options
.
GracePeriodSeconds
=
&
period
...
@@ -76,7 +76,7 @@ func BeforeDelete(strategy RESTDeleteStrategy, ctx api.Context, obj runtime.Obje
...
@@ -76,7 +76,7 @@ func BeforeDelete(strategy RESTDeleteStrategy, ctx api.Context, obj runtime.Obje
if
!
strategy
.
CheckGracefulDelete
(
obj
,
options
)
{
if
!
strategy
.
CheckGracefulDelete
(
obj
,
options
)
{
return
false
,
false
,
nil
return
false
,
false
,
nil
}
}
now
:=
u
til
.
NewTime
(
util
.
Now
()
.
Add
(
time
.
Second
*
time
.
Duration
(
*
options
.
GracePeriodSeconds
)))
now
:=
u
nversioned
.
NewTime
(
unversioned
.
Now
()
.
Add
(
time
.
Second
*
time
.
Duration
(
*
options
.
GracePeriodSeconds
)))
objectMeta
.
DeletionTimestamp
=
&
now
objectMeta
.
DeletionTimestamp
=
&
now
objectMeta
.
DeletionGracePeriodSeconds
=
options
.
GracePeriodSeconds
objectMeta
.
DeletionGracePeriodSeconds
=
options
.
GracePeriodSeconds
return
true
,
false
,
nil
return
true
,
false
,
nil
...
...
pkg/api/rest/resttest/resttest.go
View file @
586cb912
...
@@ -32,7 +32,6 @@ import (
...
@@ -32,7 +32,6 @@ import (
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/tools"
"k8s.io/kubernetes/pkg/tools"
"k8s.io/kubernetes/pkg/util"
)
)
type
Tester
struct
{
type
Tester
struct
{
...
@@ -370,7 +369,7 @@ func (t *Tester) testCreateRejectsMismatchedNamespace(valid runtime.Object) {
...
@@ -370,7 +369,7 @@ func (t *Tester) testCreateRejectsMismatchedNamespace(valid runtime.Object) {
func
(
t
*
Tester
)
testCreateResetsUserData
(
valid
runtime
.
Object
)
{
func
(
t
*
Tester
)
testCreateResetsUserData
(
valid
runtime
.
Object
)
{
objectMeta
:=
t
.
getObjectMetaOrFail
(
valid
)
objectMeta
:=
t
.
getObjectMetaOrFail
(
valid
)
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
objectMeta
.
UID
=
"bad-uid"
objectMeta
.
UID
=
"bad-uid"
objectMeta
.
CreationTimestamp
=
now
objectMeta
.
CreationTimestamp
=
now
...
...
pkg/api/testing/fuzzer.go
View file @
586cb912
...
@@ -71,7 +71,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
...
@@ -71,7 +71,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
var
sec
,
nsec
int64
var
sec
,
nsec
int64
c
.
Fuzz
(
&
sec
)
c
.
Fuzz
(
&
sec
)
c
.
Fuzz
(
&
nsec
)
c
.
Fuzz
(
&
nsec
)
j
.
CreationTimestamp
=
u
til
.
Unix
(
sec
,
nsec
)
.
Rfc3339Copy
()
j
.
CreationTimestamp
=
u
nversioned
.
Unix
(
sec
,
nsec
)
.
Rfc3339Copy
()
},
},
func
(
j
*
api
.
ObjectReference
,
c
fuzz
.
Continue
)
{
func
(
j
*
api
.
ObjectReference
,
c
fuzz
.
Continue
)
{
// We have to customize the randomization of TypeMetas because their
// We have to customize the randomization of TypeMetas because their
...
...
pkg/api/types.go
View file @
586cb912
...
@@ -104,7 +104,7 @@ type ObjectMeta struct {
...
@@ -104,7 +104,7 @@ type ObjectMeta struct {
// CreationTimestamp is a timestamp representing the server time when this object was
// CreationTimestamp is a timestamp representing the server time when this object was
// created. It is not guaranteed to be set in happens-before order across separate operations.
// created. It is not guaranteed to be set in happens-before order across separate operations.
// Clients may not set this value. It is represented in RFC3339 form and is in UTC.
// Clients may not set this value. It is represented in RFC3339 form and is in UTC.
CreationTimestamp
u
til
.
Time
`json:"creationTimestamp,omitempty"`
CreationTimestamp
u
nversioned
.
Time
`json:"creationTimestamp,omitempty"`
// DeletionTimestamp is the time after which this resource will be deleted. This
// DeletionTimestamp is the time after which this resource will be deleted. This
// field is set by the server when a graceful deletion is requested by the user, and is not
// field is set by the server when a graceful deletion is requested by the user, and is not
...
@@ -115,7 +115,7 @@ type ObjectMeta struct {
...
@@ -115,7 +115,7 @@ type ObjectMeta struct {
// a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination
// a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination
// signal to the containers in the pod. Once the resource is deleted in the API, the Kubelet
// signal to the containers in the pod. Once the resource is deleted in the API, the Kubelet
// will send a hard termination signal to the container.
// will send a hard termination signal to the container.
DeletionTimestamp
*
u
til
.
Time
`json:"deletionTimestamp,omitempty"`
DeletionTimestamp
*
u
nversioned
.
Time
`json:"deletionTimestamp,omitempty"`
// DeletionGracePeriodSeconds records the graceful deletion value set when graceful deletion
// DeletionGracePeriodSeconds records the graceful deletion value set when graceful deletion
// was requested. Represents the most recent grace period, and may only be shortened once set.
// was requested. Represents the most recent grace period, and may only be shortened once set.
...
@@ -814,7 +814,7 @@ type ContainerStateWaiting struct {
...
@@ -814,7 +814,7 @@ type ContainerStateWaiting struct {
}
}
type
ContainerStateRunning
struct
{
type
ContainerStateRunning
struct
{
StartedAt
u
til
.
Time
`json:"startedAt,omitempty"`
StartedAt
u
nversioned
.
Time
`json:"startedAt,omitempty"`
}
}
type
ContainerStateTerminated
struct
{
type
ContainerStateTerminated
struct
{
...
@@ -822,8 +822,8 @@ type ContainerStateTerminated struct {
...
@@ -822,8 +822,8 @@ type ContainerStateTerminated struct {
Signal
int
`json:"signal,omitempty"`
Signal
int
`json:"signal,omitempty"`
Reason
string
`json:"reason,omitempty"`
Reason
string
`json:"reason,omitempty"`
Message
string
`json:"message,omitempty"`
Message
string
`json:"message,omitempty"`
StartedAt
u
til
.
Time
`json:"startedAt,omitempty"`
StartedAt
u
nversioned
.
Time
`json:"startedAt,omitempty"`
FinishedAt
u
til
.
Time
`json:"finishedAt,omitempty"`
FinishedAt
u
nversioned
.
Time
`json:"finishedAt,omitempty"`
ContainerID
string
`json:"containerID,omitempty"`
ContainerID
string
`json:"containerID,omitempty"`
}
}
...
@@ -980,7 +980,7 @@ type PodStatus struct {
...
@@ -980,7 +980,7 @@ type PodStatus struct {
// Date and time at which the object was acknowledged by the Kubelet.
// Date and time at which the object was acknowledged by the Kubelet.
// This is before the Kubelet pulled the container image(s) for the pod.
// This is before the Kubelet pulled the container image(s) for the pod.
StartTime
*
u
til
.
Time
`json:"startTime,omitempty"`
StartTime
*
u
nversioned
.
Time
`json:"startTime,omitempty"`
// The list has one entry per container in the manifest. Each entry is
// The list has one entry per container in the manifest. Each entry is
// currently the output of `docker inspect`. This output format is *not*
// currently the output of `docker inspect`. This output format is *not*
...
@@ -1415,8 +1415,8 @@ const (
...
@@ -1415,8 +1415,8 @@ const (
type
NodeCondition
struct
{
type
NodeCondition
struct
{
Type
NodeConditionType
`json:"type"`
Type
NodeConditionType
`json:"type"`
Status
ConditionStatus
`json:"status"`
Status
ConditionStatus
`json:"status"`
LastHeartbeatTime
u
til
.
Time
`json:"lastHeartbeatTime,omitempty"`
LastHeartbeatTime
u
nversioned
.
Time
`json:"lastHeartbeatTime,omitempty"`
LastTransitionTime
u
til
.
Time
`json:"lastTransitionTime,omitempty"`
LastTransitionTime
u
nversioned
.
Time
`json:"lastTransitionTime,omitempty"`
Reason
string
`json:"reason,omitempty"`
Reason
string
`json:"reason,omitempty"`
Message
string
`json:"message,omitempty"`
Message
string
`json:"message,omitempty"`
}
}
...
@@ -1693,10 +1693,10 @@ type Event struct {
...
@@ -1693,10 +1693,10 @@ type Event struct {
Source
EventSource
`json:"source,omitempty"`
Source
EventSource
`json:"source,omitempty"`
// The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)
// The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)
FirstTimestamp
u
til
.
Time
`json:"firstTimestamp,omitempty"`
FirstTimestamp
u
nversioned
.
Time
`json:"firstTimestamp,omitempty"`
// The time at which the most recent occurrence of this event was recorded.
// The time at which the most recent occurrence of this event was recorded.
LastTimestamp
u
til
.
Time
`json:"lastTimestamp,omitempty"`
LastTimestamp
u
nversioned
.
Time
`json:"lastTimestamp,omitempty"`
// The number of times this event has occurred.
// The number of times this event has occurred.
Count
int
`json:"count,omitempty"`
Count
int
`json:"count,omitempty"`
...
...
pkg/
util
/time.go
→
pkg/
api/unversioned
/time.go
View file @
586cb912
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
u
til
package
u
nversioned
import
(
import
(
"encoding/json"
"encoding/json"
...
...
pkg/
util
/time_test.go
→
pkg/
api/unversioned
/time_test.go
View file @
586cb912
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
u
til
package
u
nversioned
import
(
import
(
"encoding/json"
"encoding/json"
...
...
pkg/api/v1/deep_copy_generated.go
View file @
586cb912
...
@@ -52,6 +52,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
...
@@ -52,6 +52,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
return
nil
return
nil
}
}
func
deepCopy_unversioned_Time
(
in
unversioned
.
Time
,
out
*
unversioned
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
out
.
Kind
=
in
.
Kind
out
.
Kind
=
in
.
Kind
out
.
APIVersion
=
in
.
APIVersion
out
.
APIVersion
=
in
.
APIVersion
...
@@ -307,7 +316,7 @@ func deepCopy_v1_ContainerState(in ContainerState, out *ContainerState, c *conve
...
@@ -307,7 +316,7 @@ func deepCopy_v1_ContainerState(in ContainerState, out *ContainerState, c *conve
}
}
func
deepCopy_v1_ContainerStateRunning
(
in
ContainerStateRunning
,
out
*
ContainerStateRunning
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_v1_ContainerStateRunning
(
in
ContainerStateRunning
,
out
*
ContainerStateRunning
,
c
*
conversion
.
Cloner
)
error
{
if
err
:=
deepCopy_u
til
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
return
err
return
err
}
}
return
nil
return
nil
...
@@ -318,10 +327,10 @@ func deepCopy_v1_ContainerStateTerminated(in ContainerStateTerminated, out *Cont
...
@@ -318,10 +327,10 @@ func deepCopy_v1_ContainerStateTerminated(in ContainerStateTerminated, out *Cont
out
.
Signal
=
in
.
Signal
out
.
Signal
=
in
.
Signal
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
if
err
:=
deepCopy_u
til
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
StartedAt
,
&
out
.
StartedAt
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
FinishedAt
,
&
out
.
FinishedAt
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
FinishedAt
,
&
out
.
FinishedAt
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
ContainerID
=
in
.
ContainerID
out
.
ContainerID
=
in
.
ContainerID
...
@@ -530,10 +539,10 @@ func deepCopy_v1_Event(in Event, out *Event, c *conversion.Cloner) error {
...
@@ -530,10 +539,10 @@ func deepCopy_v1_Event(in Event, out *Event, c *conversion.Cloner) error {
if
err
:=
deepCopy_v1_EventSource
(
in
.
Source
,
&
out
.
Source
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_v1_EventSource
(
in
.
Source
,
&
out
.
Source
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
FirstTimestamp
,
&
out
.
FirstTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
FirstTimestamp
,
&
out
.
FirstTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastTimestamp
,
&
out
.
LastTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastTimestamp
,
&
out
.
LastTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Count
=
in
.
Count
out
.
Count
=
in
.
Count
...
@@ -924,10 +933,10 @@ func deepCopy_v1_NodeAddress(in NodeAddress, out *NodeAddress, c *conversion.Clo
...
@@ -924,10 +933,10 @@ func deepCopy_v1_NodeAddress(in NodeAddress, out *NodeAddress, c *conversion.Clo
func
deepCopy_v1_NodeCondition
(
in
NodeCondition
,
out
*
NodeCondition
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_v1_NodeCondition
(
in
NodeCondition
,
out
*
NodeCondition
,
c
*
conversion
.
Cloner
)
error
{
out
.
Type
=
in
.
Type
out
.
Type
=
in
.
Type
out
.
Status
=
in
.
Status
out
.
Status
=
in
.
Status
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastHeartbeatTime
,
&
out
.
LastHeartbeatTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastHeartbeatTime
,
&
out
.
LastHeartbeatTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
...
@@ -1039,12 +1048,12 @@ func deepCopy_v1_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Cloner
...
@@ -1039,12 +1048,12 @@ func deepCopy_v1_ObjectMeta(in ObjectMeta, out *ObjectMeta, c *conversion.Cloner
out
.
UID
=
in
.
UID
out
.
UID
=
in
.
UID
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
Generation
=
in
.
Generation
out
.
Generation
=
in
.
Generation
if
err
:=
deepCopy_u
til
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
in
.
DeletionTimestamp
!=
nil
{
if
in
.
DeletionTimestamp
!=
nil
{
out
.
DeletionTimestamp
=
new
(
u
til
.
Time
)
out
.
DeletionTimestamp
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -1494,8 +1503,8 @@ func deepCopy_v1_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) e
...
@@ -1494,8 +1503,8 @@ func deepCopy_v1_PodStatus(in PodStatus, out *PodStatus, c *conversion.Cloner) e
out
.
HostIP
=
in
.
HostIP
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
PodIP
=
in
.
PodIP
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
out
.
StartTime
=
new
(
u
til
.
Time
)
out
.
StartTime
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -2194,19 +2203,11 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
...
@@ -2194,19 +2203,11 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
return
nil
return
nil
}
}
func
deepCopy_util_Time
(
in
util
.
Time
,
out
*
util
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
init
()
{
func
init
()
{
err
:=
api
.
Scheme
.
AddGeneratedDeepCopyFuncs
(
err
:=
api
.
Scheme
.
AddGeneratedDeepCopyFuncs
(
deepCopy_resource_Quantity
,
deepCopy_resource_Quantity
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_Time
,
deepCopy_unversioned_TypeMeta
,
deepCopy_unversioned_TypeMeta
,
deepCopy_v1_AWSElasticBlockStoreVolumeSource
,
deepCopy_v1_AWSElasticBlockStoreVolumeSource
,
deepCopy_v1_Binding
,
deepCopy_v1_Binding
,
...
@@ -2326,7 +2327,6 @@ func init() {
...
@@ -2326,7 +2327,6 @@ func init() {
deepCopy_v1_VolumeSource
,
deepCopy_v1_VolumeSource
,
deepCopy_runtime_RawExtension
,
deepCopy_runtime_RawExtension
,
deepCopy_util_IntOrString
,
deepCopy_util_IntOrString
,
deepCopy_util_Time
,
)
)
if
err
!=
nil
{
if
err
!=
nil
{
// if one of the deep copy functions is malformed, detect it immediately.
// if one of the deep copy functions is malformed, detect it immediately.
...
...
pkg/api/v1/types.go
View file @
586cb912
...
@@ -141,7 +141,7 @@ type ObjectMeta struct {
...
@@ -141,7 +141,7 @@ type ObjectMeta struct {
// Read-only.
// Read-only.
// Null for lists.
// Null for lists.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
CreationTimestamp
u
til
.
Time
`json:"creationTimestamp,omitempty"`
CreationTimestamp
u
nversioned
.
Time
`json:"creationTimestamp,omitempty"`
// DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This
// DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This
// field is set by the server when a graceful deletion is requested by the user, and is not
// field is set by the server when a graceful deletion is requested by the user, and is not
...
@@ -157,7 +157,7 @@ type ObjectMeta struct {
...
@@ -157,7 +157,7 @@ type ObjectMeta struct {
// Populated by the system when a graceful deletion is requested.
// Populated by the system when a graceful deletion is requested.
// Read-only.
// Read-only.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
DeletionTimestamp
*
u
til
.
Time
`json:"deletionTimestamp,omitempty"`
DeletionTimestamp
*
u
nversioned
.
Time
`json:"deletionTimestamp,omitempty"`
// Number of seconds allowed for this object to gracefully terminate before
// Number of seconds allowed for this object to gracefully terminate before
// it will be removed from the system. Only set when deletionTimestamp is also set.
// it will be removed from the system. Only set when deletionTimestamp is also set.
...
@@ -1008,7 +1008,7 @@ type ContainerStateWaiting struct {
...
@@ -1008,7 +1008,7 @@ type ContainerStateWaiting struct {
// ContainerStateRunning is a running state of a container.
// ContainerStateRunning is a running state of a container.
type
ContainerStateRunning
struct
{
type
ContainerStateRunning
struct
{
// Time at which the container was last (re-)started
// Time at which the container was last (re-)started
StartedAt
u
til
.
Time
`json:"startedAt,omitempty"`
StartedAt
u
nversioned
.
Time
`json:"startedAt,omitempty"`
}
}
// ContainerStateTerminated is a terminated state of a container.
// ContainerStateTerminated is a terminated state of a container.
...
@@ -1022,9 +1022,9 @@ type ContainerStateTerminated struct {
...
@@ -1022,9 +1022,9 @@ type ContainerStateTerminated struct {
// Message regarding the last termination of the container
// Message regarding the last termination of the container
Message
string
`json:"message,omitempty"`
Message
string
`json:"message,omitempty"`
// Time at which previous execution of the container started
// Time at which previous execution of the container started
StartedAt
u
til
.
Time
`json:"startedAt,omitempty"`
StartedAt
u
nversioned
.
Time
`json:"startedAt,omitempty"`
// Time at which the container last terminated
// Time at which the container last terminated
FinishedAt
u
til
.
Time
`json:"finishedAt,omitempty"`
FinishedAt
u
nversioned
.
Time
`json:"finishedAt,omitempty"`
// Container's ID in the format 'docker://<container_id>'
// Container's ID in the format 'docker://<container_id>'
ContainerID
string
`json:"containerID,omitempty"`
ContainerID
string
`json:"containerID,omitempty"`
}
}
...
@@ -1227,7 +1227,7 @@ type PodStatus struct {
...
@@ -1227,7 +1227,7 @@ type PodStatus struct {
// RFC 3339 date and time at which the object was acknowledged by the Kubelet.
// RFC 3339 date and time at which the object was acknowledged by the Kubelet.
// This is before the Kubelet pulled the container image(s) for the pod.
// This is before the Kubelet pulled the container image(s) for the pod.
StartTime
*
u
til
.
Time
`json:"startTime,omitempty"`
StartTime
*
u
nversioned
.
Time
`json:"startTime,omitempty"`
// The list has one entry per container in the manifest. Each entry is currently the output
// The list has one entry per container in the manifest. Each entry is currently the output
// of `docker inspect`.
// of `docker inspect`.
...
@@ -1774,9 +1774,9 @@ type NodeCondition struct {
...
@@ -1774,9 +1774,9 @@ type NodeCondition struct {
// Status of the condition, one of True, False, Unknown.
// Status of the condition, one of True, False, Unknown.
Status
ConditionStatus
`json:"status"`
Status
ConditionStatus
`json:"status"`
// Last time we got an update on a given condition.
// Last time we got an update on a given condition.
LastHeartbeatTime
u
til
.
Time
`json:"lastHeartbeatTime,omitempty"`
LastHeartbeatTime
u
nversioned
.
Time
`json:"lastHeartbeatTime,omitempty"`
// Last time the condition transit from one status to another.
// Last time the condition transit from one status to another.
LastTransitionTime
u
til
.
Time
`json:"lastTransitionTime,omitempty"`
LastTransitionTime
u
nversioned
.
Time
`json:"lastTransitionTime,omitempty"`
// (brief) reason for the condition's last transition.
// (brief) reason for the condition's last transition.
Reason
string
`json:"reason,omitempty"`
Reason
string
`json:"reason,omitempty"`
// Human readable message indicating details about last transition.
// Human readable message indicating details about last transition.
...
@@ -2110,10 +2110,10 @@ type Event struct {
...
@@ -2110,10 +2110,10 @@ type Event struct {
Source
EventSource
`json:"source,omitempty"`
Source
EventSource
`json:"source,omitempty"`
// The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)
// The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)
FirstTimestamp
u
til
.
Time
`json:"firstTimestamp,omitempty"`
FirstTimestamp
u
nversioned
.
Time
`json:"firstTimestamp,omitempty"`
// The time at which the most recent occurrence of this event was recorded.
// The time at which the most recent occurrence of this event was recorded.
LastTimestamp
u
til
.
Time
`json:"lastTimestamp,omitempty"`
LastTimestamp
u
nversioned
.
Time
`json:"lastTimestamp,omitempty"`
// The number of times this event has occurred.
// The number of times this event has occurred.
Count
int
`json:"count,omitempty"`
Count
int
`json:"count,omitempty"`
...
...
pkg/api/validation/validation_test.go
View file @
586cb912
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
utilerrors
"k8s.io/kubernetes/pkg/util/errors"
utilerrors
"k8s.io/kubernetes/pkg/util/errors"
...
@@ -88,19 +89,19 @@ func TestValidateObjectMetaNamespaces(t *testing.T) {
...
@@ -88,19 +89,19 @@ func TestValidateObjectMetaNamespaces(t *testing.T) {
func
TestValidateObjectMetaUpdateIgnoresCreationTimestamp
(
t
*
testing
.
T
)
{
func
TestValidateObjectMetaUpdateIgnoresCreationTimestamp
(
t
*
testing
.
T
)
{
if
errs
:=
ValidateObjectMetaUpdate
(
if
errs
:=
ValidateObjectMetaUpdate
(
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
til
.
NewTime
(
time
.
Unix
(
10
,
0
))},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
nversioned
.
NewTime
(
time
.
Unix
(
10
,
0
))},
);
len
(
errs
)
!=
0
{
);
len
(
errs
)
!=
0
{
t
.
Fatalf
(
"unexpected errors: %v"
,
errs
)
t
.
Fatalf
(
"unexpected errors: %v"
,
errs
)
}
}
if
errs
:=
ValidateObjectMetaUpdate
(
if
errs
:=
ValidateObjectMetaUpdate
(
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
til
.
NewTime
(
time
.
Unix
(
10
,
0
))},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
nversioned
.
NewTime
(
time
.
Unix
(
10
,
0
))},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
},
);
len
(
errs
)
!=
0
{
);
len
(
errs
)
!=
0
{
t
.
Fatalf
(
"unexpected errors: %v"
,
errs
)
t
.
Fatalf
(
"unexpected errors: %v"
,
errs
)
}
}
if
errs
:=
ValidateObjectMetaUpdate
(
if
errs
:=
ValidateObjectMetaUpdate
(
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
til
.
NewTime
(
time
.
Unix
(
10
,
0
))},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
nversioned
.
NewTime
(
time
.
Unix
(
10
,
0
))},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
til
.
NewTime
(
time
.
Unix
(
11
,
0
))},
&
api
.
ObjectMeta
{
Name
:
"test"
,
ResourceVersion
:
"1"
,
CreationTimestamp
:
u
nversioned
.
NewTime
(
time
.
Unix
(
11
,
0
))},
);
len
(
errs
)
!=
0
{
);
len
(
errs
)
!=
0
{
t
.
Fatalf
(
"unexpected errors: %v"
,
errs
)
t
.
Fatalf
(
"unexpected errors: %v"
,
errs
)
}
}
...
@@ -1401,7 +1402,7 @@ func TestValidatePod(t *testing.T) {
...
@@ -1401,7 +1402,7 @@ func TestValidatePod(t *testing.T) {
}
}
func
TestValidatePodUpdate
(
t
*
testing
.
T
)
{
func
TestValidatePodUpdate
(
t
*
testing
.
T
)
{
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
grace
:=
int64
(
30
)
grace
:=
int64
(
30
)
grace2
:=
int64
(
31
)
grace2
:=
int64
(
31
)
tests
:=
[]
struct
{
tests
:=
[]
struct
{
...
@@ -3251,7 +3252,7 @@ func TestValidateNamespaceFinalizeUpdate(t *testing.T) {
...
@@ -3251,7 +3252,7 @@ func TestValidateNamespaceFinalizeUpdate(t *testing.T) {
}
}
func
TestValidateNamespaceStatusUpdate
(
t
*
testing
.
T
)
{
func
TestValidateNamespaceStatusUpdate
(
t
*
testing
.
T
)
{
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
tests
:=
[]
struct
{
tests
:=
[]
struct
{
oldNamespace
api
.
Namespace
oldNamespace
api
.
Namespace
...
...
pkg/apis/experimental/deep_copy_generated.go
View file @
586cb912
...
@@ -372,12 +372,12 @@ func deepCopy_api_ObjectMeta(in api.ObjectMeta, out *api.ObjectMeta, c *conversi
...
@@ -372,12 +372,12 @@ func deepCopy_api_ObjectMeta(in api.ObjectMeta, out *api.ObjectMeta, c *conversi
out
.
UID
=
in
.
UID
out
.
UID
=
in
.
UID
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
Generation
=
in
.
Generation
out
.
Generation
=
in
.
Generation
if
err
:=
deepCopy_u
til
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
in
.
DeletionTimestamp
!=
nil
{
if
in
.
DeletionTimestamp
!=
nil
{
out
.
DeletionTimestamp
=
new
(
u
til
.
Time
)
out
.
DeletionTimestamp
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -753,6 +753,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
...
@@ -753,6 +753,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
return
nil
return
nil
}
}
func
deepCopy_unversioned_Time
(
in
unversioned
.
Time
,
out
*
unversioned
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
out
.
Kind
=
in
.
Kind
out
.
Kind
=
in
.
Kind
out
.
APIVersion
=
in
.
APIVersion
out
.
APIVersion
=
in
.
APIVersion
...
@@ -978,8 +987,8 @@ func deepCopy_experimental_HorizontalPodAutoscalerStatus(in HorizontalPodAutosca
...
@@ -978,8 +987,8 @@ func deepCopy_experimental_HorizontalPodAutoscalerStatus(in HorizontalPodAutosca
out
.
CurrentConsumption
=
nil
out
.
CurrentConsumption
=
nil
}
}
if
in
.
LastScaleTimestamp
!=
nil
{
if
in
.
LastScaleTimestamp
!=
nil
{
out
.
LastScaleTimestamp
=
new
(
u
til
.
Time
)
out
.
LastScaleTimestamp
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
LastScaleTimestamp
,
out
.
LastScaleTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
LastScaleTimestamp
,
out
.
LastScaleTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -1007,10 +1016,10 @@ func deepCopy_experimental_Job(in Job, out *Job, c *conversion.Cloner) error {
...
@@ -1007,10 +1016,10 @@ func deepCopy_experimental_Job(in Job, out *Job, c *conversion.Cloner) error {
func
deepCopy_experimental_JobCondition
(
in
JobCondition
,
out
*
JobCondition
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_experimental_JobCondition
(
in
JobCondition
,
out
*
JobCondition
,
c
*
conversion
.
Cloner
)
error
{
out
.
Type
=
in
.
Type
out
.
Type
=
in
.
Type
out
.
Status
=
in
.
Status
out
.
Status
=
in
.
Status
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
...
@@ -1082,16 +1091,16 @@ func deepCopy_experimental_JobStatus(in JobStatus, out *JobStatus, c *conversion
...
@@ -1082,16 +1091,16 @@ func deepCopy_experimental_JobStatus(in JobStatus, out *JobStatus, c *conversion
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
out
.
StartTime
=
new
(
u
til
.
Time
)
out
.
StartTime
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
out
.
StartTime
=
nil
out
.
StartTime
=
nil
}
}
if
in
.
CompletionTime
!=
nil
{
if
in
.
CompletionTime
!=
nil
{
out
.
CompletionTime
=
new
(
u
til
.
Time
)
out
.
CompletionTime
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
CompletionTime
,
out
.
CompletionTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
CompletionTime
,
out
.
CompletionTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -1258,15 +1267,6 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
...
@@ -1258,15 +1267,6 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
return
nil
return
nil
}
}
func
deepCopy_util_Time
(
in
util
.
Time
,
out
*
util
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
init
()
{
func
init
()
{
err
:=
api
.
Scheme
.
AddGeneratedDeepCopyFuncs
(
err
:=
api
.
Scheme
.
AddGeneratedDeepCopyFuncs
(
deepCopy_api_AWSElasticBlockStoreVolumeSource
,
deepCopy_api_AWSElasticBlockStoreVolumeSource
,
...
@@ -1308,6 +1308,7 @@ func init() {
...
@@ -1308,6 +1308,7 @@ func init() {
deepCopy_api_VolumeSource
,
deepCopy_api_VolumeSource
,
deepCopy_resource_Quantity
,
deepCopy_resource_Quantity
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_Time
,
deepCopy_unversioned_TypeMeta
,
deepCopy_unversioned_TypeMeta
,
deepCopy_experimental_APIVersion
,
deepCopy_experimental_APIVersion
,
deepCopy_experimental_DaemonSet
,
deepCopy_experimental_DaemonSet
,
...
@@ -1340,7 +1341,6 @@ func init() {
...
@@ -1340,7 +1341,6 @@ func init() {
deepCopy_experimental_ThirdPartyResourceDataList
,
deepCopy_experimental_ThirdPartyResourceDataList
,
deepCopy_experimental_ThirdPartyResourceList
,
deepCopy_experimental_ThirdPartyResourceList
,
deepCopy_util_IntOrString
,
deepCopy_util_IntOrString
,
deepCopy_util_Time
,
)
)
if
err
!=
nil
{
if
err
!=
nil
{
// if one of the deep copy functions is malformed, detect it immediately.
// if one of the deep copy functions is malformed, detect it immediately.
...
...
pkg/apis/experimental/types.go
View file @
586cb912
...
@@ -118,7 +118,7 @@ type HorizontalPodAutoscalerStatus struct {
...
@@ -118,7 +118,7 @@ type HorizontalPodAutoscalerStatus struct {
// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
// This is used by the autoscaler to controll how often the number of pods is changed.
// This is used by the autoscaler to controll how often the number of pods is changed.
LastScaleTimestamp
*
u
til
.
Time
`json:"lastScaleTimestamp,omitempty"`
LastScaleTimestamp
*
u
nversioned
.
Time
`json:"lastScaleTimestamp,omitempty"`
}
}
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
...
@@ -421,12 +421,12 @@ type JobStatus struct {
...
@@ -421,12 +421,12 @@ type JobStatus struct {
// StartTime represents time when the job was acknowledged by the Job Manager.
// StartTime represents time when the job was acknowledged by the Job Manager.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// It is represented in RFC3339 form and is in UTC.
StartTime
*
u
til
.
Time
`json:"startTime,omitempty"`
StartTime
*
u
nversioned
.
Time
`json:"startTime,omitempty"`
// CompletionTime represents time when the job was completed. It is not guaranteed to
// CompletionTime represents time when the job was completed. It is not guaranteed to
// be set in happens-before order across separate operations.
// be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// It is represented in RFC3339 form and is in UTC.
CompletionTime
*
u
til
.
Time
`json:"completionTime,omitempty"`
CompletionTime
*
u
nversioned
.
Time
`json:"completionTime,omitempty"`
// Active is the number of actively running pods.
// Active is the number of actively running pods.
Active
int
`json:"active,omitempty"`
Active
int
`json:"active,omitempty"`
...
@@ -454,9 +454,9 @@ type JobCondition struct {
...
@@ -454,9 +454,9 @@ type JobCondition struct {
// Status of the condition, one of True, False, Unknown.
// Status of the condition, one of True, False, Unknown.
Status
api
.
ConditionStatus
`json:"status"`
Status
api
.
ConditionStatus
`json:"status"`
// Last time the condition was checked.
// Last time the condition was checked.
LastProbeTime
u
til
.
Time
`json:"lastProbeTime,omitempty"`
LastProbeTime
u
nversioned
.
Time
`json:"lastProbeTime,omitempty"`
// Last time the condition transit from one status to another.
// Last time the condition transit from one status to another.
LastTransitionTime
u
til
.
Time
`json:"lastTransitionTime,omitempty"`
LastTransitionTime
u
nversioned
.
Time
`json:"lastTransitionTime,omitempty"`
// (brief) reason for the condition's last transition.
// (brief) reason for the condition's last transition.
Reason
string
`json:"reason,omitempty"`
Reason
string
`json:"reason,omitempty"`
// Human readable message indicating details about last transition.
// Human readable message indicating details about last transition.
...
...
pkg/apis/experimental/v1/deep_copy_generated.go
View file @
586cb912
...
@@ -52,6 +52,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
...
@@ -52,6 +52,15 @@ func deepCopy_unversioned_ListMeta(in unversioned.ListMeta, out *unversioned.Lis
return
nil
return
nil
}
}
func
deepCopy_unversioned_Time
(
in
unversioned
.
Time
,
out
*
unversioned
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_unversioned_TypeMeta
(
in
unversioned
.
TypeMeta
,
out
*
unversioned
.
TypeMeta
,
c
*
conversion
.
Cloner
)
error
{
out
.
Kind
=
in
.
Kind
out
.
Kind
=
in
.
Kind
out
.
APIVersion
=
in
.
APIVersion
out
.
APIVersion
=
in
.
APIVersion
...
@@ -401,12 +410,12 @@ func deepCopy_v1_ObjectMeta(in v1.ObjectMeta, out *v1.ObjectMeta, c *conversion.
...
@@ -401,12 +410,12 @@ func deepCopy_v1_ObjectMeta(in v1.ObjectMeta, out *v1.ObjectMeta, c *conversion.
out
.
UID
=
in
.
UID
out
.
UID
=
in
.
UID
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
ResourceVersion
=
in
.
ResourceVersion
out
.
Generation
=
in
.
Generation
out
.
Generation
=
in
.
Generation
if
err
:=
deepCopy_u
til
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
CreationTimestamp
,
&
out
.
CreationTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
in
.
DeletionTimestamp
!=
nil
{
if
in
.
DeletionTimestamp
!=
nil
{
out
.
DeletionTimestamp
=
new
(
u
til
.
Time
)
out
.
DeletionTimestamp
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
DeletionTimestamp
,
out
.
DeletionTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -990,8 +999,8 @@ func deepCopy_v1_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerStatus,
...
@@ -990,8 +999,8 @@ func deepCopy_v1_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerStatus,
out
.
CurrentConsumption
=
nil
out
.
CurrentConsumption
=
nil
}
}
if
in
.
LastScaleTimestamp
!=
nil
{
if
in
.
LastScaleTimestamp
!=
nil
{
out
.
LastScaleTimestamp
=
new
(
u
til
.
Time
)
out
.
LastScaleTimestamp
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
LastScaleTimestamp
,
out
.
LastScaleTimestamp
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
LastScaleTimestamp
,
out
.
LastScaleTimestamp
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -1019,10 +1028,10 @@ func deepCopy_v1_Job(in Job, out *Job, c *conversion.Cloner) error {
...
@@ -1019,10 +1028,10 @@ func deepCopy_v1_Job(in Job, out *Job, c *conversion.Cloner) error {
func
deepCopy_v1_JobCondition
(
in
JobCondition
,
out
*
JobCondition
,
c
*
conversion
.
Cloner
)
error
{
func
deepCopy_v1_JobCondition
(
in
JobCondition
,
out
*
JobCondition
,
c
*
conversion
.
Cloner
)
error
{
out
.
Type
=
in
.
Type
out
.
Type
=
in
.
Type
out
.
Status
=
in
.
Status
out
.
Status
=
in
.
Status
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastProbeTime
,
&
out
.
LastProbeTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
deepCopy_u
til
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
in
.
LastTransitionTime
,
&
out
.
LastTransitionTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
...
@@ -1094,16 +1103,16 @@ func deepCopy_v1_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner) e
...
@@ -1094,16 +1103,16 @@ func deepCopy_v1_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner) e
out
.
Conditions
=
nil
out
.
Conditions
=
nil
}
}
if
in
.
StartTime
!=
nil
{
if
in
.
StartTime
!=
nil
{
out
.
StartTime
=
new
(
u
til
.
Time
)
out
.
StartTime
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
StartTime
,
out
.
StartTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
out
.
StartTime
=
nil
out
.
StartTime
=
nil
}
}
if
in
.
CompletionTime
!=
nil
{
if
in
.
CompletionTime
!=
nil
{
out
.
CompletionTime
=
new
(
u
til
.
Time
)
out
.
CompletionTime
=
new
(
u
nversioned
.
Time
)
if
err
:=
deepCopy_u
til
_Time
(
*
in
.
CompletionTime
,
out
.
CompletionTime
,
c
);
err
!=
nil
{
if
err
:=
deepCopy_u
nversioned
_Time
(
*
in
.
CompletionTime
,
out
.
CompletionTime
,
c
);
err
!=
nil
{
return
err
return
err
}
}
}
else
{
}
else
{
...
@@ -1280,19 +1289,11 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
...
@@ -1280,19 +1289,11 @@ func deepCopy_util_IntOrString(in util.IntOrString, out *util.IntOrString, c *co
return
nil
return
nil
}
}
func
deepCopy_util_Time
(
in
util
.
Time
,
out
*
util
.
Time
,
c
*
conversion
.
Cloner
)
error
{
if
newVal
,
err
:=
c
.
DeepCopy
(
in
.
Time
);
err
!=
nil
{
return
err
}
else
{
out
.
Time
=
newVal
.
(
time
.
Time
)
}
return
nil
}
func
init
()
{
func
init
()
{
err
:=
api
.
Scheme
.
AddGeneratedDeepCopyFuncs
(
err
:=
api
.
Scheme
.
AddGeneratedDeepCopyFuncs
(
deepCopy_resource_Quantity
,
deepCopy_resource_Quantity
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_ListMeta
,
deepCopy_unversioned_Time
,
deepCopy_unversioned_TypeMeta
,
deepCopy_unversioned_TypeMeta
,
deepCopy_v1_AWSElasticBlockStoreVolumeSource
,
deepCopy_v1_AWSElasticBlockStoreVolumeSource
,
deepCopy_v1_Capabilities
,
deepCopy_v1_Capabilities
,
...
@@ -1362,7 +1363,6 @@ func init() {
...
@@ -1362,7 +1363,6 @@ func init() {
deepCopy_v1_ThirdPartyResourceDataList
,
deepCopy_v1_ThirdPartyResourceDataList
,
deepCopy_v1_ThirdPartyResourceList
,
deepCopy_v1_ThirdPartyResourceList
,
deepCopy_util_IntOrString
,
deepCopy_util_IntOrString
,
deepCopy_util_Time
,
)
)
if
err
!=
nil
{
if
err
!=
nil
{
// if one of the deep copy functions is malformed, detect it immediately.
// if one of the deep copy functions is malformed, detect it immediately.
...
...
pkg/apis/experimental/v1/types.go
View file @
586cb912
...
@@ -107,7 +107,7 @@ type HorizontalPodAutoscalerStatus struct {
...
@@ -107,7 +107,7 @@ type HorizontalPodAutoscalerStatus struct {
// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
// This is used by the autoscaler to controll how often the number of pods is changed.
// This is used by the autoscaler to controll how often the number of pods is changed.
LastScaleTimestamp
*
u
til
.
Time
`json:"lastScaleTimestamp,omitempty"`
LastScaleTimestamp
*
u
nversioned
.
Time
`json:"lastScaleTimestamp,omitempty"`
}
}
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
...
@@ -422,12 +422,12 @@ type JobStatus struct {
...
@@ -422,12 +422,12 @@ type JobStatus struct {
// StartTime represents time when the job was acknowledged by the Job Manager.
// StartTime represents time when the job was acknowledged by the Job Manager.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// It is represented in RFC3339 form and is in UTC.
StartTime
*
u
til
.
Time
`json:"startTime,omitempty"`
StartTime
*
u
nversioned
.
Time
`json:"startTime,omitempty"`
// CompletionTime represents time when the job was completed. It is not guaranteed to
// CompletionTime represents time when the job was completed. It is not guaranteed to
// be set in happens-before order across separate operations.
// be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// It is represented in RFC3339 form and is in UTC.
CompletionTime
*
u
til
.
Time
`json:"completionTime,omitempty"`
CompletionTime
*
u
nversioned
.
Time
`json:"completionTime,omitempty"`
// Active is the number of actively running pods.
// Active is the number of actively running pods.
Active
int
`json:"active,omitempty"`
Active
int
`json:"active,omitempty"`
...
@@ -455,9 +455,9 @@ type JobCondition struct {
...
@@ -455,9 +455,9 @@ type JobCondition struct {
// Status of the condition, one of True, False, Unknown.
// Status of the condition, one of True, False, Unknown.
Status
v1
.
ConditionStatus
`json:"status"`
Status
v1
.
ConditionStatus
`json:"status"`
// Last time the condition was checked.
// Last time the condition was checked.
LastProbeTime
u
til
.
Time
`json:"lastProbeTime,omitempty"`
LastProbeTime
u
nversioned
.
Time
`json:"lastProbeTime,omitempty"`
// Last time the condition transit from one status to another.
// Last time the condition transit from one status to another.
LastTransitionTime
u
til
.
Time
`json:"lastTransitionTime,omitempty"`
LastTransitionTime
u
nversioned
.
Time
`json:"lastTransitionTime,omitempty"`
// (brief) reason for the condition's last transition.
// (brief) reason for the condition's last transition.
Reason
string
`json:"reason,omitempty"`
Reason
string
`json:"reason,omitempty"`
// Human readable message indicating details about last transition.
// Human readable message indicating details about last transition.
...
...
pkg/apiserver/api_installer.go
View file @
586cb912
...
@@ -826,7 +826,7 @@ func typeToJSON(typeName string) string {
...
@@ -826,7 +826,7 @@ func typeToJSON(typeName string) string {
return
"string"
return
"string"
case
"float64"
,
"float32"
:
case
"float64"
,
"float32"
:
return
"number"
return
"number"
case
"u
til
.Time"
:
case
"u
nversioned
.Time"
:
return
"string"
return
"string"
default
:
default
:
return
typeName
return
typeName
...
...
pkg/apiserver/authz.go
View file @
586cb912
...
@@ -19,6 +19,7 @@ package apiserver
...
@@ -19,6 +19,7 @@ package apiserver
import
(
import
(
"errors"
"errors"
"fmt"
"fmt"
"k8s.io/kubernetes/pkg/auth/authorizer"
"k8s.io/kubernetes/pkg/auth/authorizer"
"k8s.io/kubernetes/pkg/auth/authorizer/abac"
"k8s.io/kubernetes/pkg/auth/authorizer/abac"
"k8s.io/kubernetes/pkg/auth/authorizer/union"
"k8s.io/kubernetes/pkg/auth/authorizer/union"
...
...
pkg/client/cache/expiration_cache.go
View file @
586cb912
...
@@ -17,9 +17,10 @@ limitations under the License.
...
@@ -17,9 +17,10 @@ limitations under the License.
package
cache
package
cache
import
(
import
(
"time"
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"time"
)
)
// ExpirationCache implements the store interface
// ExpirationCache implements the store interface
...
...
pkg/client/record/event.go
View file @
586cb912
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
...
@@ -64,7 +65,7 @@ type EventRecorder interface {
...
@@ -64,7 +65,7 @@ type EventRecorder interface {
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
// PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field.
// PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field.
PastEventf
(
object
runtime
.
Object
,
timestamp
u
til
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
PastEventf
(
object
runtime
.
Object
,
timestamp
u
nversioned
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
}
}
// EventBroadcaster knows how to receive events and send them to any EventSink, watcher, or log.
// EventBroadcaster knows how to receive events and send them to any EventSink, watcher, or log.
...
@@ -238,7 +239,7 @@ type recorderImpl struct {
...
@@ -238,7 +239,7 @@ type recorderImpl struct {
*
watch
.
Broadcaster
*
watch
.
Broadcaster
}
}
func
(
recorder
*
recorderImpl
)
generateEvent
(
object
runtime
.
Object
,
timestamp
u
til
.
Time
,
reason
,
message
string
)
{
func
(
recorder
*
recorderImpl
)
generateEvent
(
object
runtime
.
Object
,
timestamp
u
nversioned
.
Time
,
reason
,
message
string
)
{
ref
,
err
:=
api
.
GetReference
(
object
)
ref
,
err
:=
api
.
GetReference
(
object
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v'"
,
object
,
err
,
reason
,
message
)
glog
.
Errorf
(
"Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v'"
,
object
,
err
,
reason
,
message
)
...
@@ -252,19 +253,19 @@ func (recorder *recorderImpl) generateEvent(object runtime.Object, timestamp uti
...
@@ -252,19 +253,19 @@ func (recorder *recorderImpl) generateEvent(object runtime.Object, timestamp uti
}
}
func
(
recorder
*
recorderImpl
)
Event
(
object
runtime
.
Object
,
reason
,
message
string
)
{
func
(
recorder
*
recorderImpl
)
Event
(
object
runtime
.
Object
,
reason
,
message
string
)
{
recorder
.
generateEvent
(
object
,
u
til
.
Now
(),
reason
,
message
)
recorder
.
generateEvent
(
object
,
u
nversioned
.
Now
(),
reason
,
message
)
}
}
func
(
recorder
*
recorderImpl
)
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
(
recorder
*
recorderImpl
)
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
recorder
.
Event
(
object
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
))
recorder
.
Event
(
object
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
))
}
}
func
(
recorder
*
recorderImpl
)
PastEventf
(
object
runtime
.
Object
,
timestamp
u
til
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
(
recorder
*
recorderImpl
)
PastEventf
(
object
runtime
.
Object
,
timestamp
u
nversioned
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
recorder
.
generateEvent
(
object
,
timestamp
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
))
recorder
.
generateEvent
(
object
,
timestamp
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
))
}
}
func
makeEvent
(
ref
*
api
.
ObjectReference
,
reason
,
message
string
)
*
api
.
Event
{
func
makeEvent
(
ref
*
api
.
ObjectReference
,
reason
,
message
string
)
*
api
.
Event
{
t
:=
u
til
.
Now
()
t
:=
u
nversioned
.
Now
()
namespace
:=
ref
.
Namespace
namespace
:=
ref
.
Namespace
if
namespace
==
""
{
if
namespace
==
""
{
namespace
=
api
.
NamespaceDefault
namespace
=
api
.
NamespaceDefault
...
...
pkg/client/record/events_cache.go
View file @
586cb912
...
@@ -21,7 +21,7 @@ import (
...
@@ -21,7 +21,7 @@ import (
"github.com/golang/groupcache/lru"
"github.com/golang/groupcache/lru"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/
util
"
"k8s.io/kubernetes/pkg/
api/unversioned
"
)
)
type
history
struct
{
type
history
struct
{
...
@@ -29,7 +29,7 @@ type history struct {
...
@@ -29,7 +29,7 @@ type history struct {
Count
int
Count
int
// The time at which the event was first recorded.
// The time at which the event was first recorded.
FirstTimestamp
u
til
.
Time
FirstTimestamp
u
nversioned
.
Time
// The unique name of the first occurrence of this event
// The unique name of the first occurrence of this event
Name
string
Name
string
...
...
pkg/client/record/events_cache_test.go
View file @
586cb912
...
@@ -20,12 +20,12 @@ import (
...
@@ -20,12 +20,12 @@ import (
"testing"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/
util
"
"k8s.io/kubernetes/pkg/
api/unversioned
"
)
)
func
TestAddOrUpdateEventNoExisting
(
t
*
testing
.
T
)
{
func
TestAddOrUpdateEventNoExisting
(
t
*
testing
.
T
)
{
// Arrange
// Arrange
eventTime
:=
u
til
.
Now
()
eventTime
:=
u
nversioned
.
Now
()
event
:=
api
.
Event
{
event
:=
api
.
Event
{
Reason
:
"my reasons are many"
,
Reason
:
"my reasons are many"
,
Message
:
"my message is love"
,
Message
:
"my message is love"
,
...
@@ -54,8 +54,8 @@ func TestAddOrUpdateEventNoExisting(t *testing.T) {
...
@@ -54,8 +54,8 @@ func TestAddOrUpdateEventNoExisting(t *testing.T) {
func
TestAddOrUpdateEventExisting
(
t
*
testing
.
T
)
{
func
TestAddOrUpdateEventExisting
(
t
*
testing
.
T
)
{
// Arrange
// Arrange
event1Time
:=
u
til
.
Unix
(
2324
,
2342
)
event1Time
:=
u
nversioned
.
Unix
(
2324
,
2342
)
event2Time
:=
u
til
.
Now
()
event2Time
:=
u
nversioned
.
Now
()
event1
:=
api
.
Event
{
event1
:=
api
.
Event
{
Reason
:
"something happened"
,
Reason
:
"something happened"
,
Message
:
"can you believe it?"
,
Message
:
"can you believe it?"
,
...
@@ -139,7 +139,7 @@ func TestGetEventNoExisting(t *testing.T) {
...
@@ -139,7 +139,7 @@ func TestGetEventNoExisting(t *testing.T) {
func
TestGetEventExisting
(
t
*
testing
.
T
)
{
func
TestGetEventExisting
(
t
*
testing
.
T
)
{
// Arrange
// Arrange
eventTime
:=
u
til
.
Now
()
eventTime
:=
u
nversioned
.
Now
()
event
:=
api
.
Event
{
event
:=
api
.
Event
{
Reason
:
"do I exist"
,
Reason
:
"do I exist"
,
Message
:
"I do, oh my"
,
Message
:
"I do, oh my"
,
...
...
pkg/client/record/fake.go
View file @
586cb912
...
@@ -19,8 +19,8 @@ package record
...
@@ -19,8 +19,8 @@ package record
import
(
import
(
"fmt"
"fmt"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
)
// FakeRecorder is used as a fake during tests.
// FakeRecorder is used as a fake during tests.
...
@@ -36,5 +36,5 @@ func (f *FakeRecorder) Eventf(object runtime.Object, reason, messageFmt string,
...
@@ -36,5 +36,5 @@ func (f *FakeRecorder) Eventf(object runtime.Object, reason, messageFmt string,
f
.
Events
=
append
(
f
.
Events
,
fmt
.
Sprintf
(
reason
+
" "
+
messageFmt
,
args
...
))
f
.
Events
=
append
(
f
.
Events
,
fmt
.
Sprintf
(
reason
+
" "
+
messageFmt
,
args
...
))
}
}
func
(
f
*
FakeRecorder
)
PastEventf
(
object
runtime
.
Object
,
timestamp
u
til
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
(
f
*
FakeRecorder
)
PastEventf
(
object
runtime
.
Object
,
timestamp
u
nversioned
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
}
}
pkg/client/unversioned/events_test.go
View file @
586cb912
...
@@ -23,9 +23,9 @@ import (
...
@@ -23,9 +23,9 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util"
)
)
func
TestEventSearch
(
t
*
testing
.
T
)
{
func
TestEventSearch
(
t
*
testing
.
T
)
{
...
@@ -65,7 +65,7 @@ func TestEventCreate(t *testing.T) {
...
@@ -65,7 +65,7 @@ func TestEventCreate(t *testing.T) {
APIVersion
:
"apiv1"
,
APIVersion
:
"apiv1"
,
ResourceVersion
:
"1"
,
ResourceVersion
:
"1"
,
}
}
timeStamp
:=
u
til
.
Now
()
timeStamp
:=
u
nversioned
.
Now
()
event
:=
&
api
.
Event
{
event
:=
&
api
.
Event
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
api
.
NamespaceDefault
,
...
@@ -104,7 +104,7 @@ func TestEventGet(t *testing.T) {
...
@@ -104,7 +104,7 @@ func TestEventGet(t *testing.T) {
APIVersion
:
"apiv1"
,
APIVersion
:
"apiv1"
,
ResourceVersion
:
"1"
,
ResourceVersion
:
"1"
,
}
}
timeStamp
:=
u
til
.
Now
()
timeStamp
:=
u
nversioned
.
Now
()
event
:=
&
api
.
Event
{
event
:=
&
api
.
Event
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
"other"
,
Namespace
:
"other"
,
...
@@ -144,7 +144,7 @@ func TestEventList(t *testing.T) {
...
@@ -144,7 +144,7 @@ func TestEventList(t *testing.T) {
APIVersion
:
"apiv1"
,
APIVersion
:
"apiv1"
,
ResourceVersion
:
"1"
,
ResourceVersion
:
"1"
,
}
}
timeStamp
:=
u
til
.
Now
()
timeStamp
:=
u
nversioned
.
Now
()
eventList
:=
&
api
.
EventList
{
eventList
:=
&
api
.
EventList
{
Items
:
[]
api
.
Event
{
Items
:
[]
api
.
Event
{
{
{
...
...
pkg/cloudprovider/providers/aws/aws_instancegroups.go
View file @
586cb912
...
@@ -18,6 +18,7 @@ package aws_cloud
...
@@ -18,6 +18,7 @@ package aws_cloud
import
(
import
(
"fmt"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/golang/glog"
"github.com/golang/glog"
...
...
pkg/controller/job/job_controller.go
View file @
586cb912
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
...
@@ -351,8 +352,8 @@ func newCondition() experimental.JobCondition {
...
@@ -351,8 +352,8 @@ func newCondition() experimental.JobCondition {
return
experimental
.
JobCondition
{
return
experimental
.
JobCondition
{
Type
:
experimental
.
JobComplete
,
Type
:
experimental
.
JobComplete
,
Status
:
api
.
ConditionTrue
,
Status
:
api
.
ConditionTrue
,
LastProbeTime
:
u
til
.
Now
(),
LastProbeTime
:
u
nversioned
.
Now
(),
LastTransitionTime
:
u
til
.
Now
(),
LastTransitionTime
:
u
nversioned
.
Now
(),
}
}
}
}
...
...
pkg/controller/job/job_controller_test.go
View file @
586cb912
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/apis/experimental"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
...
@@ -120,7 +121,7 @@ func newPodList(count int, status api.PodPhase, job *experimental.Job) []api.Pod
...
@@ -120,7 +121,7 @@ func newPodList(count int, status api.PodPhase, job *experimental.Job) []api.Pod
for
i
:=
0
;
i
<
count
;
i
++
{
for
i
:=
0
;
i
<
count
;
i
++
{
newPod
:=
api
.
Pod
{
newPod
:=
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
fmt
.
Sprintf
(
"pod-%v"
,
u
til
.
Now
()
.
UnixNano
()),
Name
:
fmt
.
Sprintf
(
"pod-%v"
,
u
nversioned
.
Now
()
.
UnixNano
()),
Labels
:
job
.
Spec
.
Selector
,
Labels
:
job
.
Spec
.
Selector
,
Namespace
:
job
.
Namespace
,
Namespace
:
job
.
Namespace
,
},
},
...
@@ -493,8 +494,8 @@ func TestWatchJobs(t *testing.T) {
...
@@ -493,8 +494,8 @@ func TestWatchJobs(t *testing.T) {
Conditions
:
[]
experimental
.
JobCondition
{{
Conditions
:
[]
experimental
.
JobCondition
{{
Type
:
experimental
.
JobComplete
,
Type
:
experimental
.
JobComplete
,
Status
:
api
.
ConditionTrue
,
Status
:
api
.
ConditionTrue
,
LastProbeTime
:
u
til
.
Now
(),
LastProbeTime
:
u
nversioned
.
Now
(),
LastTransitionTime
:
u
til
.
Now
(),
LastTransitionTime
:
u
nversioned
.
Now
(),
}},
}},
},
},
}
}
...
...
pkg/controller/namespace/namespace_controller.go
View file @
586cb912
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/cache"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/controller/framework"
"k8s.io/kubernetes/pkg/controller/framework"
...
@@ -153,7 +154,7 @@ func (e *contentRemainingError) Error() string {
...
@@ -153,7 +154,7 @@ func (e *contentRemainingError) Error() string {
// deleteAllContent will delete all content known to the system in a namespace. It returns an estimate
// deleteAllContent will delete all content known to the system in a namespace. It returns an estimate
// of the time remaining before the remaining resources are deleted. If estimate > 0 not all resources
// of the time remaining before the remaining resources are deleted. If estimate > 0 not all resources
// are guaranteed to be gone.
// are guaranteed to be gone.
func
deleteAllContent
(
kubeClient
client
.
Interface
,
experimentalMode
bool
,
namespace
string
,
before
u
til
.
Time
)
(
estimate
int64
,
err
error
)
{
func
deleteAllContent
(
kubeClient
client
.
Interface
,
experimentalMode
bool
,
namespace
string
,
before
u
nversioned
.
Time
)
(
estimate
int64
,
err
error
)
{
err
=
deleteServiceAccounts
(
kubeClient
,
namespace
)
err
=
deleteServiceAccounts
(
kubeClient
,
namespace
)
if
err
!=
nil
{
if
err
!=
nil
{
return
estimate
,
err
return
estimate
,
err
...
@@ -334,12 +335,12 @@ func deleteReplicationControllers(kubeClient client.Interface, ns string) error
...
@@ -334,12 +335,12 @@ func deleteReplicationControllers(kubeClient client.Interface, ns string) error
return
nil
return
nil
}
}
func
deletePods
(
kubeClient
client
.
Interface
,
ns
string
,
before
u
til
.
Time
)
(
int64
,
error
)
{
func
deletePods
(
kubeClient
client
.
Interface
,
ns
string
,
before
u
nversioned
.
Time
)
(
int64
,
error
)
{
items
,
err
:=
kubeClient
.
Pods
(
ns
)
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
items
,
err
:=
kubeClient
.
Pods
(
ns
)
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
err
return
0
,
err
}
}
expired
:=
u
til
.
Now
()
.
After
(
before
.
Time
)
expired
:=
u
nversioned
.
Now
()
.
After
(
before
.
Time
)
var
deleteOptions
*
api
.
DeleteOptions
var
deleteOptions
*
api
.
DeleteOptions
if
expired
{
if
expired
{
deleteOptions
=
api
.
NewDeleteOptions
(
0
)
deleteOptions
=
api
.
NewDeleteOptions
(
0
)
...
...
pkg/controller/namespace/namespace_controller_test.go
View file @
586cb912
...
@@ -22,8 +22,8 @@ import (
...
@@ -22,8 +22,8 @@ import (
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
)
)
...
@@ -72,7 +72,7 @@ func TestFinalize(t *testing.T) {
...
@@ -72,7 +72,7 @@ func TestFinalize(t *testing.T) {
func
testSyncNamespaceThatIsTerminating
(
t
*
testing
.
T
,
experimentalMode
bool
)
{
func
testSyncNamespaceThatIsTerminating
(
t
*
testing
.
T
,
experimentalMode
bool
)
{
mockClient
:=
&
testclient
.
Fake
{}
mockClient
:=
&
testclient
.
Fake
{}
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
testNamespace
:=
api
.
Namespace
{
testNamespace
:=
api
.
Namespace
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test"
,
Name
:
"test"
,
...
...
pkg/controller/node/nodecontroller.go
View file @
586cb912
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider"
...
@@ -49,8 +50,8 @@ const (
...
@@ -49,8 +50,8 @@ const (
)
)
type
nodeStatusData
struct
{
type
nodeStatusData
struct
{
probeTimestamp
u
til
.
Time
probeTimestamp
u
nversioned
.
Time
readyTransitionTimestamp
u
til
.
Time
readyTransitionTimestamp
u
nversioned
.
Time
status
api
.
NodeStatus
status
api
.
NodeStatus
}
}
...
@@ -89,7 +90,7 @@ type NodeController struct {
...
@@ -89,7 +90,7 @@ type NodeController struct {
// This timestamp is to be used instead of LastProbeTime stored in Condition. We do this
// This timestamp is to be used instead of LastProbeTime stored in Condition. We do this
// to aviod the problem with time skew across the cluster.
// to aviod the problem with time skew across the cluster.
nodeStatusMap
map
[
string
]
nodeStatusData
nodeStatusMap
map
[
string
]
nodeStatusData
now
func
()
u
til
.
Time
now
func
()
u
nversioned
.
Time
// Lock to access evictor workers
// Lock to access evictor workers
evictorLock
*
sync
.
Mutex
evictorLock
*
sync
.
Mutex
// workers that evicts pods from unresponsive nodes.
// workers that evicts pods from unresponsive nodes.
...
@@ -140,7 +141,7 @@ func NewNodeController(
...
@@ -140,7 +141,7 @@ func NewNodeController(
nodeMonitorPeriod
:
nodeMonitorPeriod
,
nodeMonitorPeriod
:
nodeMonitorPeriod
,
nodeStartupGracePeriod
:
nodeStartupGracePeriod
,
nodeStartupGracePeriod
:
nodeStartupGracePeriod
,
lookupIP
:
net
.
LookupIP
,
lookupIP
:
net
.
LookupIP
,
now
:
u
til
.
Now
,
now
:
u
nversioned
.
Now
,
clusterCIDR
:
clusterCIDR
,
clusterCIDR
:
clusterCIDR
,
allocateNodeCIDRs
:
allocateNodeCIDRs
,
allocateNodeCIDRs
:
allocateNodeCIDRs
,
}
}
...
@@ -488,7 +489,7 @@ func (nc *NodeController) tryUpdateNodeStatus(node *api.Node) (time.Duration, ap
...
@@ -488,7 +489,7 @@ func (nc *NodeController) tryUpdateNodeStatus(node *api.Node) (time.Duration, ap
}
}
nc
.
nodeStatusMap
[
node
.
Name
]
=
savedNodeStatus
nc
.
nodeStatusMap
[
node
.
Name
]
=
savedNodeStatus
}
else
if
savedCondition
!=
nil
&&
observedCondition
!=
nil
&&
savedCondition
.
LastHeartbeatTime
!=
observedCondition
.
LastHeartbeatTime
{
}
else
if
savedCondition
!=
nil
&&
observedCondition
!=
nil
&&
savedCondition
.
LastHeartbeatTime
!=
observedCondition
.
LastHeartbeatTime
{
var
transitionTime
u
til
.
Time
var
transitionTime
u
nversioned
.
Time
// If ReadyCondition changed since the last time we checked, we update the transition timestamp to "now",
// If ReadyCondition changed since the last time we checked, we update the transition timestamp to "now",
// otherwise we leave it as it is.
// otherwise we leave it as it is.
if
savedCondition
.
LastTransitionTime
!=
observedCondition
.
LastTransitionTime
{
if
savedCondition
.
LastTransitionTime
!=
observedCondition
.
LastTransitionTime
{
...
...
pkg/controller/node/nodecontroller_test.go
View file @
586cb912
This diff is collapsed.
Click to expand it.
pkg/controller/podautoscaler/horizontal.go
View file @
586cb912
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
...
@@ -144,7 +145,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa experimental.HorizontalPo
...
@@ -144,7 +145,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa experimental.HorizontalPo
}
}
hpa
.
Status
=
&
status
hpa
.
Status
=
&
status
if
rescale
{
if
rescale
{
now
:=
u
til
.
NewTime
(
now
)
now
:=
u
nversioned
.
NewTime
(
now
)
hpa
.
Status
.
LastScaleTimestamp
=
&
now
hpa
.
Status
.
LastScaleTimestamp
=
&
now
}
}
...
...
pkg/controller/replication/replication_controller_test.go
View file @
586cb912
...
@@ -969,7 +969,7 @@ func TestOverlappingRCs(t *testing.T) {
...
@@ -969,7 +969,7 @@ func TestOverlappingRCs(t *testing.T) {
var
controllers
[]
*
api
.
ReplicationController
var
controllers
[]
*
api
.
ReplicationController
for
j
:=
1
;
j
<
10
;
j
++
{
for
j
:=
1
;
j
<
10
;
j
++
{
controllerSpec
:=
newReplicationController
(
1
)
controllerSpec
:=
newReplicationController
(
1
)
controllerSpec
.
CreationTimestamp
=
u
til
.
Date
(
2014
,
time
.
December
,
j
,
0
,
0
,
0
,
0
,
time
.
Local
)
controllerSpec
.
CreationTimestamp
=
u
nversioned
.
Date
(
2014
,
time
.
December
,
j
,
0
,
0
,
0
,
0
,
time
.
Local
)
controllerSpec
.
Name
=
string
(
util
.
NewUUID
())
controllerSpec
.
Name
=
string
(
util
.
NewUUID
())
controllers
=
append
(
controllers
,
controllerSpec
)
controllers
=
append
(
controllers
,
controllerSpec
)
}
}
...
...
pkg/kubectl/cmd/cmd_test.go
View file @
586cb912
...
@@ -31,6 +31,7 @@ import (
...
@@ -31,6 +31,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/api/validation"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
...
@@ -284,7 +285,7 @@ func ExamplePrintReplicationControllerWithNamespace() {
...
@@ -284,7 +285,7 @@ func ExamplePrintReplicationControllerWithNamespace() {
Name
:
"foo"
,
Name
:
"foo"
,
Namespace
:
"beep"
,
Namespace
:
"beep"
,
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
},
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
},
CreationTimestamp
:
u
til
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
},
},
Spec
:
api
.
ReplicationControllerSpec
{
Spec
:
api
.
ReplicationControllerSpec
{
Replicas
:
1
,
Replicas
:
1
,
...
@@ -325,7 +326,7 @@ func ExamplePrintPodWithWideFormat() {
...
@@ -325,7 +326,7 @@ func ExamplePrintPodWithWideFormat() {
pod
:=
&
api
.
Pod
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test1"
,
Name
:
"test1"
,
CreationTimestamp
:
u
til
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
make
([]
api
.
Container
,
2
),
Containers
:
make
([]
api
.
Container
,
2
),
...
@@ -355,7 +356,7 @@ func newAllPhasePodList() *api.PodList {
...
@@ -355,7 +356,7 @@ func newAllPhasePodList() *api.PodList {
{
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test1"
,
Name
:
"test1"
,
CreationTimestamp
:
u
til
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
make
([]
api
.
Container
,
2
),
Containers
:
make
([]
api
.
Container
,
2
),
...
@@ -372,7 +373,7 @@ func newAllPhasePodList() *api.PodList {
...
@@ -372,7 +373,7 @@ func newAllPhasePodList() *api.PodList {
{
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test2"
,
Name
:
"test2"
,
CreationTimestamp
:
u
til
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
make
([]
api
.
Container
,
2
),
Containers
:
make
([]
api
.
Container
,
2
),
...
@@ -389,7 +390,7 @@ func newAllPhasePodList() *api.PodList {
...
@@ -389,7 +390,7 @@ func newAllPhasePodList() *api.PodList {
{
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test3"
,
Name
:
"test3"
,
CreationTimestamp
:
u
til
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
make
([]
api
.
Container
,
2
),
Containers
:
make
([]
api
.
Container
,
2
),
...
@@ -406,7 +407,7 @@ func newAllPhasePodList() *api.PodList {
...
@@ -406,7 +407,7 @@ func newAllPhasePodList() *api.PodList {
{
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test4"
,
Name
:
"test4"
,
CreationTimestamp
:
u
til
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
make
([]
api
.
Container
,
2
),
Containers
:
make
([]
api
.
Container
,
2
),
...
@@ -423,7 +424,7 @@ func newAllPhasePodList() *api.PodList {
...
@@ -423,7 +424,7 @@ func newAllPhasePodList() *api.PodList {
{
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test5"
,
Name
:
"test5"
,
CreationTimestamp
:
u
til
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
make
([]
api
.
Container
,
2
),
Containers
:
make
([]
api
.
Container
,
2
),
...
@@ -496,7 +497,7 @@ func ExamplePrintServiceWithNamespacesAndLabels() {
...
@@ -496,7 +497,7 @@ func ExamplePrintServiceWithNamespacesAndLabels() {
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"svc1"
,
Name
:
"svc1"
,
Namespace
:
"ns1"
,
Namespace
:
"ns1"
,
CreationTimestamp
:
u
til
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"l1"
:
"value"
,
"l1"
:
"value"
,
},
},
...
@@ -517,7 +518,7 @@ func ExamplePrintServiceWithNamespacesAndLabels() {
...
@@ -517,7 +518,7 @@ func ExamplePrintServiceWithNamespacesAndLabels() {
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"svc2"
,
Name
:
"svc2"
,
Namespace
:
"ns2"
,
Namespace
:
"ns2"
,
CreationTimestamp
:
u
til
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)},
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"l1"
:
"dolla-bill-yall"
,
"l1"
:
"dolla-bill-yall"
,
},
},
...
...
pkg/kubectl/describe_test.go
View file @
586cb912
...
@@ -26,9 +26,9 @@ import (
...
@@ -26,9 +26,9 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/util"
)
)
type
describeClient
struct
{
type
describeClient
struct
{
...
@@ -85,22 +85,22 @@ func TestPodDescribeResultsSorted(t *testing.T) {
...
@@ -85,22 +85,22 @@ func TestPodDescribeResultsSorted(t *testing.T) {
{
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Message
:
"Item 1"
,
Message
:
"Item 1"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
{
{
Source
:
api
.
EventSource
{
Component
:
"scheduler"
},
Source
:
api
.
EventSource
{
Component
:
"scheduler"
},
Message
:
"Item 2"
,
Message
:
"Item 2"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
{
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Message
:
"Item 3"
,
Message
:
"Item 3"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
},
},
...
@@ -131,7 +131,7 @@ func TestDescribeContainers(t *testing.T) {
...
@@ -131,7 +131,7 @@ func TestDescribeContainers(t *testing.T) {
Name
:
"test"
,
Name
:
"test"
,
State
:
api
.
ContainerState
{
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{
Running
:
&
api
.
ContainerStateRunning
{
StartedAt
:
u
til
.
NewTime
(
time
.
Now
()),
StartedAt
:
u
nversioned
.
NewTime
(
time
.
Now
()),
},
},
},
},
Ready
:
true
,
Ready
:
true
,
...
@@ -161,8 +161,8 @@ func TestDescribeContainers(t *testing.T) {
...
@@ -161,8 +161,8 @@ func TestDescribeContainers(t *testing.T) {
Name
:
"test"
,
Name
:
"test"
,
State
:
api
.
ContainerState
{
State
:
api
.
ContainerState
{
Terminated
:
&
api
.
ContainerStateTerminated
{
Terminated
:
&
api
.
ContainerStateTerminated
{
StartedAt
:
u
til
.
NewTime
(
time
.
Now
()),
StartedAt
:
u
nversioned
.
NewTime
(
time
.
Now
()),
FinishedAt
:
u
til
.
NewTime
(
time
.
Now
()),
FinishedAt
:
u
nversioned
.
NewTime
(
time
.
Now
()),
Reason
:
"potato"
,
Reason
:
"potato"
,
ExitCode
:
2
,
ExitCode
:
2
,
},
},
...
@@ -179,13 +179,13 @@ func TestDescribeContainers(t *testing.T) {
...
@@ -179,13 +179,13 @@ func TestDescribeContainers(t *testing.T) {
Name
:
"test"
,
Name
:
"test"
,
State
:
api
.
ContainerState
{
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{
Running
:
&
api
.
ContainerStateRunning
{
StartedAt
:
u
til
.
NewTime
(
time
.
Now
()),
StartedAt
:
u
nversioned
.
NewTime
(
time
.
Now
()),
},
},
},
},
LastTerminationState
:
api
.
ContainerState
{
LastTerminationState
:
api
.
ContainerState
{
Terminated
:
&
api
.
ContainerStateTerminated
{
Terminated
:
&
api
.
ContainerStateTerminated
{
StartedAt
:
u
til
.
NewTime
(
time
.
Now
()
.
Add
(
time
.
Second
*
3
)),
StartedAt
:
u
nversioned
.
NewTime
(
time
.
Now
()
.
Add
(
time
.
Second
*
3
)),
FinishedAt
:
u
til
.
NewTime
(
time
.
Now
()),
FinishedAt
:
u
nversioned
.
NewTime
(
time
.
Now
()),
Reason
:
"crashing"
,
Reason
:
"crashing"
,
ExitCode
:
3
,
ExitCode
:
3
,
},
},
...
...
pkg/kubectl/resource_printer.go
View file @
586cb912
...
@@ -41,7 +41,6 @@ import (
...
@@ -41,7 +41,6 @@ import (
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/jsonpath"
"k8s.io/kubernetes/pkg/util/jsonpath"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/kubernetes/pkg/util/sets"
)
)
...
@@ -518,7 +517,7 @@ func shortHumanDuration(d time.Duration) string {
...
@@ -518,7 +517,7 @@ func shortHumanDuration(d time.Duration) string {
// translateTimestamp returns the elapsed time since timestamp in
// translateTimestamp returns the elapsed time since timestamp in
// human-readable approximation.
// human-readable approximation.
func
translateTimestamp
(
timestamp
u
til
.
Time
)
string
{
func
translateTimestamp
(
timestamp
u
nversioned
.
Time
)
string
{
if
timestamp
.
IsZero
()
{
if
timestamp
.
IsZero
()
{
return
"<unknown>"
return
"<unknown>"
}
}
...
...
pkg/kubectl/resource_printer_test.go
View file @
586cb912
...
@@ -390,7 +390,7 @@ func TestTemplateStrings(t *testing.T) {
...
@@ -390,7 +390,7 @@ func TestTemplateStrings(t *testing.T) {
Name
:
"bar"
,
Name
:
"bar"
,
State
:
api
.
ContainerState
{
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{
Running
:
&
api
.
ContainerStateRunning
{
StartedAt
:
u
til
.
Time
{},
StartedAt
:
u
nversioned
.
Time
{},
},
},
},
},
},
},
...
@@ -407,7 +407,7 @@ func TestTemplateStrings(t *testing.T) {
...
@@ -407,7 +407,7 @@ func TestTemplateStrings(t *testing.T) {
Name
:
"foo"
,
Name
:
"foo"
,
State
:
api
.
ContainerState
{
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{
Running
:
&
api
.
ContainerStateRunning
{
StartedAt
:
u
til
.
Time
{},
StartedAt
:
u
nversioned
.
Time
{},
},
},
},
},
},
},
...
@@ -415,7 +415,7 @@ func TestTemplateStrings(t *testing.T) {
...
@@ -415,7 +415,7 @@ func TestTemplateStrings(t *testing.T) {
Name
:
"bar"
,
Name
:
"bar"
,
State
:
api
.
ContainerState
{
State
:
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{
Running
:
&
api
.
ContainerStateRunning
{
StartedAt
:
u
til
.
Time
{},
StartedAt
:
u
nversioned
.
Time
{},
},
},
},
},
},
},
...
@@ -514,22 +514,22 @@ func TestPrintEventsResultSorted(t *testing.T) {
...
@@ -514,22 +514,22 @@ func TestPrintEventsResultSorted(t *testing.T) {
{
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Message
:
"Item 1"
,
Message
:
"Item 1"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
{
{
Source
:
api
.
EventSource
{
Component
:
"scheduler"
},
Source
:
api
.
EventSource
{
Component
:
"scheduler"
},
Message
:
"Item 2"
,
Message
:
"Item 2"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
{
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Message
:
"Item 3"
,
Message
:
"Item 3"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
},
},
...
@@ -909,8 +909,8 @@ func TestPrintHumanReadableWithNamespace(t *testing.T) {
...
@@ -909,8 +909,8 @@ func TestPrintHumanReadableWithNamespace(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
Namespace
:
namespaceName
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
Namespace
:
namespaceName
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Message
:
"Item 1"
,
Message
:
"Item 1"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
isNamespaced
:
true
,
isNamespaced
:
true
,
...
@@ -1215,16 +1215,16 @@ type stringTestList []struct {
...
@@ -1215,16 +1215,16 @@ type stringTestList []struct {
func
TestTranslateTimestamp
(
t
*
testing
.
T
)
{
func
TestTranslateTimestamp
(
t
*
testing
.
T
)
{
tl
:=
stringTestList
{
tl
:=
stringTestList
{
{
"a while from now"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
Add
(
2.1e9
)}),
"<invalid>"
},
{
"a while from now"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
Add
(
2.1e9
)}),
"<invalid>"
},
{
"almost now"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
Add
(
1.9e9
)}),
"0s"
},
{
"almost now"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
Add
(
1.9e9
)}),
"0s"
},
{
"now"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()}),
"0s"
},
{
"now"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()}),
"0s"
},
{
"unknown"
,
translateTimestamp
(
u
til
.
Time
{}),
"<unknown>"
},
{
"unknown"
,
translateTimestamp
(
u
nversioned
.
Time
{}),
"<unknown>"
},
{
"30 seconds ago"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
Add
(
-
3e10
)}),
"30s"
},
{
"30 seconds ago"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
Add
(
-
3e10
)}),
"30s"
},
{
"5 minutes ago"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
Add
(
-
3e11
)}),
"5m"
},
{
"5 minutes ago"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
Add
(
-
3e11
)}),
"5m"
},
{
"an hour ago"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
Add
(
-
6e12
)}),
"1h"
},
{
"an hour ago"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
Add
(
-
6e12
)}),
"1h"
},
{
"2 days ago"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
0
,
0
,
-
2
)}),
"2d"
},
{
"2 days ago"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
0
,
0
,
-
2
)}),
"2d"
},
{
"months ago"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
0
,
-
3
,
0
)}),
"92d"
},
{
"months ago"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
0
,
-
3
,
0
)}),
"92d"
},
{
"10 years ago"
,
translateTimestamp
(
u
til
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)}),
"10y"
},
{
"10 years ago"
,
translateTimestamp
(
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
AddDate
(
-
10
,
0
,
0
)}),
"10y"
},
}
}
for
_
,
test
:=
range
tl
{
for
_
,
test
:=
range
tl
{
if
test
.
got
!=
test
.
exp
{
if
test
.
got
!=
test
.
exp
{
...
@@ -1243,7 +1243,7 @@ func TestPrintDeployment(t *testing.T) {
...
@@ -1243,7 +1243,7 @@ func TestPrintDeployment(t *testing.T) {
experimental
.
Deployment
{
experimental
.
Deployment
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test1"
,
Name
:
"test1"
,
CreationTimestamp
:
u
til
.
Time
{
Time
:
time
.
Now
()
.
Add
(
1.9e9
)},
CreationTimestamp
:
u
nversioned
.
Time
{
Time
:
time
.
Now
()
.
Add
(
1.9e9
)},
},
},
Spec
:
experimental
.
DeploymentSpec
{
Spec
:
experimental
.
DeploymentSpec
{
Replicas
:
5
,
Replicas
:
5
,
...
...
pkg/kubectl/service.go
View file @
586cb912
...
@@ -18,10 +18,11 @@ package kubectl
...
@@ -18,10 +18,11 @@ package kubectl
import
(
import
(
"fmt"
"fmt"
"strconv"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"strconv"
)
)
// The only difference between ServiceGeneratorV1 and V2 is that the service port is named "default" in V1, while it is left unnamed in V2.
// The only difference between ServiceGeneratorV1 and V2 is that the service port is named "default" in V1, while it is left unnamed in V2.
...
...
pkg/kubectl/sorted_event_list_test.go
View file @
586cb912
...
@@ -23,7 +23,7 @@ import (
...
@@ -23,7 +23,7 @@ import (
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/
util
"
"k8s.io/kubernetes/pkg/
api/unversioned
"
)
)
// VerifyDatesInOrder checks the start of each line for a RFC1123Z date
// VerifyDatesInOrder checks the start of each line for a RFC1123Z date
...
@@ -57,22 +57,22 @@ func TestSortableEvents(t *testing.T) {
...
@@ -57,22 +57,22 @@ func TestSortableEvents(t *testing.T) {
{
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Message
:
"Item 1"
,
Message
:
"Item 1"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2014
,
time
.
January
,
15
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
{
{
Source
:
api
.
EventSource
{
Component
:
"scheduler"
},
Source
:
api
.
EventSource
{
Component
:
"scheduler"
},
Message
:
"Item 2"
,
Message
:
"Item 2"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
1987
,
time
.
June
,
17
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
{
{
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Source
:
api
.
EventSource
{
Component
:
"kubelet"
},
Message
:
"Item 3"
,
Message
:
"Item 3"
,
FirstTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
FirstTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
til
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
LastTimestamp
:
u
nversioned
.
NewTime
(
time
.
Date
(
2002
,
time
.
December
,
25
,
0
,
0
,
0
,
0
,
time
.
UTC
)),
Count
:
1
,
Count
:
1
,
},
},
})
})
...
...
pkg/kubelet/dockertools/manager.go
View file @
586cb912
...
@@ -37,6 +37,7 @@ import (
...
@@ -37,6 +37,7 @@ import (
cadvisorApi
"github.com/google/cadvisor/info/v1"
cadvisorApi
"github.com/google/cadvisor/info/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
...
@@ -320,7 +321,7 @@ func (dm *DockerManager) inspectContainer(dockerID, containerName, tPath string,
...
@@ -320,7 +321,7 @@ func (dm *DockerManager) inspectContainer(dockerID, containerName, tPath string,
if
inspectResult
.
State
.
Running
{
if
inspectResult
.
State
.
Running
{
result
.
status
.
State
.
Running
=
&
api
.
ContainerStateRunning
{
result
.
status
.
State
.
Running
=
&
api
.
ContainerStateRunning
{
StartedAt
:
u
til
.
NewTime
(
inspectResult
.
State
.
StartedAt
),
StartedAt
:
u
nversioned
.
NewTime
(
inspectResult
.
State
.
StartedAt
),
}
}
if
containerName
==
PodInfraContainerName
{
if
containerName
==
PodInfraContainerName
{
if
inspectResult
.
NetworkSettings
!=
nil
{
if
inspectResult
.
NetworkSettings
!=
nil
{
...
@@ -353,8 +354,8 @@ func (dm *DockerManager) inspectContainer(dockerID, containerName, tPath string,
...
@@ -353,8 +354,8 @@ func (dm *DockerManager) inspectContainer(dockerID, containerName, tPath string,
Message
:
message
,
Message
:
message
,
Reason
:
reason
,
Reason
:
reason
,
StartedAt
:
u
til
.
NewTime
(
inspectResult
.
State
.
StartedAt
),
StartedAt
:
u
nversioned
.
NewTime
(
inspectResult
.
State
.
StartedAt
),
FinishedAt
:
u
til
.
NewTime
(
inspectResult
.
State
.
FinishedAt
),
FinishedAt
:
u
nversioned
.
NewTime
(
inspectResult
.
State
.
FinishedAt
),
ContainerID
:
DockerPrefix
+
dockerID
,
ContainerID
:
DockerPrefix
+
dockerID
,
}
}
if
tPath
!=
""
{
if
tPath
!=
""
{
...
@@ -386,7 +387,7 @@ func (dm *DockerManager) GetPodStatus(pod *api.Pod) (*api.PodStatus, error) {
...
@@ -386,7 +387,7 @@ func (dm *DockerManager) GetPodStatus(pod *api.Pod) (*api.PodStatus, error) {
manifest
:=
pod
.
Spec
manifest
:=
pod
.
Spec
oldStatuses
:=
make
(
map
[
string
]
api
.
ContainerStatus
,
len
(
pod
.
Spec
.
Containers
))
oldStatuses
:=
make
(
map
[
string
]
api
.
ContainerStatus
,
len
(
pod
.
Spec
.
Containers
))
lastObservedTime
:=
make
(
map
[
string
]
u
til
.
Time
,
len
(
pod
.
Spec
.
Containers
))
lastObservedTime
:=
make
(
map
[
string
]
u
nversioned
.
Time
,
len
(
pod
.
Spec
.
Containers
))
// Record the last time we observed a container termination.
// Record the last time we observed a container termination.
for
_
,
status
:=
range
pod
.
Status
.
ContainerStatuses
{
for
_
,
status
:=
range
pod
.
Status
.
ContainerStatuses
{
oldStatuses
[
status
.
Name
]
=
status
oldStatuses
[
status
.
Name
]
=
status
...
@@ -1304,7 +1305,7 @@ func (dm *DockerManager) killContainer(containerID types.UID, container *api.Con
...
@@ -1304,7 +1305,7 @@ func (dm *DockerManager) killContainer(containerID types.UID, container *api.Con
}
}
}
}
glog
.
V
(
2
)
.
Infof
(
"Killing container %q with %d second grace period"
,
name
,
gracePeriod
)
glog
.
V
(
2
)
.
Infof
(
"Killing container %q with %d second grace period"
,
name
,
gracePeriod
)
start
:=
u
til
.
Now
()
start
:=
u
nversioned
.
Now
()
if
pod
!=
nil
&&
container
!=
nil
&&
container
.
Lifecycle
!=
nil
&&
container
.
Lifecycle
.
PreStop
!=
nil
{
if
pod
!=
nil
&&
container
!=
nil
&&
container
.
Lifecycle
!=
nil
&&
container
.
Lifecycle
.
PreStop
!=
nil
{
glog
.
V
(
4
)
.
Infof
(
"Running preStop hook for container %q"
,
name
)
glog
.
V
(
4
)
.
Infof
(
"Running preStop hook for container %q"
,
name
)
...
@@ -1322,7 +1323,7 @@ func (dm *DockerManager) killContainer(containerID types.UID, container *api.Con
...
@@ -1322,7 +1323,7 @@ func (dm *DockerManager) killContainer(containerID types.UID, container *api.Con
case
<-
done
:
case
<-
done
:
glog
.
V
(
4
)
.
Infof
(
"preStop hook for container %q completed"
,
name
)
glog
.
V
(
4
)
.
Infof
(
"preStop hook for container %q completed"
,
name
)
}
}
gracePeriod
-=
int64
(
u
til
.
Now
()
.
Sub
(
start
.
Time
)
.
Seconds
())
gracePeriod
-=
int64
(
u
nversioned
.
Now
()
.
Sub
(
start
.
Time
)
.
Seconds
())
}
}
dm
.
readinessManager
.
RemoveReadiness
(
ID
)
dm
.
readinessManager
.
RemoveReadiness
(
ID
)
...
@@ -1337,9 +1338,9 @@ func (dm *DockerManager) killContainer(containerID types.UID, container *api.Con
...
@@ -1337,9 +1338,9 @@ func (dm *DockerManager) killContainer(containerID types.UID, container *api.Con
return
nil
return
nil
}
}
if
err
==
nil
{
if
err
==
nil
{
glog
.
V
(
2
)
.
Infof
(
"Container %q exited after %s"
,
name
,
u
til
.
Now
()
.
Sub
(
start
.
Time
))
glog
.
V
(
2
)
.
Infof
(
"Container %q exited after %s"
,
name
,
u
nversioned
.
Now
()
.
Sub
(
start
.
Time
))
}
else
{
}
else
{
glog
.
V
(
2
)
.
Infof
(
"Container %q termination failed after %s: %v"
,
name
,
u
til
.
Now
()
.
Sub
(
start
.
Time
),
err
)
glog
.
V
(
2
)
.
Infof
(
"Container %q termination failed after %s: %v"
,
name
,
u
nversioned
.
Now
()
.
Sub
(
start
.
Time
),
err
)
}
}
ref
,
ok
:=
dm
.
containerRefManager
.
GetRef
(
ID
)
ref
,
ok
:=
dm
.
containerRefManager
.
GetRef
(
ID
)
if
!
ok
{
if
!
ok
{
...
@@ -1878,7 +1879,7 @@ func getUidFromUser(id string) string {
...
@@ -1878,7 +1879,7 @@ func getUidFromUser(id string) string {
}
}
func
(
dm
*
DockerManager
)
doBackOff
(
pod
*
api
.
Pod
,
container
*
api
.
Container
,
podStatus
api
.
PodStatus
,
backOff
*
util
.
Backoff
)
bool
{
func
(
dm
*
DockerManager
)
doBackOff
(
pod
*
api
.
Pod
,
container
*
api
.
Container
,
podStatus
api
.
PodStatus
,
backOff
*
util
.
Backoff
)
bool
{
var
ts
u
til
.
Time
var
ts
u
nversioned
.
Time
for
_
,
containerStatus
:=
range
podStatus
.
ContainerStatuses
{
for
_
,
containerStatus
:=
range
podStatus
.
ContainerStatuses
{
if
containerStatus
.
Name
!=
container
.
Name
{
if
containerStatus
.
Name
!=
container
.
Name
{
continue
continue
...
...
pkg/kubelet/kubelet.go
View file @
586cb912
...
@@ -37,6 +37,7 @@ import (
...
@@ -37,6 +37,7 @@ import (
cadvisorApi
"github.com/google/cadvisor/info/v1"
cadvisorApi
"github.com/google/cadvisor/info/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
...
@@ -1145,7 +1146,7 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
...
@@ -1145,7 +1146,7 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
}
}
podStatus
=
pod
.
Status
podStatus
=
pod
.
Status
podStatus
.
StartTime
=
&
u
til
.
Time
{
Time
:
start
}
podStatus
.
StartTime
=
&
u
nversioned
.
Time
{
Time
:
start
}
kl
.
statusManager
.
SetPodStatus
(
pod
,
podStatus
)
kl
.
statusManager
.
SetPodStatus
(
pod
,
podStatus
)
glog
.
V
(
3
)
.
Infof
(
"Not generating pod status for new pod %q"
,
podFullName
)
glog
.
V
(
3
)
.
Infof
(
"Not generating pod status for new pod %q"
,
podFullName
)
}
else
{
}
else
{
...
@@ -1380,7 +1381,7 @@ func (kl *Kubelet) cleanupTerminatedPods(pods []*api.Pod, runningPods []*kubecon
...
@@ -1380,7 +1381,7 @@ func (kl *Kubelet) cleanupTerminatedPods(pods []*api.Pod, runningPods []*kubecon
// pastActiveDeadline returns true if the pod has been active for more than
// pastActiveDeadline returns true if the pod has been active for more than
// ActiveDeadlineSeconds.
// ActiveDeadlineSeconds.
func
(
kl
*
Kubelet
)
pastActiveDeadline
(
pod
*
api
.
Pod
)
bool
{
func
(
kl
*
Kubelet
)
pastActiveDeadline
(
pod
*
api
.
Pod
)
bool
{
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
if
pod
.
Spec
.
ActiveDeadlineSeconds
!=
nil
{
if
pod
.
Spec
.
ActiveDeadlineSeconds
!=
nil
{
podStatus
,
ok
:=
kl
.
statusManager
.
GetPodStatus
(
pod
.
UID
)
podStatus
,
ok
:=
kl
.
statusManager
.
GetPodStatus
(
pod
.
UID
)
if
!
ok
{
if
!
ok
{
...
...
pkg/kubelet/kubelet_test.go
View file @
586cb912
...
@@ -36,6 +36,7 @@ import (
...
@@ -36,6 +36,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
...
@@ -2103,8 +2104,8 @@ func TestHandlePortConflicts(t *testing.T) {
...
@@ -2103,8 +2104,8 @@ func TestHandlePortConflicts(t *testing.T) {
},
},
}
}
// Make sure the Pods are in the reverse order of creation time.
// Make sure the Pods are in the reverse order of creation time.
pods
[
1
]
.
CreationTimestamp
=
u
til
.
NewTime
(
time
.
Now
())
pods
[
1
]
.
CreationTimestamp
=
u
nversioned
.
NewTime
(
time
.
Now
())
pods
[
0
]
.
CreationTimestamp
=
u
til
.
NewTime
(
time
.
Now
()
.
Add
(
1
*
time
.
Second
))
pods
[
0
]
.
CreationTimestamp
=
u
nversioned
.
NewTime
(
time
.
Now
()
.
Add
(
1
*
time
.
Second
))
// The newer pod should be rejected.
// The newer pod should be rejected.
conflictedPod
:=
pods
[
0
]
conflictedPod
:=
pods
[
0
]
...
@@ -2193,8 +2194,8 @@ func TestHandleMemExceeded(t *testing.T) {
...
@@ -2193,8 +2194,8 @@ func TestHandleMemExceeded(t *testing.T) {
},
},
}
}
// Make sure the Pods are in the reverse order of creation time.
// Make sure the Pods are in the reverse order of creation time.
pods
[
1
]
.
CreationTimestamp
=
u
til
.
NewTime
(
time
.
Now
())
pods
[
1
]
.
CreationTimestamp
=
u
nversioned
.
NewTime
(
time
.
Now
())
pods
[
0
]
.
CreationTimestamp
=
u
til
.
NewTime
(
time
.
Now
()
.
Add
(
1
*
time
.
Second
))
pods
[
0
]
.
CreationTimestamp
=
u
nversioned
.
NewTime
(
time
.
Now
()
.
Add
(
1
*
time
.
Second
))
// The newer pod should be rejected.
// The newer pod should be rejected.
notfittingPod
:=
pods
[
0
]
notfittingPod
:=
pods
[
0
]
...
@@ -2792,8 +2793,8 @@ func TestIsPodPastActiveDeadline(t *testing.T) {
...
@@ -2792,8 +2793,8 @@ func TestIsPodPastActiveDeadline(t *testing.T) {
exceededActiveDeadlineSeconds
:=
int64
(
30
)
exceededActiveDeadlineSeconds
:=
int64
(
30
)
notYetActiveDeadlineSeconds
:=
int64
(
120
)
notYetActiveDeadlineSeconds
:=
int64
(
120
)
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
startTime
:=
u
til
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
startTime
:=
u
nversioned
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
pods
[
0
]
.
Status
.
StartTime
=
&
startTime
pods
[
0
]
.
Status
.
StartTime
=
&
startTime
pods
[
0
]
.
Spec
.
ActiveDeadlineSeconds
=
&
exceededActiveDeadlineSeconds
pods
[
0
]
.
Spec
.
ActiveDeadlineSeconds
=
&
exceededActiveDeadlineSeconds
pods
[
1
]
.
Status
.
StartTime
=
&
startTime
pods
[
1
]
.
Status
.
StartTime
=
&
startTime
...
@@ -2818,8 +2819,8 @@ func TestSyncPodsSetStatusToFailedForPodsThatRunTooLong(t *testing.T) {
...
@@ -2818,8 +2819,8 @@ func TestSyncPodsSetStatusToFailedForPodsThatRunTooLong(t *testing.T) {
testKubelet
.
fakeCadvisor
.
On
(
"MachineInfo"
)
.
Return
(
&
cadvisorApi
.
MachineInfo
{},
nil
)
testKubelet
.
fakeCadvisor
.
On
(
"MachineInfo"
)
.
Return
(
&
cadvisorApi
.
MachineInfo
{},
nil
)
kubelet
:=
testKubelet
.
kubelet
kubelet
:=
testKubelet
.
kubelet
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
startTime
:=
u
til
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
startTime
:=
u
nversioned
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
exceededActiveDeadlineSeconds
:=
int64
(
30
)
exceededActiveDeadlineSeconds
:=
int64
(
30
)
pods
:=
[]
*
api
.
Pod
{
pods
:=
[]
*
api
.
Pod
{
...
@@ -2869,8 +2870,8 @@ func TestSyncPodsDoesNotSetPodsThatDidNotRunTooLongToFailed(t *testing.T) {
...
@@ -2869,8 +2870,8 @@ func TestSyncPodsDoesNotSetPodsThatDidNotRunTooLongToFailed(t *testing.T) {
testKubelet
.
fakeCadvisor
.
On
(
"MachineInfo"
)
.
Return
(
&
cadvisorApi
.
MachineInfo
{},
nil
)
testKubelet
.
fakeCadvisor
.
On
(
"MachineInfo"
)
.
Return
(
&
cadvisorApi
.
MachineInfo
{},
nil
)
kubelet
:=
testKubelet
.
kubelet
kubelet
:=
testKubelet
.
kubelet
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
startTime
:=
u
til
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
startTime
:=
u
nversioned
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
exceededActiveDeadlineSeconds
:=
int64
(
300
)
exceededActiveDeadlineSeconds
:=
int64
(
300
)
pods
:=
[]
*
api
.
Pod
{
pods
:=
[]
*
api
.
Pod
{
...
...
pkg/kubelet/node_manager.go
View file @
586cb912
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
apierrors
"k8s.io/kubernetes/pkg/api/errors"
apierrors
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
...
@@ -406,7 +407,7 @@ func (nm *realNodeManager) setNodeStatus(node *api.Node) error {
...
@@ -406,7 +407,7 @@ func (nm *realNodeManager) setNodeStatus(node *api.Node) error {
// Check whether network is configured properly
// Check whether network is configured properly
networkConfigured
:=
nm
.
infoGetter
.
NetworkConfigured
()
networkConfigured
:=
nm
.
infoGetter
.
NetworkConfigured
()
currentTime
:=
u
til
.
Now
()
currentTime
:=
u
nversioned
.
Now
()
var
newNodeReadyCondition
api
.
NodeCondition
var
newNodeReadyCondition
api
.
NodeCondition
var
oldNodeReadyConditionStatus
api
.
ConditionStatus
var
oldNodeReadyConditionStatus
api
.
ConditionStatus
if
containerRuntimeUp
&&
networkConfigured
{
if
containerRuntimeUp
&&
networkConfigured
{
...
...
pkg/kubelet/node_manager_test.go
View file @
586cb912
...
@@ -127,8 +127,8 @@ func TestUpdateNewNodeStatus(t *testing.T) {
...
@@ -127,8 +127,8 @@ func TestUpdateNewNodeStatus(t *testing.T) {
Status
:
api
.
ConditionTrue
,
Status
:
api
.
ConditionTrue
,
Reason
:
"KubeletReady"
,
Reason
:
"KubeletReady"
,
Message
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
Message
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
LastHeartbeatTime
:
u
til
.
Time
{},
LastHeartbeatTime
:
u
nversioned
.
Time
{},
LastTransitionTime
:
u
til
.
Time
{},
LastTransitionTime
:
u
nversioned
.
Time
{},
},
},
},
},
NodeInfo
:
api
.
NodeSystemInfo
{
NodeInfo
:
api
.
NodeSystemInfo
{
...
@@ -175,8 +175,8 @@ func TestUpdateNewNodeStatus(t *testing.T) {
...
@@ -175,8 +175,8 @@ func TestUpdateNewNodeStatus(t *testing.T) {
if
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
IsZero
()
{
if
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
IsZero
()
{
t
.
Errorf
(
"unexpected zero last transition timestamp"
)
t
.
Errorf
(
"unexpected zero last transition timestamp"
)
}
}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
=
u
til
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
=
u
nversioned
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
=
u
til
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
=
u
nversioned
.
Time
{}
if
!
reflect
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
if
!
reflect
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
t
.
Errorf
(
"unexpected objects: %s"
,
util
.
ObjectDiff
(
expectedNode
,
updatedNode
))
t
.
Errorf
(
"unexpected objects: %s"
,
util
.
ObjectDiff
(
expectedNode
,
updatedNode
))
}
}
...
@@ -199,8 +199,8 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
...
@@ -199,8 +199,8 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
Status
:
api
.
ConditionTrue
,
Status
:
api
.
ConditionTrue
,
Reason
:
"KubeletReady"
,
Reason
:
"KubeletReady"
,
Message
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
Message
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
LastHeartbeatTime
:
u
til
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
LastHeartbeatTime
:
u
nversioned
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
LastTransitionTime
:
u
til
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
LastTransitionTime
:
u
nversioned
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
),
},
},
},
},
Capacity
:
api
.
ResourceList
{
Capacity
:
api
.
ResourceList
{
...
@@ -234,8 +234,8 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
...
@@ -234,8 +234,8 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
Status
:
api
.
ConditionTrue
,
Status
:
api
.
ConditionTrue
,
Reason
:
"KubeletReady"
,
Reason
:
"KubeletReady"
,
Message
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
Message
:
fmt
.
Sprintf
(
"kubelet is posting ready status"
),
LastHeartbeatTime
:
u
til
.
Time
{},
// placeholder
LastHeartbeatTime
:
u
nversioned
.
Time
{},
// placeholder
LastTransitionTime
:
u
til
.
Time
{},
// placeholder
LastTransitionTime
:
u
nversioned
.
Time
{},
// placeholder
},
},
},
},
NodeInfo
:
api
.
NodeSystemInfo
{
NodeInfo
:
api
.
NodeSystemInfo
{
...
@@ -278,15 +278,15 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
...
@@ -278,15 +278,15 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
t
.
Errorf
(
"unexpected object type"
)
t
.
Errorf
(
"unexpected object type"
)
}
}
// Expect LastProbeTime to be updated to Now, while LastTransitionTime to be the same.
// Expect LastProbeTime to be updated to Now, while LastTransitionTime to be the same.
if
reflect
.
DeepEqual
(
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
.
Rfc3339Copy
()
.
UTC
(),
u
til
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
)
.
Time
)
{
if
reflect
.
DeepEqual
(
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
.
Rfc3339Copy
()
.
UTC
(),
u
nversioned
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
)
.
Time
)
{
t
.
Errorf
(
"expected
\n
%v
\n
, got
\n
%v"
,
u
til
.
Now
(),
util
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
))
t
.
Errorf
(
"expected
\n
%v
\n
, got
\n
%v"
,
u
nversioned
.
Now
(),
unversioned
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
))
}
}
if
!
reflect
.
DeepEqual
(
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
Rfc3339Copy
()
.
UTC
(),
u
til
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
)
.
Time
)
{
if
!
reflect
.
DeepEqual
(
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
Rfc3339Copy
()
.
UTC
(),
u
nversioned
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
)
.
Time
)
{
t
.
Errorf
(
"expected
\n
%#v
\n
, got
\n
%#v"
,
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
Rfc3339Copy
(),
t
.
Errorf
(
"expected
\n
%#v
\n
, got
\n
%#v"
,
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
Rfc3339Copy
(),
u
til
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
))
u
nversioned
.
Date
(
2012
,
1
,
1
,
0
,
0
,
0
,
0
,
time
.
UTC
))
}
}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
=
u
til
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
=
u
nversioned
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
=
u
til
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
=
u
nversioned
.
Time
{}
if
!
reflect
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
if
!
reflect
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
t
.
Errorf
(
"expected
\n
%v
\n
, got
\n
%v"
,
expectedNode
,
updatedNode
)
t
.
Errorf
(
"expected
\n
%v
\n
, got
\n
%v"
,
expectedNode
,
updatedNode
)
}
}
...
@@ -325,8 +325,8 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) {
...
@@ -325,8 +325,8 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) {
Status
:
api
.
ConditionFalse
,
Status
:
api
.
ConditionFalse
,
Reason
:
"KubeletNotReady"
,
Reason
:
"KubeletNotReady"
,
Message
:
fmt
.
Sprintf
(
"container runtime is down"
),
Message
:
fmt
.
Sprintf
(
"container runtime is down"
),
LastHeartbeatTime
:
u
til
.
Time
{},
LastHeartbeatTime
:
u
nversioned
.
Time
{},
LastTransitionTime
:
u
til
.
Time
{},
LastTransitionTime
:
u
nversioned
.
Time
{},
},
},
},
},
NodeInfo
:
api
.
NodeSystemInfo
{
NodeInfo
:
api
.
NodeSystemInfo
{
...
@@ -375,8 +375,8 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) {
...
@@ -375,8 +375,8 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) {
if
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
IsZero
()
{
if
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
.
IsZero
()
{
t
.
Errorf
(
"unexpected zero last transition timestamp"
)
t
.
Errorf
(
"unexpected zero last transition timestamp"
)
}
}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
=
u
til
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastHeartbeatTime
=
u
nversioned
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
=
u
til
.
Time
{}
updatedNode
.
Status
.
Conditions
[
0
]
.
LastTransitionTime
=
u
nversioned
.
Time
{}
if
!
reflect
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
if
!
reflect
.
DeepEqual
(
expectedNode
,
updatedNode
)
{
t
.
Errorf
(
"unexpected objects: %s"
,
util
.
ObjectDiff
(
expectedNode
,
updatedNode
))
t
.
Errorf
(
"unexpected objects: %s"
,
util
.
ObjectDiff
(
expectedNode
,
updatedNode
))
}
}
...
...
pkg/kubelet/oom_watcher.go
View file @
586cb912
...
@@ -21,6 +21,7 @@ import (
...
@@ -21,6 +21,7 @@ import (
"github.com/google/cadvisor/events"
"github.com/google/cadvisor/events"
cadvisorApi
"github.com/google/cadvisor/info/v1"
cadvisorApi
"github.com/google/cadvisor/info/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
...
@@ -63,7 +64,7 @@ func (ow *realOOMWatcher) Start(ref *api.ObjectReference) error {
...
@@ -63,7 +64,7 @@ func (ow *realOOMWatcher) Start(ref *api.ObjectReference) error {
for
event
:=
range
eventChannel
.
GetChannel
()
{
for
event
:=
range
eventChannel
.
GetChannel
()
{
glog
.
V
(
2
)
.
Infof
(
"Got sys oom event from cadvisor: %v"
,
event
)
glog
.
V
(
2
)
.
Infof
(
"Got sys oom event from cadvisor: %v"
,
event
)
ow
.
recorder
.
PastEventf
(
ref
,
u
til
.
Time
{
Time
:
event
.
Timestamp
},
systemOOMEvent
,
"System OOM encountered"
)
ow
.
recorder
.
PastEventf
(
ref
,
u
nversioned
.
Time
{
Time
:
event
.
Timestamp
},
systemOOMEvent
,
"System OOM encountered"
)
}
}
glog
.
Errorf
(
"Unexpectedly stopped receiving OOM notifications from cAdvisor"
)
glog
.
Errorf
(
"Unexpectedly stopped receiving OOM notifications from cAdvisor"
)
}()
}()
...
...
pkg/kubelet/oom_watcher_test.go
View file @
586cb912
...
@@ -21,14 +21,14 @@ import (
...
@@ -21,14 +21,14 @@ import (
"testing"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
)
type
fakeEvent
struct
{
type
fakeEvent
struct
{
object
runtime
.
Object
object
runtime
.
Object
timestamp
u
til
.
Time
timestamp
u
nversioned
.
Time
reason
string
reason
string
message
string
message
string
}
}
...
@@ -38,14 +38,14 @@ type fakeRecorder struct {
...
@@ -38,14 +38,14 @@ type fakeRecorder struct {
}
}
func
(
f
fakeRecorder
)
Event
(
object
runtime
.
Object
,
reason
,
message
string
)
{
func
(
f
fakeRecorder
)
Event
(
object
runtime
.
Object
,
reason
,
message
string
)
{
f
.
events
=
append
(
f
.
events
,
fakeEvent
{
object
,
u
til
.
Now
(),
reason
,
message
})
f
.
events
=
append
(
f
.
events
,
fakeEvent
{
object
,
u
nversioned
.
Now
(),
reason
,
message
})
}
}
func
(
f
fakeRecorder
)
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
(
f
fakeRecorder
)
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
f
.
events
=
append
(
f
.
events
,
fakeEvent
{
object
,
u
til
.
Now
(),
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
)})
f
.
events
=
append
(
f
.
events
,
fakeEvent
{
object
,
u
nversioned
.
Now
(),
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
)})
}
}
func
(
f
fakeRecorder
)
PastEventf
(
object
runtime
.
Object
,
timestamp
u
til
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
(
f
fakeRecorder
)
PastEventf
(
object
runtime
.
Object
,
timestamp
u
nversioned
.
Time
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
f
.
events
=
append
(
f
.
events
,
fakeEvent
{
object
,
timestamp
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
)})
f
.
events
=
append
(
f
.
events
,
fakeEvent
{
object
,
timestamp
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
)})
}
}
...
...
pkg/kubelet/rkt/pod_info.go
View file @
586cb912
...
@@ -24,8 +24,8 @@ import (
...
@@ -24,8 +24,8 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/util"
)
)
// rkt pod state.
// rkt pod state.
...
@@ -151,7 +151,7 @@ func makeContainerStatus(container *kubecontainer.Container, podInfo *podInfo) a
...
@@ -151,7 +151,7 @@ func makeContainerStatus(container *kubecontainer.Container, podInfo *podInfo) a
// TODO(yifan): Get StartedAt.
// TODO(yifan): Get StartedAt.
status
.
State
=
api
.
ContainerState
{
status
.
State
=
api
.
ContainerState
{
Running
:
&
api
.
ContainerStateRunning
{
Running
:
&
api
.
ContainerStateRunning
{
StartedAt
:
u
til
.
Unix
(
container
.
Created
,
0
),
StartedAt
:
u
nversioned
.
Unix
(
container
.
Created
,
0
),
},
},
}
}
case
Embryo
,
Preparing
,
Prepared
:
case
Embryo
,
Preparing
,
Prepared
:
...
@@ -166,7 +166,7 @@ func makeContainerStatus(container *kubecontainer.Container, podInfo *podInfo) a
...
@@ -166,7 +166,7 @@ func makeContainerStatus(container *kubecontainer.Container, podInfo *podInfo) a
status
.
State
=
api
.
ContainerState
{
status
.
State
=
api
.
ContainerState
{
Terminated
:
&
api
.
ContainerStateTerminated
{
Terminated
:
&
api
.
ContainerStateTerminated
{
ExitCode
:
exitCode
,
ExitCode
:
exitCode
,
StartedAt
:
u
til
.
Unix
(
container
.
Created
,
0
),
StartedAt
:
u
nversioned
.
Unix
(
container
.
Created
,
0
),
},
},
}
}
default
:
default
:
...
...
pkg/kubelet/status/manager.go
View file @
586cb912
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
kubeletTypes
"k8s.io/kubernetes/pkg/kubelet/types"
kubeletTypes
"k8s.io/kubernetes/pkg/kubelet/types"
kubeletUtil
"k8s.io/kubernetes/pkg/kubelet/util"
kubeletUtil
"k8s.io/kubernetes/pkg/kubelet/util"
...
@@ -133,7 +134,7 @@ func (m *manager) SetPodStatus(pod *api.Pod, status api.PodStatus) {
...
@@ -133,7 +134,7 @@ func (m *manager) SetPodStatus(pod *api.Pod, status api.PodStatus) {
if
status
.
StartTime
.
IsZero
()
{
if
status
.
StartTime
.
IsZero
()
{
if
pod
.
Status
.
StartTime
.
IsZero
()
{
if
pod
.
Status
.
StartTime
.
IsZero
()
{
// the pod did not have a previously recorded value so set to now
// the pod did not have a previously recorded value so set to now
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
status
.
StartTime
=
&
now
status
.
StartTime
=
&
now
}
else
{
}
else
{
// the pod had a recorded value, but the kubelet restarted so we need to rebuild cache
// the pod had a recorded value, but the kubelet restarted so we need to rebuild cache
...
...
pkg/kubelet/status/manager_test.go
View file @
586cb912
...
@@ -24,9 +24,9 @@ import (
...
@@ -24,9 +24,9 @@ import (
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/util"
)
)
var
testPod
*
api
.
Pod
=
&
api
.
Pod
{
var
testPod
*
api
.
Pod
=
&
api
.
Pod
{
...
@@ -109,8 +109,8 @@ func TestNewStatusPreservesPodStartTime(t *testing.T) {
...
@@ -109,8 +109,8 @@ func TestNewStatusPreservesPodStartTime(t *testing.T) {
},
},
Status
:
api
.
PodStatus
{},
Status
:
api
.
PodStatus
{},
}
}
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
startTime
:=
u
til
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
startTime
:=
u
nversioned
.
NewTime
(
now
.
Time
.
Add
(
-
1
*
time
.
Minute
))
pod
.
Status
.
StartTime
=
&
startTime
pod
.
Status
.
StartTime
=
&
startTime
syncer
.
SetPodStatus
(
pod
,
getRandomPodStatus
())
syncer
.
SetPodStatus
(
pod
,
getRandomPodStatus
())
...
@@ -129,7 +129,7 @@ func TestChangedStatus(t *testing.T) {
...
@@ -129,7 +129,7 @@ func TestChangedStatus(t *testing.T) {
func
TestChangedStatusKeepsStartTime
(
t
*
testing
.
T
)
{
func
TestChangedStatusKeepsStartTime
(
t
*
testing
.
T
)
{
syncer
:=
newTestManager
()
syncer
:=
newTestManager
()
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
firstStatus
:=
getRandomPodStatus
()
firstStatus
:=
getRandomPodStatus
()
firstStatus
.
StartTime
=
&
now
firstStatus
.
StartTime
=
&
now
syncer
.
SetPodStatus
(
testPod
,
firstStatus
)
syncer
.
SetPodStatus
(
testPod
,
firstStatus
)
...
...
pkg/proxy/iptables/proxier_test.go
View file @
586cb912
...
@@ -17,8 +17,9 @@ limitations under the License.
...
@@ -17,8 +17,9 @@ limitations under the License.
package
iptables
package
iptables
import
(
import
(
utiliptables
"k8s.io/kubernetes/pkg/util/iptables"
"testing"
"testing"
utiliptables
"k8s.io/kubernetes/pkg/util/iptables"
)
)
func
checkAllLines
(
t
*
testing
.
T
,
table
utiliptables
.
Table
,
save
[]
byte
,
expectedLines
map
[
utiliptables
.
Chain
]
string
)
{
func
checkAllLines
(
t
*
testing
.
T
,
table
utiliptables
.
Table
,
save
[]
byte
,
expectedLines
map
[
utiliptables
.
Chain
]
string
)
{
...
...
pkg/registry/namespace/etcd/etcd.go
View file @
586cb912
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
apierrors
"k8s.io/kubernetes/pkg/api/errors"
apierrors
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/registry/generic"
...
@@ -29,7 +30,6 @@ import (
...
@@ -29,7 +30,6 @@ import (
"k8s.io/kubernetes/pkg/registry/namespace"
"k8s.io/kubernetes/pkg/registry/namespace"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/util"
)
)
// rest implements a RESTStorage for namespaces against etcd
// rest implements a RESTStorage for namespaces against etcd
...
@@ -95,7 +95,7 @@ func (r *REST) Delete(ctx api.Context, name string, options *api.DeleteOptions)
...
@@ -95,7 +95,7 @@ func (r *REST) Delete(ctx api.Context, name string, options *api.DeleteOptions)
// upon first request to delete, we switch the phase to start namespace termination
// upon first request to delete, we switch the phase to start namespace termination
if
namespace
.
DeletionTimestamp
.
IsZero
()
{
if
namespace
.
DeletionTimestamp
.
IsZero
()
{
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
namespace
.
DeletionTimestamp
=
&
now
namespace
.
DeletionTimestamp
=
&
now
namespace
.
Status
.
Phase
=
api
.
NamespaceTerminating
namespace
.
Status
.
Phase
=
api
.
NamespaceTerminating
result
,
_
,
err
:=
r
.
status
.
Update
(
ctx
,
namespace
)
result
,
_
,
err
:=
r
.
status
.
Update
(
ctx
,
namespace
)
...
...
pkg/registry/namespace/etcd/etcd_test.go
View file @
586cb912
...
@@ -21,13 +21,13 @@ import (
...
@@ -21,13 +21,13 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/registrytest"
"k8s.io/kubernetes/pkg/registry/registrytest"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/tools"
"k8s.io/kubernetes/pkg/tools"
"k8s.io/kubernetes/pkg/tools/etcdtest"
"k8s.io/kubernetes/pkg/tools/etcdtest"
"k8s.io/kubernetes/pkg/util"
)
)
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
tools
.
FakeEtcdClient
)
{
func
newStorage
(
t
*
testing
.
T
)
(
*
REST
,
*
tools
.
FakeEtcdClient
)
{
...
@@ -129,7 +129,7 @@ func TestDeleteNamespaceWithIncompleteFinalizers(t *testing.T) {
...
@@ -129,7 +129,7 @@ func TestDeleteNamespaceWithIncompleteFinalizers(t *testing.T) {
storage
,
fakeClient
:=
newStorage
(
t
)
storage
,
fakeClient
:=
newStorage
(
t
)
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
ctx
:=
api
.
NewContext
()
ctx
:=
api
.
NewContext
()
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
namespace
:=
&
api
.
Namespace
{
namespace
:=
&
api
.
Namespace
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Name
:
"foo"
,
...
@@ -152,7 +152,7 @@ func TestDeleteNamespaceWithCompleteFinalizers(t *testing.T) {
...
@@ -152,7 +152,7 @@ func TestDeleteNamespaceWithCompleteFinalizers(t *testing.T) {
storage
,
fakeClient
:=
newStorage
(
t
)
storage
,
fakeClient
:=
newStorage
(
t
)
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
key
:=
etcdtest
.
AddPrefix
(
"namespaces/foo"
)
ctx
:=
api
.
NewContext
()
ctx
:=
api
.
NewContext
()
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
namespace
:=
&
api
.
Namespace
{
namespace
:=
&
api
.
Namespace
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
Name
:
"foo"
,
...
...
pkg/registry/namespace/strategy_test.go
View file @
586cb912
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"testing"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/
util
"
"k8s.io/kubernetes/pkg/
api/unversioned
"
)
)
func
TestNamespaceStrategy
(
t
*
testing
.
T
)
{
func
TestNamespaceStrategy
(
t
*
testing
.
T
)
{
...
@@ -71,7 +71,7 @@ func TestNamespaceStatusStrategy(t *testing.T) {
...
@@ -71,7 +71,7 @@ func TestNamespaceStatusStrategy(t *testing.T) {
if
StatusStrategy
.
AllowCreateOnUpdate
()
{
if
StatusStrategy
.
AllowCreateOnUpdate
()
{
t
.
Errorf
(
"Namespaces should not allow create on update"
)
t
.
Errorf
(
"Namespaces should not allow create on update"
)
}
}
now
:=
u
til
.
Now
()
now
:=
u
nversioned
.
Now
()
oldNamespace
:=
&
api
.
Namespace
{
oldNamespace
:=
&
api
.
Namespace
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
ResourceVersion
:
"10"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"foo"
,
ResourceVersion
:
"10"
},
Spec
:
api
.
NamespaceSpec
{
Finalizers
:
[]
api
.
FinalizerName
{
"kubernetes"
}},
Spec
:
api
.
NamespaceSpec
{
Finalizers
:
[]
api
.
FinalizerName
{
"kubernetes"
}},
...
...
pkg/registry/service/ipallocator/allocator.go
View file @
586cb912
...
@@ -19,10 +19,11 @@ package ipallocator
...
@@ -19,10 +19,11 @@ package ipallocator
import
(
import
(
"errors"
"errors"
"fmt"
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/registry/service/allocator"
"math/big"
"math/big"
"net"
"net"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/registry/service/allocator"
)
)
// Interface manages the allocation of IP addresses out of a range. Interface
// Interface manages the allocation of IP addresses out of a range. Interface
...
...
pkg/registry/service/portallocator/allocator.go
View file @
586cb912
...
@@ -19,6 +19,7 @@ package portallocator
...
@@ -19,6 +19,7 @@ package portallocator
import
(
import
(
"errors"
"errors"
"fmt"
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/registry/service/allocator"
"k8s.io/kubernetes/pkg/registry/service/allocator"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
...
...
pkg/registry/thirdpartyresourcedata/codec_test.go
View file @
586cb912
...
@@ -25,7 +25,6 @@ import (
...
@@ -25,7 +25,6 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/util"
)
)
type
Foo
struct
{
type
Foo
struct
{
...
@@ -66,7 +65,7 @@ func TestCodec(t *testing.T) {
...
@@ -66,7 +65,7 @@ func TestCodec(t *testing.T) {
obj
:
&
Foo
{
obj
:
&
Foo
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"bar"
,
Name
:
"bar"
,
CreationTimestamp
:
u
til
.
Time
{
time
.
Unix
(
100
,
0
)},
CreationTimestamp
:
u
nversioned
.
Time
{
time
.
Unix
(
100
,
0
)},
},
},
TypeMeta
:
unversioned
.
TypeMeta
{
Kind
:
"Foo"
},
TypeMeta
:
unversioned
.
TypeMeta
{
Kind
:
"Foo"
},
},
},
...
...
pkg/storage/cacher_test.go
View file @
586cb912
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage"
...
@@ -171,7 +172,7 @@ func TestListFromMemory(t *testing.T) {
...
@@ -171,7 +172,7 @@ func TestListFromMemory(t *testing.T) {
for
_
,
item
:=
range
result
.
Items
{
for
_
,
item
:=
range
result
.
Items
{
// unset fields that are set by the infrastructure
// unset fields that are set by the infrastructure
item
.
ObjectMeta
.
ResourceVersion
=
""
item
.
ObjectMeta
.
ResourceVersion
=
""
item
.
ObjectMeta
.
CreationTimestamp
=
u
til
.
Time
{}
item
.
ObjectMeta
.
CreationTimestamp
=
u
nversioned
.
Time
{}
var
expected
*
api
.
Pod
var
expected
*
api
.
Pod
switch
item
.
ObjectMeta
.
Name
{
switch
item
.
ObjectMeta
.
Name
{
...
@@ -268,7 +269,7 @@ func TestWatch(t *testing.T) {
...
@@ -268,7 +269,7 @@ func TestWatch(t *testing.T) {
// unset fields that are set by the infrastructure
// unset fields that are set by the infrastructure
obj
:=
event
.
Object
.
(
*
api
.
Pod
)
obj
:=
event
.
Object
.
(
*
api
.
Pod
)
obj
.
ObjectMeta
.
ResourceVersion
=
""
obj
.
ObjectMeta
.
ResourceVersion
=
""
obj
.
ObjectMeta
.
CreationTimestamp
=
u
til
.
Time
{}
obj
.
ObjectMeta
.
CreationTimestamp
=
u
nversioned
.
Time
{}
if
e
,
a
:=
test
.
object
,
obj
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
test
.
object
,
obj
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"expected: %#v, got: %#v"
,
e
,
a
)
t
.
Errorf
(
"expected: %#v, got: %#v"
,
e
,
a
)
}
}
...
@@ -295,7 +296,7 @@ func TestWatch(t *testing.T) {
...
@@ -295,7 +296,7 @@ func TestWatch(t *testing.T) {
// unset fields that are set by the infrastructure
// unset fields that are set by the infrastructure
obj
:=
event
.
Object
.
(
*
api
.
Pod
)
obj
:=
event
.
Object
.
(
*
api
.
Pod
)
obj
.
ObjectMeta
.
ResourceVersion
=
""
obj
.
ObjectMeta
.
ResourceVersion
=
""
obj
.
ObjectMeta
.
CreationTimestamp
=
u
til
.
Time
{}
obj
.
ObjectMeta
.
CreationTimestamp
=
u
nversioned
.
Time
{}
if
e
,
a
:=
test
.
object
,
obj
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
test
.
object
,
obj
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"expected: %#v, got: %#v"
,
e
,
a
)
t
.
Errorf
(
"expected: %#v, got: %#v"
,
e
,
a
)
}
}
...
@@ -468,7 +469,7 @@ func TestFiltering(t *testing.T) {
...
@@ -468,7 +469,7 @@ func TestFiltering(t *testing.T) {
// unset fields that are set by the infrastructure
// unset fields that are set by the infrastructure
obj
:=
event
.
Object
.
(
*
api
.
Pod
)
obj
:=
event
.
Object
.
(
*
api
.
Pod
)
obj
.
ObjectMeta
.
ResourceVersion
=
""
obj
.
ObjectMeta
.
ResourceVersion
=
""
obj
.
ObjectMeta
.
CreationTimestamp
=
u
til
.
Time
{}
obj
.
ObjectMeta
.
CreationTimestamp
=
u
nversioned
.
Time
{}
if
e
,
a
:=
test
.
object
,
obj
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
if
e
,
a
:=
test
.
object
,
obj
;
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"expected: %#v, got: %#v"
,
e
,
a
)
t
.
Errorf
(
"expected: %#v, got: %#v"
,
e
,
a
)
}
}
...
...
pkg/storage/etcd/api_object_versioner.go
View file @
586cb912
...
@@ -21,9 +21,9 @@ import (
...
@@ -21,9 +21,9 @@ import (
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/util"
)
)
// APIObjectVersioner implements versioning and extracting etcd node information
// APIObjectVersioner implements versioning and extracting etcd node information
...
@@ -37,7 +37,7 @@ func (a APIObjectVersioner) UpdateObject(obj runtime.Object, expiration *time.Ti
...
@@ -37,7 +37,7 @@ func (a APIObjectVersioner) UpdateObject(obj runtime.Object, expiration *time.Ti
return
err
return
err
}
}
if
expiration
!=
nil
{
if
expiration
!=
nil
{
objectMeta
.
DeletionTimestamp
=
&
u
til
.
Time
{
Time
:
*
expiration
}
objectMeta
.
DeletionTimestamp
=
&
u
nversioned
.
Time
{
Time
:
*
expiration
}
}
}
versionString
:=
""
versionString
:=
""
if
resourceVersion
!=
0
{
if
resourceVersion
!=
0
{
...
...
pkg/storage/etcd/api_object_versioner_test.go
View file @
586cb912
...
@@ -21,7 +21,7 @@ import (
...
@@ -21,7 +21,7 @@ import (
"time"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/
util
"
"k8s.io/kubernetes/pkg/
api/unversioned
"
)
)
func
TestObjectVersioner
(
t
*
testing
.
T
)
{
func
TestObjectVersioner
(
t
*
testing
.
T
)
{
...
@@ -39,7 +39,7 @@ func TestObjectVersioner(t *testing.T) {
...
@@ -39,7 +39,7 @@ func TestObjectVersioner(t *testing.T) {
if
obj
.
ResourceVersion
!=
"5"
||
obj
.
DeletionTimestamp
!=
nil
{
if
obj
.
ResourceVersion
!=
"5"
||
obj
.
DeletionTimestamp
!=
nil
{
t
.
Errorf
(
"unexpected resource version: %#v"
,
obj
)
t
.
Errorf
(
"unexpected resource version: %#v"
,
obj
)
}
}
now
:=
u
til
.
Time
{
Time
:
time
.
Now
()}
now
:=
u
nversioned
.
Time
{
Time
:
time
.
Now
()}
obj
=
&
TestResource
{
ObjectMeta
:
api
.
ObjectMeta
{
ResourceVersion
:
"a"
}}
obj
=
&
TestResource
{
ObjectMeta
:
api
.
ObjectMeta
{
ResourceVersion
:
"a"
}}
if
err
:=
v
.
UpdateObject
(
obj
,
&
now
.
Time
,
5
);
err
!=
nil
{
if
err
:=
v
.
UpdateObject
(
obj
,
&
now
.
Time
,
5
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected error: %v"
,
err
)
t
.
Fatalf
(
"unexpected error: %v"
,
err
)
...
...
pkg/util/io/io_test.go
View file @
586cb912
...
@@ -18,13 +18,14 @@ package io_test
...
@@ -18,13 +18,14 @@ package io_test
import
(
import
(
"fmt"
"fmt"
"os"
"testing"
"github.com/pborman/uuid"
"github.com/pborman/uuid"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/util/io"
"k8s.io/kubernetes/pkg/util/io"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
"os"
"testing"
)
)
func
TestSavePodToFile
(
t
*
testing
.
T
)
{
func
TestSavePodToFile
(
t
*
testing
.
T
)
{
...
...
pkg/util/slice/slice.go
View file @
586cb912
...
@@ -18,8 +18,9 @@ limitations under the License.
...
@@ -18,8 +18,9 @@ limitations under the License.
package
slice
package
slice
import
(
import
(
utilrand
"k8s.io/kubernetes/pkg/util/rand"
"sort"
"sort"
utilrand
"k8s.io/kubernetes/pkg/util/rand"
)
)
// CopyStrings copies the contents of the specified string slice
// CopyStrings copies the contents of the specified string slice
...
...
pkg/util/ssh_test.go
View file @
586cb912
...
@@ -18,15 +18,15 @@ package util
...
@@ -18,15 +18,15 @@ package util
import
(
import
(
"fmt"
"fmt"
"io"
"net"
"net"
"os"
"reflect"
"reflect"
"strings"
"testing"
"testing"
"github.com/golang/glog"
"github.com/golang/glog"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh"
"io"
"os"
"strings"
)
)
type
testSSHServer
struct
{
type
testSSHServer
struct
{
...
...
pkg/volume/util_test.go
View file @
586cb912
...
@@ -18,11 +18,11 @@ package volume
...
@@ -18,11 +18,11 @@ package volume
import
(
import
(
"fmt"
"fmt"
"strings"
"testing"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"strings"
)
)
func
TestRecyclerSuccess
(
t
*
testing
.
T
)
{
func
TestRecyclerSuccess
(
t
*
testing
.
T
)
{
...
...
test/e2e/density.go
View file @
586cb912
...
@@ -254,11 +254,11 @@ var _ = Describe("Density", func() {
...
@@ -254,11 +254,11 @@ var _ = Describe("Density", func() {
if
itArg
.
runLatencyTest
{
if
itArg
.
runLatencyTest
{
Logf
(
"Schedling additional Pods to measure startup latencies"
)
Logf
(
"Schedling additional Pods to measure startup latencies"
)
createTimes
:=
make
(
map
[
string
]
u
til
.
Time
,
0
)
createTimes
:=
make
(
map
[
string
]
u
nversioned
.
Time
,
0
)
nodes
:=
make
(
map
[
string
]
string
,
0
)
nodes
:=
make
(
map
[
string
]
string
,
0
)
scheduleTimes
:=
make
(
map
[
string
]
u
til
.
Time
,
0
)
scheduleTimes
:=
make
(
map
[
string
]
u
nversioned
.
Time
,
0
)
runTimes
:=
make
(
map
[
string
]
u
til
.
Time
,
0
)
runTimes
:=
make
(
map
[
string
]
u
nversioned
.
Time
,
0
)
watchTimes
:=
make
(
map
[
string
]
u
til
.
Time
,
0
)
watchTimes
:=
make
(
map
[
string
]
u
nversioned
.
Time
,
0
)
var
mutex
sync
.
Mutex
var
mutex
sync
.
Mutex
checkPod
:=
func
(
p
*
api
.
Pod
)
{
checkPod
:=
func
(
p
*
api
.
Pod
)
{
...
@@ -268,10 +268,10 @@ var _ = Describe("Density", func() {
...
@@ -268,10 +268,10 @@ var _ = Describe("Density", func() {
if
p
.
Status
.
Phase
==
api
.
PodRunning
{
if
p
.
Status
.
Phase
==
api
.
PodRunning
{
if
_
,
found
:=
watchTimes
[
p
.
Name
];
!
found
{
if
_
,
found
:=
watchTimes
[
p
.
Name
];
!
found
{
watchTimes
[
p
.
Name
]
=
u
til
.
Now
()
watchTimes
[
p
.
Name
]
=
u
nversioned
.
Now
()
createTimes
[
p
.
Name
]
=
p
.
CreationTimestamp
createTimes
[
p
.
Name
]
=
p
.
CreationTimestamp
nodes
[
p
.
Name
]
=
p
.
Spec
.
NodeName
nodes
[
p
.
Name
]
=
p
.
Spec
.
NodeName
var
startTime
u
til
.
Time
var
startTime
u
nversioned
.
Time
for
_
,
cs
:=
range
p
.
Status
.
ContainerStatuses
{
for
_
,
cs
:=
range
p
.
Status
.
ContainerStatuses
{
if
cs
.
State
.
Running
!=
nil
{
if
cs
.
State
.
Running
!=
nil
{
if
startTime
.
Before
(
cs
.
State
.
Running
.
StartedAt
)
{
if
startTime
.
Before
(
cs
.
State
.
Running
.
StartedAt
)
{
...
@@ -279,7 +279,7 @@ var _ = Describe("Density", func() {
...
@@ -279,7 +279,7 @@ var _ = Describe("Density", func() {
}
}
}
}
}
}
if
startTime
!=
u
til
.
NewTime
(
time
.
Time
{})
{
if
startTime
!=
u
nversioned
.
NewTime
(
time
.
Time
{})
{
runTimes
[
p
.
Name
]
=
startTime
runTimes
[
p
.
Name
]
=
startTime
}
else
{
}
else
{
Failf
(
"Pod %v is reported to be running, but none of its containers is"
,
p
.
Name
)
Failf
(
"Pod %v is reported to be running, but none of its containers is"
,
p
.
Name
)
...
...
test/e2e/google_compute.go
View file @
586cb912
...
@@ -18,10 +18,11 @@ package e2e
...
@@ -18,10 +18,11 @@ package e2e
import
(
import
(
"fmt"
"fmt"
"github.com/golang/glog"
"os/exec"
"os/exec"
"regexp"
"regexp"
"strings"
"strings"
"github.com/golang/glog"
)
)
func
createGCEStaticIP
(
name
string
)
(
string
,
error
)
{
func
createGCEStaticIP
(
name
string
)
(
string
,
error
)
{
...
...
test/e2e/prompush.go
View file @
586cb912
...
@@ -19,6 +19,7 @@ package e2e
...
@@ -19,6 +19,7 @@ package e2e
import
(
import
(
"fmt"
"fmt"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus"
)
)
...
...
test/integration/scheduler_test.go
View file @
586cb912
...
@@ -31,12 +31,12 @@ import (
...
@@ -31,12 +31,12 @@ import (
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apiserver"
"k8s.io/kubernetes/pkg/apiserver"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
client
"k8s.io/kubernetes/pkg/client/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/master"
"k8s.io/kubernetes/pkg/master"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/plugin/pkg/admission/admit"
"k8s.io/kubernetes/plugin/pkg/admission/admit"
"k8s.io/kubernetes/plugin/pkg/scheduler"
"k8s.io/kubernetes/plugin/pkg/scheduler"
...
@@ -127,13 +127,13 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
...
@@ -127,13 +127,13 @@ func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore
Type
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionTrue
,
Status
:
api
.
ConditionTrue
,
Reason
:
fmt
.
Sprintf
(
"schedulable condition"
),
Reason
:
fmt
.
Sprintf
(
"schedulable condition"
),
LastHeartbeatTime
:
u
til
.
Time
{
time
.
Now
()},
LastHeartbeatTime
:
u
nversioned
.
Time
{
time
.
Now
()},
}
}
badCondition
:=
api
.
NodeCondition
{
badCondition
:=
api
.
NodeCondition
{
Type
:
api
.
NodeReady
,
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionUnknown
,
Status
:
api
.
ConditionUnknown
,
Reason
:
fmt
.
Sprintf
(
"unschedulable condition"
),
Reason
:
fmt
.
Sprintf
(
"unschedulable condition"
),
LastHeartbeatTime
:
u
til
.
Time
{
time
.
Now
()},
LastHeartbeatTime
:
u
nversioned
.
Time
{
time
.
Now
()},
}
}
// Create a new schedulable node, since we're first going to apply
// Create a new schedulable node, since we're first going to apply
// the unschedulable condition and verify that pods aren't scheduled.
// the unschedulable condition and verify that pods aren't scheduled.
...
...
third_party/golang/template/exec.go
View file @
586cb912
...
@@ -2,9 +2,10 @@
...
@@ -2,9 +2,10 @@
//The original private functions indirect and printableValue
//The original private functions indirect and printableValue
//are exported as public functions.
//are exported as public functions.
package
template
package
template
import
(
import
(
"reflect"
"fmt"
"fmt"
"reflect"
)
)
var
Indirect
=
indirect
var
Indirect
=
indirect
...
@@ -15,7 +16,6 @@ var (
...
@@ -15,7 +16,6 @@ var (
fmtStringerType
=
reflect
.
TypeOf
((
*
fmt
.
Stringer
)(
nil
))
.
Elem
()
fmtStringerType
=
reflect
.
TypeOf
((
*
fmt
.
Stringer
)(
nil
))
.
Elem
()
)
)
// indirect returns the item at the end of indirection, and a bool to indicate if it's nil.
// indirect returns the item at the end of indirection, and a bool to indicate if it's nil.
// We indirect through pointers and empty interfaces (only) because
// We indirect through pointers and empty interfaces (only) because
// non-empty interfaces have methods we might need.
// non-empty interfaces have methods we might need.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment