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
db48dcf5
Commit
db48dcf5
authored
Mar 09, 2016
by
Madhusudan.C.S
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ReplicaSetSpec.Template shouldn't be a pointer.
PodTemplateSpec should be consistent for all the types in extensions/v1beta1. See PR #19510.
parent
108f7226
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
75 additions
and
92 deletions
+75
-92
types.go
pkg/apis/extensions/types.go
+1
-1
conversion.go
pkg/apis/extensions/v1beta1/conversion.go
+5
-14
defaults.go
pkg/apis/extensions/v1beta1/defaults.go
+2
-4
defaults_test.go
pkg/apis/extensions/v1beta1/defaults_test.go
+8
-8
types.go
pkg/apis/extensions/v1beta1/types.go
+1
-1
validation.go
pkg/apis/extensions/validation/validation.go
+1
-1
validation_test.go
pkg/apis/extensions/validation/validation_test.go
+29
-29
replica_sets_test.go
pkg/client/unversioned/replica_sets_test.go
+5
-5
deployment_controller.go
pkg/controller/deployment/deployment_controller.go
+3
-3
deployment_controller_test.go
pkg/controller/deployment/deployment_controller_test.go
+2
-2
replica_set.go
pkg/controller/replicaset/replica_set.go
+1
-1
replica_set_test.go
pkg/controller/replicaset/replica_set_test.go
+1
-1
describe.go
pkg/kubectl/describe.go
+2
-8
history.go
pkg/kubectl/history.go
+1
-1
stop_test.go
pkg/kubectl/stop_test.go
+1
-1
etcd_test.go
pkg/registry/replicaset/etcd/etcd_test.go
+1
-1
strategy_test.go
pkg/registry/replicaset/strategy_test.go
+3
-3
deployment.go
pkg/util/deployment/deployment.go
+2
-2
deployment_test.go
pkg/util/deployment/deployment_test.go
+2
-2
deployment.go
test/e2e/deployment.go
+1
-1
replica_set.go
test/e2e/replica_set.go
+1
-1
util.go
test/e2e/util.go
+2
-2
No files found.
pkg/apis/extensions/types.go
View file @
db48dcf5
...
@@ -807,7 +807,7 @@ type ReplicaSetSpec struct {
...
@@ -807,7 +807,7 @@ type ReplicaSetSpec struct {
// Template is the object that describes the pod that will be created if
// Template is the object that describes the pod that will be created if
// insufficient replicas are detected.
// insufficient replicas are detected.
Template
*
api
.
PodTemplateSpec
`json:"template,omitempty"`
Template
api
.
PodTemplateSpec
`json:"template,omitempty"`
}
}
// ReplicaSetStatus represents the current status of a ReplicaSet.
// ReplicaSetStatus represents the current status of a ReplicaSet.
...
...
pkg/apis/extensions/v1beta1/conversion.go
View file @
db48dcf5
...
@@ -297,13 +297,9 @@ func Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec(in *extensions.
...
@@ -297,13 +297,9 @@ func Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec(in *extensions.
}
else
{
}
else
{
out
.
Selector
=
nil
out
.
Selector
=
nil
}
}
if
in
.
Template
!=
nil
{
out
.
Template
=
new
(
v1
.
PodTemplateSpec
)
if
err
:=
v1
.
Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec
(
&
in
.
Template
,
&
out
.
Template
,
s
);
err
!=
nil
{
if
err
:=
v1
.
Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec
(
in
.
Template
,
out
.
Template
,
s
);
err
!=
nil
{
return
err
return
err
}
}
else
{
out
.
Template
=
nil
}
}
return
nil
return
nil
}
}
...
@@ -323,13 +319,8 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS
...
@@ -323,13 +319,8 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS
}
else
{
}
else
{
out
.
Selector
=
nil
out
.
Selector
=
nil
}
}
if
in
.
Template
!=
nil
{
if
err
:=
v1
.
Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec
(
&
in
.
Template
,
&
out
.
Template
,
s
);
err
!=
nil
{
out
.
Template
=
new
(
api
.
PodTemplateSpec
)
return
err
if
err
:=
v1
.
Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec
(
in
.
Template
,
out
.
Template
,
s
);
err
!=
nil
{
return
err
}
}
else
{
out
.
Template
=
nil
}
}
return
nil
return
nil
}
}
...
...
pkg/apis/extensions/v1beta1/defaults.go
View file @
db48dcf5
...
@@ -118,10 +118,8 @@ func addDefaultingFuncs(scheme *runtime.Scheme) {
...
@@ -118,10 +118,8 @@ func addDefaultingFuncs(scheme *runtime.Scheme) {
}
}
},
},
func
(
obj
*
ReplicaSet
)
{
func
(
obj
*
ReplicaSet
)
{
var
labels
map
[
string
]
string
labels
:=
obj
.
Spec
.
Template
.
Labels
if
obj
.
Spec
.
Template
!=
nil
{
labels
=
obj
.
Spec
.
Template
.
Labels
}
// TODO: support templates defined elsewhere when we support them in the API
// TODO: support templates defined elsewhere when we support them in the API
if
labels
!=
nil
{
if
labels
!=
nil
{
if
obj
.
Spec
.
Selector
==
nil
{
if
obj
.
Spec
.
Selector
==
nil
{
...
...
pkg/apis/extensions/v1beta1/defaults_test.go
View file @
db48dcf5
...
@@ -426,7 +426,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
...
@@ -426,7 +426,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
{
{
rs
:
&
ReplicaSet
{
rs
:
&
ReplicaSet
{
Spec
:
ReplicaSetSpec
{
Spec
:
ReplicaSetSpec
{
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
@@ -446,7 +446,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
...
@@ -446,7 +446,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
},
},
},
},
Spec
:
ReplicaSetSpec
{
Spec
:
ReplicaSetSpec
{
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
@@ -471,7 +471,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
...
@@ -471,7 +471,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
"some"
:
"other"
,
"some"
:
"other"
,
},
},
},
},
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
@@ -491,7 +491,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
...
@@ -491,7 +491,7 @@ func TestSetDefaultReplicaSet(t *testing.T) {
"some"
:
"other"
,
"some"
:
"other"
,
},
},
},
},
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
@@ -538,7 +538,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
...
@@ -538,7 +538,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
{
{
rs
:
ReplicaSet
{
rs
:
ReplicaSet
{
Spec
:
ReplicaSetSpec
{
Spec
:
ReplicaSetSpec
{
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
@@ -553,7 +553,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
...
@@ -553,7 +553,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
rs
:
ReplicaSet
{
rs
:
ReplicaSet
{
Spec
:
ReplicaSetSpec
{
Spec
:
ReplicaSetSpec
{
Replicas
:
newInt32
(
0
),
Replicas
:
newInt32
(
0
),
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
@@ -568,7 +568,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
...
@@ -568,7 +568,7 @@ func TestSetDefaultReplicaSetReplicas(t *testing.T) {
rs
:
ReplicaSet
{
rs
:
ReplicaSet
{
Spec
:
ReplicaSetSpec
{
Spec
:
ReplicaSetSpec
{
Replicas
:
newInt32
(
3
),
Replicas
:
newInt32
(
3
),
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
@@ -611,7 +611,7 @@ func TestDefaultRequestIsNotSetForReplicaSet(t *testing.T) {
...
@@ -611,7 +611,7 @@ func TestDefaultRequestIsNotSetForReplicaSet(t *testing.T) {
rs
:=
&
ReplicaSet
{
rs
:=
&
ReplicaSet
{
Spec
:
ReplicaSetSpec
{
Spec
:
ReplicaSetSpec
{
Replicas
:
newInt32
(
3
),
Replicas
:
newInt32
(
3
),
Template
:
&
v1
.
PodTemplateSpec
{
Template
:
v1
.
PodTemplateSpec
{
ObjectMeta
:
v1
.
ObjectMeta
{
ObjectMeta
:
v1
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"foo"
:
"bar"
,
"foo"
:
"bar"
,
...
...
pkg/apis/extensions/v1beta1/types.go
View file @
db48dcf5
...
@@ -898,7 +898,7 @@ type ReplicaSetSpec struct {
...
@@ -898,7 +898,7 @@ type ReplicaSetSpec struct {
// Template is the object that describes the pod that will be created if
// Template is the object that describes the pod that will be created if
// insufficient replicas are detected.
// insufficient replicas are detected.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#pod-template
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#pod-template
Template
*
v1
.
PodTemplateSpec
`json:"template,omitempty"`
Template
v1
.
PodTemplateSpec
`json:"template,omitempty"`
}
}
// ReplicaSetStatus represents the current status of a ReplicaSet.
// ReplicaSetStatus represents the current status of a ReplicaSet.
...
...
pkg/apis/extensions/validation/validation.go
View file @
db48dcf5
...
@@ -710,7 +710,7 @@ func ValidateReplicaSetSpec(spec *extensions.ReplicaSetSpec, fldPath *field.Path
...
@@ -710,7 +710,7 @@ func ValidateReplicaSetSpec(spec *extensions.ReplicaSetSpec, fldPath *field.Path
if
err
!=
nil
{
if
err
!=
nil
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"selector"
),
spec
.
Selector
,
"invalid label selector."
))
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"selector"
),
spec
.
Selector
,
"invalid label selector."
))
}
else
{
}
else
{
allErrs
=
append
(
allErrs
,
ValidatePodTemplateSpecForReplicaSet
(
spec
.
Template
,
selector
,
spec
.
Replicas
,
fldPath
.
Child
(
"template"
))
...
)
allErrs
=
append
(
allErrs
,
ValidatePodTemplateSpecForReplicaSet
(
&
spec
.
Template
,
selector
,
spec
.
Replicas
,
fldPath
.
Child
(
"template"
))
...
)
}
}
return
allErrs
return
allErrs
}
}
...
...
pkg/apis/extensions/validation/validation_test.go
View file @
db48dcf5
...
@@ -1446,7 +1446,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
...
@@ -1446,7 +1446,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
2
,
Replicas
:
2
,
...
@@ -1457,7 +1457,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
...
@@ -1457,7 +1457,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
3
,
Replicas
:
3
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
4
,
Replicas
:
4
,
...
@@ -1478,7 +1478,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
...
@@ -1478,7 +1478,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
3
,
Replicas
:
3
,
...
@@ -1489,7 +1489,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
...
@@ -1489,7 +1489,7 @@ func TestValidateReplicaSetStatusUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
-
3
,
Replicas
:
-
3
,
...
@@ -1554,7 +1554,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1554,7 +1554,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
update
:
extensions
.
ReplicaSet
{
update
:
extensions
.
ReplicaSet
{
...
@@ -1562,7 +1562,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1562,7 +1562,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
3
,
Replicas
:
3
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
},
},
...
@@ -1571,7 +1571,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1571,7 +1571,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
update
:
extensions
.
ReplicaSet
{
update
:
extensions
.
ReplicaSet
{
...
@@ -1579,7 +1579,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1579,7 +1579,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
1
,
Replicas
:
1
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
readWriteVolumePodTemplate
.
Template
,
Template
:
readWriteVolumePodTemplate
.
Template
,
},
},
},
},
},
},
...
@@ -1597,7 +1597,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1597,7 +1597,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
update
:
extensions
.
ReplicaSet
{
update
:
extensions
.
ReplicaSet
{
...
@@ -1605,7 +1605,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1605,7 +1605,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
readWriteVolumePodTemplate
.
Template
,
Template
:
readWriteVolumePodTemplate
.
Template
,
},
},
},
},
},
},
...
@@ -1614,7 +1614,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1614,7 +1614,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
update
:
extensions
.
ReplicaSet
{
update
:
extensions
.
ReplicaSet
{
...
@@ -1622,7 +1622,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1622,7 +1622,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
invalidLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
invalidLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
},
},
...
@@ -1631,7 +1631,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1631,7 +1631,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
update
:
extensions
.
ReplicaSet
{
update
:
extensions
.
ReplicaSet
{
...
@@ -1639,7 +1639,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1639,7 +1639,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
invalidPodTemplate
.
Template
,
Template
:
invalidPodTemplate
.
Template
,
},
},
},
},
},
},
...
@@ -1648,7 +1648,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1648,7 +1648,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
update
:
extensions
.
ReplicaSet
{
update
:
extensions
.
ReplicaSet
{
...
@@ -1656,7 +1656,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
...
@@ -1656,7 +1656,7 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
-
1
,
Replicas
:
-
1
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
},
},
...
@@ -1712,14 +1712,14 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1712,14 +1712,14 @@ func TestValidateReplicaSet(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
{
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc-123"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc-123"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
{
{
...
@@ -1727,7 +1727,7 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1727,7 +1727,7 @@ func TestValidateReplicaSet(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
1
,
Replicas
:
1
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
readWriteVolumePodTemplate
.
Template
,
Template
:
readWriteVolumePodTemplate
.
Template
,
},
},
},
},
}
}
...
@@ -1742,27 +1742,27 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1742,27 +1742,27 @@ func TestValidateReplicaSet(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
""
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
"missing-namespace"
:
{
"missing-namespace"
:
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc-123"
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc-123"
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
"empty selector"
:
{
"empty selector"
:
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
"selector_doesnt_match"
:
{
"selector_doesnt_match"
:
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"foo"
:
"bar"
}},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"foo"
:
"bar"
}},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
"invalid manifest"
:
{
"invalid manifest"
:
{
...
@@ -1776,7 +1776,7 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1776,7 +1776,7 @@ func TestValidateReplicaSet(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
readWriteVolumePodTemplate
.
Template
,
Template
:
readWriteVolumePodTemplate
.
Template
,
},
},
},
},
"negative_replicas"
:
{
"negative_replicas"
:
{
...
@@ -1796,7 +1796,7 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1796,7 +1796,7 @@ func TestValidateReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
"invalid_label 2"
:
{
"invalid_label 2"
:
{
...
@@ -1808,7 +1808,7 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1808,7 +1808,7 @@ func TestValidateReplicaSet(t *testing.T) {
},
},
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Template
:
&
invalidPodTemplate
.
Template
,
Template
:
invalidPodTemplate
.
Template
,
},
},
},
},
"invalid_annotation"
:
{
"invalid_annotation"
:
{
...
@@ -1821,7 +1821,7 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1821,7 +1821,7 @@ func TestValidateReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
},
},
"invalid restart policy 1"
:
{
"invalid restart policy 1"
:
{
...
@@ -1831,7 +1831,7 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1831,7 +1831,7 @@ func TestValidateReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
RestartPolicy
:
api
.
RestartPolicyOnFailure
,
RestartPolicy
:
api
.
RestartPolicyOnFailure
,
DNSPolicy
:
api
.
DNSClusterFirst
,
DNSPolicy
:
api
.
DNSClusterFirst
,
...
@@ -1850,7 +1850,7 @@ func TestValidateReplicaSet(t *testing.T) {
...
@@ -1850,7 +1850,7 @@ func TestValidateReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validLabels
},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
RestartPolicy
:
api
.
RestartPolicyNever
,
RestartPolicy
:
api
.
RestartPolicyNever
,
DNSPolicy
:
api
.
DNSClusterFirst
,
DNSPolicy
:
api
.
DNSClusterFirst
,
...
...
pkg/client/unversioned/replica_sets_test.go
View file @
db48dcf5
...
@@ -49,7 +49,7 @@ func TestListReplicaSets(t *testing.T) {
...
@@ -49,7 +49,7 @@ func TestListReplicaSets(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Template
:
&
api
.
PodTemplateSpec
{},
Template
:
api
.
PodTemplateSpec
{},
},
},
},
},
},
},
...
@@ -76,7 +76,7 @@ func TestGetReplicaSet(t *testing.T) {
...
@@ -76,7 +76,7 @@ func TestGetReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Template
:
&
api
.
PodTemplateSpec
{},
Template
:
api
.
PodTemplateSpec
{},
},
},
},
},
},
},
...
@@ -115,7 +115,7 @@ func TestUpdateReplicaSet(t *testing.T) {
...
@@ -115,7 +115,7 @@ func TestUpdateReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Template
:
&
api
.
PodTemplateSpec
{},
Template
:
api
.
PodTemplateSpec
{},
},
},
},
},
},
},
...
@@ -143,7 +143,7 @@ func TestUpdateStatusReplicaSet(t *testing.T) {
...
@@ -143,7 +143,7 @@ func TestUpdateStatusReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Template
:
&
api
.
PodTemplateSpec
{},
Template
:
api
.
PodTemplateSpec
{},
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
2
,
Replicas
:
2
,
...
@@ -183,7 +183,7 @@ func TestCreateReplicaSet(t *testing.T) {
...
@@ -183,7 +183,7 @@ func TestCreateReplicaSet(t *testing.T) {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
2
,
Replicas
:
2
,
Template
:
&
api
.
PodTemplateSpec
{},
Template
:
api
.
PodTemplateSpec
{},
},
},
},
},
},
},
...
...
pkg/controller/deployment/deployment_controller.go
View file @
db48dcf5
...
@@ -730,7 +730,7 @@ func (dc *DeploymentController) getNewReplicaSet(deployment *extensions.Deployme
...
@@ -730,7 +730,7 @@ func (dc *DeploymentController) getNewReplicaSet(deployment *extensions.Deployme
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
0
,
Replicas
:
0
,
Selector
:
newRSSelector
,
Selector
:
newRSSelector
,
Template
:
&
newRSTemplate
,
Template
:
newRSTemplate
,
},
},
}
}
// Set new replica set's annotation
// Set new replica set's annotation
...
@@ -1100,9 +1100,9 @@ func (dc *DeploymentController) updateDeployment(deployment *extensions.Deployme
...
@@ -1100,9 +1100,9 @@ func (dc *DeploymentController) updateDeployment(deployment *extensions.Deployme
}
}
func
(
dc
*
DeploymentController
)
rollbackToTemplate
(
deployment
*
extensions
.
Deployment
,
rs
*
extensions
.
ReplicaSet
)
(
d
*
extensions
.
Deployment
,
performedRollback
bool
,
err
error
)
{
func
(
dc
*
DeploymentController
)
rollbackToTemplate
(
deployment
*
extensions
.
Deployment
,
rs
*
extensions
.
ReplicaSet
)
(
d
*
extensions
.
Deployment
,
performedRollback
bool
,
err
error
)
{
if
!
reflect
.
DeepEqual
(
deploymentutil
.
GetNewReplicaSetTemplate
(
deployment
),
*
rs
.
Spec
.
Template
)
{
if
!
reflect
.
DeepEqual
(
deploymentutil
.
GetNewReplicaSetTemplate
(
deployment
),
rs
.
Spec
.
Template
)
{
glog
.
Infof
(
"Rolling back deployment %s to template spec %+v"
,
deployment
.
Name
,
rs
.
Spec
.
Template
.
Spec
)
glog
.
Infof
(
"Rolling back deployment %s to template spec %+v"
,
deployment
.
Name
,
rs
.
Spec
.
Template
.
Spec
)
deploymentutil
.
SetFromReplicaSetTemplate
(
deployment
,
*
rs
.
Spec
.
Template
)
deploymentutil
.
SetFromReplicaSetTemplate
(
deployment
,
rs
.
Spec
.
Template
)
performedRollback
=
true
performedRollback
=
true
}
else
{
}
else
{
glog
.
V
(
4
)
.
Infof
(
"Rolling back to a revision that contains the same template as current deployment %s, skipping rollback..."
,
deployment
.
Name
)
glog
.
V
(
4
)
.
Infof
(
"Rolling back to a revision that contains the same template as current deployment %s, skipping rollback..."
,
deployment
.
Name
)
...
...
pkg/controller/deployment/deployment_controller_test.go
View file @
db48dcf5
...
@@ -42,7 +42,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet {
...
@@ -42,7 +42,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet {
Spec
:
exp
.
ReplicaSetSpec
{
Spec
:
exp
.
ReplicaSetSpec
{
Replicas
:
replicas
,
Replicas
:
replicas
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
selector
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
selector
},
Template
:
&
api
.
PodTemplateSpec
{},
Template
:
api
.
PodTemplateSpec
{},
},
},
}
}
}
}
...
@@ -120,7 +120,7 @@ func newReplicaSet(d *exp.Deployment, name string, replicas int) *exp.ReplicaSet
...
@@ -120,7 +120,7 @@ func newReplicaSet(d *exp.Deployment, name string, replicas int) *exp.ReplicaSet
},
},
Spec
:
exp
.
ReplicaSetSpec
{
Spec
:
exp
.
ReplicaSetSpec
{
Replicas
:
replicas
,
Replicas
:
replicas
,
Template
:
&
d
.
Spec
.
Template
,
Template
:
d
.
Spec
.
Template
,
},
},
}
}
...
...
pkg/controller/replicaset/replica_set.go
View file @
db48dcf5
...
@@ -439,7 +439,7 @@ func (rsc *ReplicaSetController) manageReplicas(filteredPods []*api.Pod, rs *ext
...
@@ -439,7 +439,7 @@ func (rsc *ReplicaSetController) manageReplicas(filteredPods []*api.Pod, rs *ext
for
i
:=
0
;
i
<
diff
;
i
++
{
for
i
:=
0
;
i
<
diff
;
i
++
{
go
func
()
{
go
func
()
{
defer
wait
.
Done
()
defer
wait
.
Done
()
if
err
:=
rsc
.
podControl
.
CreatePods
(
rs
.
Namespace
,
rs
.
Spec
.
Template
,
rs
);
err
!=
nil
{
if
err
:=
rsc
.
podControl
.
CreatePods
(
rs
.
Namespace
,
&
rs
.
Spec
.
Template
,
rs
);
err
!=
nil
{
// Decrement the expected number of creates because the informer won't observe this pod
// Decrement the expected number of creates because the informer won't observe this pod
glog
.
V
(
2
)
.
Infof
(
"Failed creation, decrementing expectations for replica set %q/%q"
,
rs
.
Namespace
,
rs
.
Name
)
glog
.
V
(
2
)
.
Infof
(
"Failed creation, decrementing expectations for replica set %q/%q"
,
rs
.
Namespace
,
rs
.
Name
)
rsc
.
expectations
.
CreationObserved
(
rsKey
)
rsc
.
expectations
.
CreationObserved
(
rsKey
)
...
...
pkg/controller/replicaset/replica_set_test.go
View file @
db48dcf5
...
@@ -69,7 +69,7 @@ func newReplicaSet(replicas int, selectorMap map[string]string) *extensions.Repl
...
@@ -69,7 +69,7 @@ func newReplicaSet(replicas int, selectorMap map[string]string) *extensions.Repl
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
replicas
,
Replicas
:
replicas
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
selectorMap
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
selectorMap
},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
"name"
:
"foo"
,
"name"
:
"foo"
,
...
...
pkg/kubectl/describe.go
View file @
db48dcf5
...
@@ -1038,18 +1038,12 @@ func describeReplicaSet(rs *extensions.ReplicaSet, events *api.EventList, runnin
...
@@ -1038,18 +1038,12 @@ func describeReplicaSet(rs *extensions.ReplicaSet, events *api.EventList, runnin
return
tabbedString
(
func
(
out
io
.
Writer
)
error
{
return
tabbedString
(
func
(
out
io
.
Writer
)
error
{
fmt
.
Fprintf
(
out
,
"Name:
\t
%s
\n
"
,
rs
.
Name
)
fmt
.
Fprintf
(
out
,
"Name:
\t
%s
\n
"
,
rs
.
Name
)
fmt
.
Fprintf
(
out
,
"Namespace:
\t
%s
\n
"
,
rs
.
Namespace
)
fmt
.
Fprintf
(
out
,
"Namespace:
\t
%s
\n
"
,
rs
.
Namespace
)
if
rs
.
Spec
.
Template
!=
nil
{
fmt
.
Fprintf
(
out
,
"Image(s):
\t
%s
\n
"
,
makeImageList
(
&
rs
.
Spec
.
Template
.
Spec
))
fmt
.
Fprintf
(
out
,
"Image(s):
\t
%s
\n
"
,
makeImageList
(
&
rs
.
Spec
.
Template
.
Spec
))
}
else
{
fmt
.
Fprintf
(
out
,
"Image(s):
\t
%s
\n
"
,
"<unset>"
)
}
fmt
.
Fprintf
(
out
,
"Selector:
\t
%s
\n
"
,
unversioned
.
FormatLabelSelector
(
rs
.
Spec
.
Selector
))
fmt
.
Fprintf
(
out
,
"Selector:
\t
%s
\n
"
,
unversioned
.
FormatLabelSelector
(
rs
.
Spec
.
Selector
))
fmt
.
Fprintf
(
out
,
"Labels:
\t
%s
\n
"
,
labels
.
FormatLabels
(
rs
.
Labels
))
fmt
.
Fprintf
(
out
,
"Labels:
\t
%s
\n
"
,
labels
.
FormatLabels
(
rs
.
Labels
))
fmt
.
Fprintf
(
out
,
"Replicas:
\t
%d current / %d desired
\n
"
,
rs
.
Status
.
Replicas
,
rs
.
Spec
.
Replicas
)
fmt
.
Fprintf
(
out
,
"Replicas:
\t
%d current / %d desired
\n
"
,
rs
.
Status
.
Replicas
,
rs
.
Spec
.
Replicas
)
fmt
.
Fprintf
(
out
,
"Pods Status:
\t
%d Running / %d Waiting / %d Succeeded / %d Failed
\n
"
,
running
,
waiting
,
succeeded
,
failed
)
fmt
.
Fprintf
(
out
,
"Pods Status:
\t
%d Running / %d Waiting / %d Succeeded / %d Failed
\n
"
,
running
,
waiting
,
succeeded
,
failed
)
if
rs
.
Spec
.
Template
!=
nil
{
describeVolumes
(
rs
.
Spec
.
Template
.
Spec
.
Volumes
,
out
)
describeVolumes
(
rs
.
Spec
.
Template
.
Spec
.
Volumes
,
out
)
}
if
events
!=
nil
{
if
events
!=
nil
{
DescribeEvents
(
events
,
out
)
DescribeEvents
(
events
,
out
)
}
}
...
...
pkg/kubectl/history.go
View file @
db48dcf5
...
@@ -81,7 +81,7 @@ func (h *DeploymentHistoryViewer) History(namespace, name string) (HistoryInfo,
...
@@ -81,7 +81,7 @@ func (h *DeploymentHistoryViewer) History(namespace, name string) (HistoryInfo,
if
err
!=
nil
{
if
err
!=
nil
{
continue
continue
}
}
historyInfo
.
RevisionToTemplate
[
v
]
=
rs
.
Spec
.
Template
historyInfo
.
RevisionToTemplate
[
v
]
=
&
rs
.
Spec
.
Template
changeCause
:=
getChangeCause
(
rs
)
changeCause
:=
getChangeCause
(
rs
)
if
historyInfo
.
RevisionToTemplate
[
v
]
.
Annotations
==
nil
{
if
historyInfo
.
RevisionToTemplate
[
v
]
.
Annotations
==
nil
{
historyInfo
.
RevisionToTemplate
[
v
]
.
Annotations
=
make
(
map
[
string
]
string
)
historyInfo
.
RevisionToTemplate
[
v
]
.
Annotations
=
make
(
map
[
string
]
string
)
...
...
pkg/kubectl/stop_test.go
View file @
db48dcf5
...
@@ -552,7 +552,7 @@ func TestDeploymentStop(t *testing.T) {
...
@@ -552,7 +552,7 @@ func TestDeploymentStop(t *testing.T) {
Namespace
:
ns
,
Namespace
:
ns
,
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Template
:
&
template
,
Template
:
template
,
},
},
},
},
},
},
...
...
pkg/registry/replicaset/etcd/etcd_test.go
View file @
db48dcf5
...
@@ -61,7 +61,7 @@ func validNewReplicaSet() *extensions.ReplicaSet {
...
@@ -61,7 +61,7 @@ func validNewReplicaSet() *extensions.ReplicaSet {
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"a"
:
"b"
}},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"a"
:
"b"
}},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
"a"
:
"b"
},
Labels
:
map
[
string
]
string
{
"a"
:
"b"
},
},
},
...
...
pkg/registry/replicaset/strategy_test.go
View file @
db48dcf5
...
@@ -50,7 +50,7 @@ func TestReplicaSetStrategy(t *testing.T) {
...
@@ -50,7 +50,7 @@ func TestReplicaSetStrategy(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"abc"
,
Namespace
:
api
.
NamespaceDefault
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validSelector
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validSelector
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
1
,
Replicas
:
1
,
...
@@ -109,7 +109,7 @@ func TestReplicaSetStatusStrategy(t *testing.T) {
...
@@ -109,7 +109,7 @@ func TestReplicaSetStatusStrategy(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
3
,
Replicas
:
3
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validSelector
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validSelector
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
1
,
Replicas
:
1
,
...
@@ -121,7 +121,7 @@ func TestReplicaSetStatusStrategy(t *testing.T) {
...
@@ -121,7 +121,7 @@ func TestReplicaSetStatusStrategy(t *testing.T) {
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
1
,
Replicas
:
1
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validSelector
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
validSelector
},
Template
:
&
validPodTemplate
.
Template
,
Template
:
validPodTemplate
.
Template
,
},
},
Status
:
extensions
.
ReplicaSetStatus
{
Status
:
extensions
.
ReplicaSetStatus
{
Replicas
:
3
,
Replicas
:
3
,
...
...
pkg/util/deployment/deployment.go
View file @
db48dcf5
...
@@ -86,7 +86,7 @@ func GetOldReplicaSetsFromLists(deployment *extensions.Deployment, c clientset.I
...
@@ -86,7 +86,7 @@ func GetOldReplicaSetsFromLists(deployment *extensions.Deployment, c clientset.I
return
nil
,
nil
,
fmt
.
Errorf
(
"invalid label selector: %v"
,
err
)
return
nil
,
nil
,
fmt
.
Errorf
(
"invalid label selector: %v"
,
err
)
}
}
// Filter out replica set that has the same pod template spec as the deployment - that is the new replica set.
// Filter out replica set that has the same pod template spec as the deployment - that is the new replica set.
if
api
.
Semantic
.
DeepEqual
(
rs
.
Spec
.
Template
,
&
newRSTemplate
)
{
if
api
.
Semantic
.
DeepEqual
(
rs
.
Spec
.
Template
,
newRSTemplate
)
{
continue
continue
}
}
allOldRSs
[
rs
.
ObjectMeta
.
Name
]
=
rs
allOldRSs
[
rs
.
ObjectMeta
.
Name
]
=
rs
...
@@ -131,7 +131,7 @@ func GetNewReplicaSetFromList(deployment *extensions.Deployment, c clientset.Int
...
@@ -131,7 +131,7 @@ func GetNewReplicaSetFromList(deployment *extensions.Deployment, c clientset.Int
newRSTemplate
:=
GetNewReplicaSetTemplate
(
deployment
)
newRSTemplate
:=
GetNewReplicaSetTemplate
(
deployment
)
for
i
:=
range
rsList
{
for
i
:=
range
rsList
{
if
api
.
Semantic
.
DeepEqual
(
rsList
[
i
]
.
Spec
.
Template
,
&
newRSTemplate
)
{
if
api
.
Semantic
.
DeepEqual
(
rsList
[
i
]
.
Spec
.
Template
,
newRSTemplate
)
{
// This is the new ReplicaSet.
// This is the new ReplicaSet.
return
&
rsList
[
i
],
nil
return
&
rsList
[
i
],
nil
}
}
...
...
pkg/util/deployment/deployment_test.go
View file @
db48dcf5
...
@@ -167,7 +167,7 @@ func generateRSWithLabel(labels map[string]string, image string) extensions.Repl
...
@@ -167,7 +167,7 @@ func generateRSWithLabel(labels map[string]string, image string) extensions.Repl
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
1
,
Replicas
:
1
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
labels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
labels
},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
{
{
...
@@ -192,7 +192,7 @@ func generateRS(deployment extensions.Deployment) extensions.ReplicaSet {
...
@@ -192,7 +192,7 @@ func generateRS(deployment extensions.Deployment) extensions.ReplicaSet {
Labels
:
template
.
Labels
,
Labels
:
template
.
Labels
,
},
},
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Template
:
&
template
,
Template
:
template
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
template
.
Labels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
template
.
Labels
},
},
},
}
}
...
...
test/e2e/deployment.go
View file @
db48dcf5
...
@@ -80,7 +80,7 @@ func newRS(rsName string, replicas int, rsPodLabels map[string]string, imageName
...
@@ -80,7 +80,7 @@ func newRS(rsName string, replicas int, rsPodLabels map[string]string, imageName
Spec
:
extensions
.
ReplicaSetSpec
{
Spec
:
extensions
.
ReplicaSetSpec
{
Replicas
:
replicas
,
Replicas
:
replicas
,
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
rsPodLabels
},
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
rsPodLabels
},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
rsPodLabels
,
Labels
:
rsPodLabels
,
},
},
...
...
test/e2e/replica_set.go
View file @
db48dcf5
...
@@ -65,7 +65,7 @@ func ReplicaSetServeImageOrFail(f *Framework, test string, image string) {
...
@@ -65,7 +65,7 @@ func ReplicaSetServeImageOrFail(f *Framework, test string, image string) {
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
Selector
:
&
unversioned
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"name"
:
name
,
"name"
:
name
,
}},
}},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
"name"
:
name
},
Labels
:
map
[
string
]
string
{
"name"
:
name
},
},
},
...
...
test/e2e/util.go
View file @
db48dcf5
...
@@ -1817,7 +1817,7 @@ func (config *ReplicaSetConfig) create() error {
...
@@ -1817,7 +1817,7 @@ func (config *ReplicaSetConfig) create() error {
"name"
:
config
.
Name
,
"name"
:
config
.
Name
,
},
},
},
},
Template
:
&
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Labels
:
map
[
string
]
string
{
"name"
:
config
.
Name
},
Labels
:
map
[
string
]
string
{
"name"
:
config
.
Name
},
},
},
...
@@ -1835,7 +1835,7 @@ func (config *ReplicaSetConfig) create() error {
...
@@ -1835,7 +1835,7 @@ func (config *ReplicaSetConfig) create() error {
},
},
}
}
config
.
applyTo
(
rs
.
Spec
.
Template
)
config
.
applyTo
(
&
rs
.
Spec
.
Template
)
_
,
err
:=
config
.
Client
.
ReplicaSets
(
config
.
Namespace
)
.
Create
(
rs
)
_
,
err
:=
config
.
Client
.
ReplicaSets
(
config
.
Namespace
)
.
Create
(
rs
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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