change petset replicas type from int to int32

Change-Id: I0b8c30083e4a221421de46d9d4dcb21b1f5bb36f
This commit is contained in:
m1093782566
2016-09-19 22:12:16 +08:00
parent 46c009952d
commit fd47b6d4d1
10 changed files with 33 additions and 28 deletions

View File

@@ -639,7 +639,7 @@ func (x *PetSetSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Replicas = 0
} else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234))
x.Replicas = int32(r.DecodeInt(32))
}
case "selector":
if r.TryDecodeAsNil() {
@@ -711,7 +711,7 @@ func (x *PetSetSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Replicas = 0
} else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234))
x.Replicas = int32(r.DecodeInt(32))
}
yyj59++
if yyhl59 {
@@ -977,7 +977,7 @@ func (x *PetSetStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Replicas = 0
} else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234))
x.Replicas = int32(r.DecodeInt(32))
}
default:
z.DecStructFieldNotFound(-1, yys79)
@@ -1033,7 +1033,7 @@ func (x *PetSetStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Replicas = 0
} else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234))
x.Replicas = int32(r.DecodeInt(32))
}
for {
yyj83++

View File

@@ -49,7 +49,7 @@ type PetSetSpec struct {
// same Template, but individual replicas also have a consistent identity.
// If unspecified, defaults to 1.
// TODO: Consider a rename of this field.
Replicas int `json:"replicas,omitempty"`
Replicas int32 `json:"replicas,omitempty"`
// Selector is a label query over pods that should match the replica count.
// If empty, defaulted to labels on the pod template.
@@ -85,7 +85,7 @@ type PetSetStatus struct {
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
// Replicas is the number of actual replicas.
Replicas int `json:"replicas"`
Replicas int32 `json:"replicas"`
}
// PetSetList is a collection of PetSets.

View File

@@ -28,7 +28,7 @@ import (
)
func addConversionFuncs(scheme *runtime.Scheme) error {
// Add non-generated conversion functions to handle the *int32 -> int
// Add non-generated conversion functions to handle the *int32 -> int32
// conversion. A pointer is useful in the versioned type so we can default
// it, but a plain int32 is more convenient in the internal type. These
// functions are the same as the autogenerated ones in every other way.
@@ -54,7 +54,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
func Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *apps.PetSetSpec, s conversion.Scope) error {
if in.Replicas != nil {
out.Replicas = int(*in.Replicas)
out.Replicas = *in.Replicas
}
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
@@ -85,7 +85,7 @@ func Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *apps.Pe
func Convert_apps_PetSetSpec_To_v1alpha1_PetSetSpec(in *apps.PetSetSpec, out *PetSetSpec, s conversion.Scope) error {
out.Replicas = new(int32)
*out.Replicas = int32(in.Replicas)
*out.Replicas = in.Replicas
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = new(unversioned.LabelSelector)

View File

@@ -141,7 +141,9 @@ func Convert_apps_PetSetList_To_v1alpha1_PetSetList(in *apps.PetSetList, out *Pe
}
func autoConvert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *apps.PetSetSpec, s conversion.Scope) error {
// WARNING: in.Replicas requires manual conversion: inconvertible types (*int32 vs int)
if err := api.Convert_Pointer_int32_To_int32(&in.Replicas, &out.Replicas, s); err != nil {
return err
}
out.Selector = in.Selector
if err := v1.Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
return err
@@ -163,7 +165,9 @@ func autoConvert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *app
}
func autoConvert_apps_PetSetSpec_To_v1alpha1_PetSetSpec(in *apps.PetSetSpec, out *PetSetSpec, s conversion.Scope) error {
// WARNING: in.Replicas requires manual conversion: inconvertible types (int vs *int32)
if err := api.Convert_int32_To_Pointer_int32(&in.Replicas, &out.Replicas, s); err != nil {
return err
}
out.Selector = in.Selector
if err := v1.Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
return err
@@ -186,7 +190,7 @@ func autoConvert_apps_PetSetSpec_To_v1alpha1_PetSetSpec(in *apps.PetSetSpec, out
func autoConvert_v1alpha1_PetSetStatus_To_apps_PetSetStatus(in *PetSetStatus, out *apps.PetSetStatus, s conversion.Scope) error {
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = int(in.Replicas)
out.Replicas = in.Replicas
return nil
}
@@ -196,7 +200,7 @@ func Convert_v1alpha1_PetSetStatus_To_apps_PetSetStatus(in *PetSetStatus, out *a
func autoConvert_apps_PetSetStatus_To_v1alpha1_PetSetStatus(in *apps.PetSetStatus, out *PetSetStatus, s conversion.Scope) error {
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = int32(in.Replicas)
out.Replicas = in.Replicas
return nil
}