mirror of https://github.com/k3s-io/k3s
ReplicaSetSpec.Template shouldn't be a pointer.
PodTemplateSpec should be consistent for all the types in extensions/v1beta1. See PR #19510.pull/6/head
parent
108f722657
commit
db48dcf583
|
@ -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.
|
||||||
|
|
|
@ -297,14 +297,10 @@ 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,14 +319,9 @@ 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)
|
|
||||||
if err := v1.Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
out.Template = nil
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
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) {
|
||||||
"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) {
|
||||||
"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) {
|
||||||
{
|
{
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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",
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
},
|
},
|
||||||
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) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
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) {
|
||||||
},
|
},
|
||||||
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) {
|
||||||
},
|
},
|
||||||
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) {
|
||||||
},
|
},
|
||||||
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,
|
||||||
|
|
|
@ -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) {
|
||||||
},
|
},
|
||||||
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) {
|
||||||
},
|
},
|
||||||
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) {
|
||||||
},
|
},
|
||||||
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) {
|
||||||
},
|
},
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensions.ReplicaSetSpec{
|
||||||
Replicas: 2,
|
Replicas: 2,
|
||||||
Template: &api.PodTemplateSpec{},
|
Template: api.PodTemplateSpec{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -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
|
||||||
},
|
},
|
||||||
Spec: exp.ReplicaSetSpec{
|
Spec: exp.ReplicaSetSpec{
|
||||||
Replicas: replicas,
|
Replicas: replicas,
|
||||||
Template: &d.Spec.Template,
|
Template: d.Spec.Template,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -552,7 +552,7 @@ func TestDeploymentStop(t *testing.T) {
|
||||||
Namespace: ns,
|
Namespace: ns,
|
||||||
},
|
},
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensions.ReplicaSetSpec{
|
||||||
Template: &template,
|
Template: template,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -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"},
|
||||||
},
|
},
|
||||||
|
|
|
@ -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) {
|
||||||
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) {
|
||||||
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,
|
||||||
|
|
|
@ -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
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
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},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
},
|
},
|
||||||
|
|
|
@ -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},
|
||||||
},
|
},
|
||||||
|
|
|
@ -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 {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|
Loading…
Reference in New Issue