forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conversion.go
31 lines (28 loc) · 965 Bytes
/
conversion.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package v1
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/conversion"
newer "github.com/openshift/origin/pkg/template/api"
)
func init() {
err := api.Scheme.AddConversionFuncs(
func(in *newer.Template, out *Template, s conversion.Scope) error {
//FIXME: DefaultConvert should not overwrite the Labels field on the
// the base object. This is likely a bug in the DefaultConvert
// code. For now, it is called before converting the labels.
if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
return err
}
return s.Convert(&in.ObjectLabels, &out.Labels, 0)
},
func(in *Template, out *newer.Template, s conversion.Scope) error {
if err := s.Convert(&in.Labels, &out.ObjectLabels, 0); err != nil {
return err
}
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields)
},
)
if err != nil {
panic(err)
}
}