Skip to content

Commit

Permalink
Merge pull request #1250 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…1249-to-release-0.6

[release-0.6] 🐛 implement conversion for OpenStackClusterTemplate CRD
  • Loading branch information
k8s-ci-robot authored May 25, 2022
2 parents 1adc0ff + 9fce356 commit d25581a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
28 changes: 28 additions & 0 deletions api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,34 @@ func (r *OpenStackClusterList) ConvertFrom(srcRaw ctrlconversion.Hub) error {
return Convert_v1alpha5_OpenStackClusterList_To_v1alpha4_OpenStackClusterList(src, r, nil)
}

var _ ctrlconversion.Convertible = &OpenStackClusterTemplate{}

func (r *OpenStackClusterTemplate) ConvertTo(dstRaw ctrlconversion.Hub) error {
dst := dstRaw.(*infrav1.OpenStackClusterTemplate)

return Convert_v1alpha4_OpenStackClusterTemplate_To_v1alpha5_OpenStackClusterTemplate(r, dst, nil)
}

func (r *OpenStackClusterTemplate) ConvertFrom(srcRaw ctrlconversion.Hub) error {
src := srcRaw.(*infrav1.OpenStackClusterTemplate)

return Convert_v1alpha5_OpenStackClusterTemplate_To_v1alpha4_OpenStackClusterTemplate(src, r, nil)
}

var _ ctrlconversion.Convertible = &OpenStackClusterTemplateList{}

func (r *OpenStackClusterTemplateList) ConvertTo(dstRaw ctrlconversion.Hub) error {
dst := dstRaw.(*infrav1.OpenStackClusterTemplateList)

return Convert_v1alpha4_OpenStackClusterTemplateList_To_v1alpha5_OpenStackClusterTemplateList(r, dst, nil)
}

func (r *OpenStackClusterTemplateList) ConvertFrom(srcRaw ctrlconversion.Hub) error {
src := srcRaw.(*infrav1.OpenStackClusterTemplateList)

return Convert_v1alpha5_OpenStackClusterTemplateList_To_v1alpha4_OpenStackClusterTemplateList(src, r, nil)
}

var _ ctrlconversion.Convertible = &OpenStackMachine{}

func (r *OpenStackMachine) ConvertTo(dstRaw ctrlconversion.Hub) error {
Expand Down
27 changes: 27 additions & 0 deletions api/v1alpha4/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ func TestConvertTo(t *testing.T) {
},
},
},
{
name: "OpenStackClusterTemplate",
spoke: &OpenStackClusterTemplate{
Spec: OpenStackClusterTemplateSpec{},
},
hub: &infrav1.OpenStackClusterTemplate{},
want: &infrav1.OpenStackClusterTemplate{
Spec: infrav1.OpenStackClusterTemplateSpec{},
},
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -157,6 +167,16 @@ func TestConvertFrom(t *testing.T) {
},
},
},
{
name: "OpenStackClusterTemplate",
spoke: &OpenStackClusterTemplate{},
hub: &infrav1.OpenStackClusterTemplate{
Spec: infrav1.OpenStackClusterTemplateSpec{},
},
want: &OpenStackClusterTemplate{
Spec: OpenStackClusterTemplateSpec{},
},
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -307,6 +327,13 @@ func TestFuzzyConversion(t *testing.T) {
FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzerFuncs},
}))

t.Run("for OpenStackClusterTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
Scheme: scheme,
Hub: &infrav1.OpenStackClusterTemplate{},
Spoke: &OpenStackClusterTemplate{},
FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzerFuncs},
}))

t.Run("for OpenStackMachine", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
Scheme: scheme,
Hub: &infrav1.OpenStackMachine{},
Expand Down
6 changes: 6 additions & 0 deletions api/v1alpha5/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ func (*OpenStackCluster) Hub() {}
// Hub marks OpenStackClusterList as a conversion hub.
func (*OpenStackClusterList) Hub() {}

// Hub marks OpenStackClusterTemplate as a conversion hub.
func (*OpenStackClusterTemplate) Hub() {}

// Hub marks OpenStackClusterTemplateList as a conversion hub.
func (*OpenStackClusterTemplateList) Hub() {}

// Hub marks OpenStackMachine as a conversion hub.
func (*OpenStackMachine) Hub() {}

Expand Down

0 comments on commit d25581a

Please sign in to comment.