Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Head: codegen-conversions Merge pull request #2 from pmorie/codegen-conversions
Untracked files (1)
cmd/libs/go2idl/client-gen/
Unstaged changes (6)
modified Makefile
@@ -120,6 +120,7 @@ $(BINDIR)/conversion-gen: cmd/libs/go2idl/conversion-gen
$(SC_PKG)/vendor/k8s.io/kubernetes/pkg/runtime \
-O zz_generated.conversion
# the previous three directories will be changed from kubernetes to apimachinery in the future
+ #$(DOCKER_CMD) $(ROOT)hack/update-codecgen.sh
touch $@
# Some prereq stuff
modified pkg/apis/servicecatalog/types.go
@@ -177,7 +177,7 @@ type InstanceSpec struct {
// ServicePlanName is the reference to the ServicePlan for this instance.
PlanName string
- Parameters map[string]interface{}
+ Parameters map[string]runtime.Object
// OSB-specific
// OSBGUID is the identity of this object for use with the OSB API.
@@ -256,7 +256,7 @@ type BindingSpec struct {
// should be injected with the results of the binding. Immutable.
AppLabelSelector metav1.LabelSelector
- Parameters map[string]interface{}
+ Parameters map[string]runtime.Object
// References to objects to create
SecretRef string
modified pkg/apis/servicecatalog/v1alpha1/types.go
@@ -178,7 +178,7 @@ type InstanceSpec struct {
// ServicePlanName is the reference to the ServicePlan for this instance.
PlanName string `json:"planName"`
- Parameters map[string]interface{} `json:"parameters"`
+ Parameters map[string]runtime.RawExtension `json:"parameters"`
// OSB-specific
// OSBGUID is the identity of this object for use with the OSB SB API.
@@ -257,7 +257,7 @@ type BindingSpec struct {
// should be injected with the results of the binding. Immutable.
AppLabelSelector metav1.LabelSelector `json:"appLabelSelector"`
- Parameters map[string]interface{} `json:"parameters"`
+ Parameters map[string]runtime.RawExtension `json:"parameters"`
// References to objects to create
SecretRef string `json:"secretRef"`
modified pkg/apis/servicecatalog/v1alpha1/zz_generated.conversion.go
@@ -136,7 +136,17 @@ func Convert_servicecatalog_BindingCondition_To_v1alpha1_BindingCondition(in *se
func autoConvert_v1alpha1_BindingList_To_servicecatalog_BindingList(in *BindingList, out *servicecatalog.BindingList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
- out.Items = *(*[]servicecatalog.Binding)(unsafe.Pointer(&in.Items))
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]servicecatalog.Binding, len(*in))
+ for i := range *in {
+ if err := Convert_v1alpha1_Binding_To_servicecatalog_Binding(&(*in)[i], &(*out)[i], s); err != nil {
+ return err
+ }
+ }
+ } else {
+ out.Items = nil
+ }
return nil
}
@@ -146,7 +156,17 @@ func Convert_v1alpha1_BindingList_To_servicecatalog_BindingList(in *BindingList,
func autoConvert_servicecatalog_BindingList_To_v1alpha1_BindingList(in *servicecatalog.BindingList, out *BindingList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
- out.Items = *(*[]Binding)(unsafe.Pointer(&in.Items))
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]Binding, len(*in))
+ for i := range *in {
+ if err := Convert_servicecatalog_Binding_To_v1alpha1_Binding(&(*in)[i], &(*out)[i], s); err != nil {
+ return err
+ }
+ }
+ } else {
+ out.Items = nil
+ }
return nil
}
@@ -160,7 +180,20 @@ func autoConvert_v1alpha1_BindingSpec_To_servicecatalog_BindingSpec(in *BindingS
return err
}
out.AppLabelSelector = in.AppLabelSelector
- out.Parameters = *(*map[string]interface{})(unsafe.Pointer(&in.Parameters))
+ if in.Parameters != nil {
+ in, out := &in.Parameters, &out.Parameters
+ *out = make(map[string]runtime.Object, len(*in))
+ for key, val := range *in {
+ newVal := new(runtime.Object)
+ // TODO: Inefficient conversion - can we improve it?
+ if err := s.Convert(&val, newVal, 0); err != nil {
+ return err
+ }
+ (*out)[key] = *newVal
+ }
+ } else {
+ out.Parameters = nil
+ }
out.SecretRef = in.SecretRef
out.ServiceRef = in.ServiceRef
out.ConfigMapRef = in.ConfigMapRef
@@ -179,7 +212,20 @@ func autoConvert_servicecatalog_BindingSpec_To_v1alpha1_BindingSpec(in *servicec
return err
}
out.AppLabelSelector = in.AppLabelSelector
- out.Parameters = *(*map[string]interface{})(unsafe.Pointer(&in.Parameters))
+ if in.Parameters != nil {
+ in, out := &in.Parameters, &out.Parameters
+ *out = make(map[string]runtime.RawExtension, len(*in))
+ for key, val := range *in {
+ newVal := new(runtime.RawExtension)
+ // TODO: Inefficient conversion - can we improve it?
+ if err := s.Convert(&val, newVal, 0); err != nil {
+ return err
+ }
+ (*out)[key] = *newVal
+ }
+ } else {
+ out.Parameters = nil
+ }
out.SecretRef = in.SecretRef
out.ServiceRef = in.ServiceRef
out.ConfigMapRef = in.ConfigMapRef
@@ -394,7 +440,17 @@ func Convert_servicecatalog_InstanceCondition_To_v1alpha1_InstanceCondition(in *
func autoConvert_v1alpha1_InstanceList_To_servicecatalog_InstanceList(in *InstanceList, out *servicecatalog.InstanceList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
- out.Items = *(*[]servicecatalog.Instance)(unsafe.Pointer(&in.Items))
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]servicecatalog.Instance, len(*in))
+ for i := range *in {
+ if err := Convert_v1alpha1_Instance_To_servicecatalog_Instance(&(*in)[i], &(*out)[i], s); err != nil {
+ return err
+ }
+ }
+ } else {
+ out.Items = nil
+ }
return nil
}
@@ -404,7 +460,17 @@ func Convert_v1alpha1_InstanceList_To_servicecatalog_InstanceList(in *InstanceLi
func autoConvert_servicecatalog_InstanceList_To_v1alpha1_InstanceList(in *servicecatalog.InstanceList, out *InstanceList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
- out.Items = *(*[]Instance)(unsafe.Pointer(&in.Items))
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]Instance, len(*in))
+ for i := range *in {
+ if err := Convert_servicecatalog_Instance_To_v1alpha1_Instance(&(*in)[i], &(*out)[i], s); err != nil {
+ return err
+ }
+ }
+ } else {
+ out.Items = nil
+ }
return nil
}
@@ -415,7 +481,20 @@ func Convert_servicecatalog_InstanceList_To_v1alpha1_InstanceList(in *servicecat
func autoConvert_v1alpha1_InstanceSpec_To_servicecatalog_InstanceSpec(in *InstanceSpec, out *servicecatalog.InstanceSpec, s conversion.Scope) error {
out.ServiceClassName = in.ServiceClassName
out.PlanName = in.PlanName
- out.Parameters = *(*map[string]interface{})(unsafe.Pointer(&in.Parameters))
+ if in.Parameters != nil {
+ in, out := &in.Parameters, &out.Parameters
+ *out = make(map[string]runtime.Object, len(*in))
+ for key, val := range *in {
+ newVal := new(runtime.Object)
+ // TODO: Inefficient conversion - can we improve it?
+ if err := s.Convert(&val, newVal, 0); err != nil {
+ return err
+ }
+ (*out)[key] = *newVal
+ }
+ } else {
+ out.Parameters = nil
+ }
out.OSBGUID = in.OSBGUID
out.OSBCredentials = in.OSBCredentials
out.OSBDashboardURL = in.OSBDashboardURL
@@ -435,7 +514,20 @@ func Convert_v1alpha1_InstanceSpec_To_servicecatalog_InstanceSpec(in *InstanceSp
func autoConvert_servicecatalog_InstanceSpec_To_v1alpha1_InstanceSpec(in *servicecatalog.InstanceSpec, out *InstanceSpec, s conversion.Scope) error {
out.ServiceClassName = in.ServiceClassName
out.PlanName = in.PlanName
- out.Parameters = *(*map[string]interface{})(unsafe.Pointer(&in.Parameters))
+ if in.Parameters != nil {
+ in, out := &in.Parameters, &out.Parameters
+ *out = make(map[string]runtime.RawExtension, len(*in))
+ for key, val := range *in {
+ newVal := new(runtime.RawExtension)
+ // TODO: Inefficient conversion - can we improve it?
+ if err := s.Convert(&val, newVal, 0); err != nil {
+ return err
+ }
+ (*out)[key] = *newVal
+ }
+ } else {
+ out.Parameters = nil
+ }
out.OSBGUID = in.OSBGUID
out.OSBCredentials = in.OSBCredentials
out.OSBDashboardURL = in.OSBDashboardURL
modified pkg/apis/servicecatalog/v1alpha1/zz_generated.deepcopy.go
@@ -118,12 +118,12 @@ func DeepCopy_v1alpha1_BindingSpec(in interface{}, out interface{}, c *conversio
}
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
- *out = make(map[string]interface{})
+ *out = make(map[string]runtime.RawExtension)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
- (*out)[key] = *newVal.(*interface{})
+ (*out)[key] = *newVal.(*runtime.RawExtension)
}
}
} else {
@@ -280,12 +280,12 @@ func DeepCopy_v1alpha1_InstanceSpec(in interface{}, out interface{}, c *conversi
*out = *in
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
- *out = make(map[string]interface{})
+ *out = make(map[string]runtime.RawExtension)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
- (*out)[key] = *newVal.(*interface{})
+ (*out)[key] = *newVal.(*runtime.RawExtension)
}
}
} else {
modified pkg/apis/servicecatalog/zz_generated.deepcopy.go
@@ -118,12 +118,12 @@ func DeepCopy_servicecatalog_BindingSpec(in interface{}, out interface{}, c *con
}
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
- *out = make(map[string]interface{})
+ *out = make(map[string]runtime.Object)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
- (*out)[key] = *newVal.(*interface{})
+ (*out)[key] = *newVal.(*runtime.Object)
}
}
} else {
@@ -280,12 +280,12 @@ func DeepCopy_servicecatalog_InstanceSpec(in interface{}, out interface{}, c *co
*out = *in
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
- *out = make(map[string]interface{})
+ *out = make(map[string]runtime.Object)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
- (*out)[key] = *newVal.(*interface{})
+ (*out)[key] = *newVal.(*runtime.Object)
}
}
} else {
Stashes (2)
stash@{0} WIP on codegen-conversions: 11c3ef8 Hook back into upstream testapi package
stash@{1} WIP on client-gen: 8fd295c API registration changes and list types (#229)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment