-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,066 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
config/crd/bases/ipam.cluster.x-k8s.io_ipaddressclaims.yaml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
Copyright 2021 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/conversion" | ||
|
||
ipamv1beta1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" | ||
utilconversion "sigs.k8s.io/cluster-api/util/conversion" | ||
) | ||
|
||
func (src *IPAddress) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*ipamv1beta1.IPAddress) | ||
|
||
if err := Convert_v1alpha1_IPAddress_To_v1beta1_IPAddress(src, dst, nil); err != nil { | ||
return err | ||
} | ||
|
||
delete(src.Annotations, utilconversion.DataAnnotation) | ||
|
||
return nil | ||
} | ||
|
||
func (dst *IPAddress) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*ipamv1beta1.IPAddress) | ||
|
||
if err := Convert_v1beta1_IPAddress_To_v1alpha1_IPAddress(src, dst, nil); err != nil { | ||
return err | ||
} | ||
|
||
return utilconversion.MarshalData(src, dst) | ||
} | ||
|
||
func (src *IPAddressList) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*ipamv1beta1.IPAddressList) | ||
|
||
return Convert_v1alpha1_IPAddressList_To_v1beta1_IPAddressList(src, dst, nil) | ||
} | ||
|
||
func (dst *IPAddressList) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*ipamv1beta1.IPAddressList) | ||
|
||
return Convert_v1beta1_IPAddressList_To_v1alpha1_IPAddressList(src, dst, nil) | ||
} | ||
|
||
func (src *IPAddressClaim) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*ipamv1beta1.IPAddressClaim) | ||
|
||
if err := Convert_v1alpha1_IPAddressClaim_To_v1beta1_IPAddressClaim(src, dst, nil); err != nil { | ||
return err | ||
} | ||
|
||
delete(src.Annotations, utilconversion.DataAnnotation) | ||
|
||
return nil | ||
} | ||
|
||
func (dst *IPAddressClaim) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*ipamv1beta1.IPAddressClaim) | ||
|
||
if err := Convert_v1beta1_IPAddressClaim_To_v1alpha1_IPAddressClaim(src, dst, nil); err != nil { | ||
return err | ||
} | ||
|
||
return utilconversion.MarshalData(src, dst) | ||
} | ||
|
||
func (src *IPAddressClaimList) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*ipamv1beta1.IPAddressClaimList) | ||
|
||
return Convert_v1alpha1_IPAddressClaimList_To_v1beta1_IPAddressClaimList(src, dst, nil) | ||
} | ||
|
||
func (dst *IPAddressClaimList) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*ipamv1beta1.IPAddressClaimList) | ||
|
||
return Convert_v1beta1_IPAddressClaimList_To_v1alpha1_IPAddressClaimList(src, dst, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Copyright 2021 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer" | ||
|
||
ipamv1beta1 "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" | ||
utilconversion "sigs.k8s.io/cluster-api/util/conversion" | ||
) | ||
|
||
func TestFuzzyConversion(t *testing.T) { | ||
t.Run("for IPAddress", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ | ||
Hub: &ipamv1beta1.IPAddress{}, | ||
Spoke: &IPAddress{}, | ||
FuzzerFuncs: []fuzzer.FuzzerFuncs{}, | ||
})) | ||
t.Run("for IPAddressClaim", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ | ||
Hub: &ipamv1beta1.IPAddressClaim{}, | ||
Spoke: &IPAddressClaim{}, | ||
FuzzerFuncs: []fuzzer.FuzzerFuncs{}, | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.