diff --git a/apis/apps/v1beta4/rebalance_conversion.go b/apis/apps/v1beta4/rebalance_conversion.go index b81b05e84..fb2c34658 100644 --- a/apis/apps/v1beta4/rebalance_conversion.go +++ b/apis/apps/v1beta4/rebalance_conversion.go @@ -36,6 +36,7 @@ func (src *Rebalance) ConvertTo(dstRaw conversion.Hub) error { return err } + dst.SetGroupVersionKind(v2beta1.GroupVersion.WithKind("Rebalance")) dst.Spec.InstanceKind = "EMQX" // +kubebuilder:docs-gen:collapse=rote conversion @@ -54,6 +55,7 @@ func (dst *Rebalance) ConvertFrom(srcRaw conversion.Hub) error { if err := json.Unmarshal(b, dst); err != nil { return err } + dst.SetGroupVersionKind(GroupVersion.WithKind("Rebalance")) // +kubebuilder:docs-gen:collapse=rote conversion return nil diff --git a/apis/apps/v1beta4/rebalance_conversion_test.go b/apis/apps/v1beta4/rebalance_conversion_test.go index 496ee4c8b..3da2e50c8 100644 --- a/apis/apps/v1beta4/rebalance_conversion_test.go +++ b/apis/apps/v1beta4/rebalance_conversion_test.go @@ -28,6 +28,7 @@ func TestConvertTo(t *testing.T) { src := &Rebalance{} assert.Nil(t, src.ConvertTo(dst)) + assert.Equal(t, v2beta1.GroupVersion.Version, dst.GetObjectKind().GroupVersionKind().Version) } func TestConvertFrom(t *testing.T) { @@ -35,4 +36,5 @@ func TestConvertFrom(t *testing.T) { src := &v2beta1.Rebalance{} assert.Nil(t, dst.ConvertFrom(src)) + assert.Equal(t, GroupVersion.Version, dst.GetObjectKind().GroupVersionKind().Version) }