replica: serialize created-by reference

Fixes #7322

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
This commit is contained in:
Federico Simoncelli
2015-04-25 01:26:52 -04:00
parent b9ea2c33f4
commit 37038c4877
12 changed files with 61 additions and 3 deletions

View File

@@ -17,10 +17,10 @@ limitations under the License.
package controller
import (
"encoding/json"
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/validation"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/cache"
@@ -201,8 +201,9 @@ func (r RealPodControl) createReplica(namespace string, controller *api.Replicat
if err != nil {
return fmt.Errorf("unable to get controller reference: %v", err)
}
// TODO: Version this serialization per #7322
createdByRefJson, err := json.Marshal(createdByRef)
createdByRefJson, err := latest.Codec.Encode(&api.SerializedReference{
Reference: *createdByRef,
})
if err != nil {
return fmt.Errorf("unable to serialize controller reference: %v", err)
}