Skip to content

Commit 29cb3ec

Browse files
Add v1alpha3 conversion and webhook for IBMVPC resources (#498)
Signed-off-by: Prajyot-Parab <[email protected]>
1 parent 19b292a commit 29cb3ec

16 files changed

+1137
-10
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ manifests: controller-gen
105105

106106
.PHONY: generate-go-conversions-core
107107
generate-go-conversions-core: $(CONVERSION_GEN)
108+
$(MAKE) clean-generated-conversions SRC_DIRS="./api/v1alpha3"
108109
$(MAKE) clean-generated-conversions SRC_DIRS="./api/v1alpha4"
109110
$(CONVERSION_GEN) \
111+
--input-dirs=./api/v1alpha3 \
110112
--input-dirs=./api/v1alpha4 \
111113
--build-tag=ignore_autogenerated_core \
112114
--output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \

api/v1alpha3/conversion.go

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha3
18+
19+
import (
20+
apiconversion "k8s.io/apimachinery/pkg/conversion"
21+
"sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
22+
clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3"
23+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
24+
"sigs.k8s.io/controller-runtime/pkg/conversion"
25+
)
26+
27+
func Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(in *clusterv1alpha3.APIEndpoint, out *clusterv1.APIEndpoint, s apiconversion.Scope) error {
28+
return clusterv1alpha3.Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(in, out, s)
29+
}
30+
31+
func Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(in *clusterv1.APIEndpoint, out *clusterv1alpha3.APIEndpoint, s apiconversion.Scope) error {
32+
return clusterv1alpha3.Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(in, out, s)
33+
}
34+
35+
func (src *IBMVPCCluster) ConvertTo(dstRaw conversion.Hub) error {
36+
dst := dstRaw.(*v1beta1.IBMVPCCluster)
37+
38+
return Convert_v1alpha3_IBMVPCCluster_To_v1beta1_IBMVPCCluster(src, dst, nil)
39+
}
40+
41+
func (dst *IBMVPCCluster) ConvertFrom(srcRaw conversion.Hub) error {
42+
src := srcRaw.(*v1beta1.IBMVPCCluster)
43+
44+
return Convert_v1beta1_IBMVPCCluster_To_v1alpha3_IBMVPCCluster(src, dst, nil)
45+
}
46+
47+
func (src *IBMVPCClusterList) ConvertTo(dstRaw conversion.Hub) error {
48+
dst := dstRaw.(*v1beta1.IBMVPCClusterList)
49+
50+
return Convert_v1alpha3_IBMVPCClusterList_To_v1beta1_IBMVPCClusterList(src, dst, nil)
51+
}
52+
53+
func (dst *IBMVPCClusterList) ConvertFrom(srcRaw conversion.Hub) error {
54+
src := srcRaw.(*v1beta1.IBMVPCClusterList)
55+
56+
return Convert_v1beta1_IBMVPCClusterList_To_v1alpha3_IBMVPCClusterList(src, dst, nil)
57+
}
58+
59+
func (src *IBMVPCMachine) ConvertTo(dstRaw conversion.Hub) error {
60+
dst := dstRaw.(*v1beta1.IBMVPCMachine)
61+
62+
return Convert_v1alpha3_IBMVPCMachine_To_v1beta1_IBMVPCMachine(src, dst, nil)
63+
}
64+
65+
func (dst *IBMVPCMachine) ConvertFrom(srcRaw conversion.Hub) error {
66+
src := srcRaw.(*v1beta1.IBMVPCMachine)
67+
68+
return Convert_v1beta1_IBMVPCMachine_To_v1alpha3_IBMVPCMachine(src, dst, nil)
69+
}
70+
71+
func (src *IBMVPCMachineList) ConvertTo(dstRaw conversion.Hub) error {
72+
dst := dstRaw.(*v1beta1.IBMVPCMachineList)
73+
74+
return Convert_v1alpha3_IBMVPCMachineList_To_v1beta1_IBMVPCMachineList(src, dst, nil)
75+
}
76+
77+
func (dst *IBMVPCMachineList) ConvertFrom(srcRaw conversion.Hub) error {
78+
src := srcRaw.(*v1beta1.IBMVPCMachineList)
79+
80+
return Convert_v1beta1_IBMVPCMachineList_To_v1alpha3_IBMVPCMachineList(src, dst, nil)
81+
}
82+
83+
func (src *IBMVPCMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
84+
dst := dstRaw.(*v1beta1.IBMVPCMachineTemplate)
85+
86+
return Convert_v1alpha3_IBMVPCMachineTemplate_To_v1beta1_IBMVPCMachineTemplate(src, dst, nil)
87+
}
88+
89+
func (dst *IBMVPCMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
90+
src := srcRaw.(*v1beta1.IBMVPCMachineTemplate)
91+
92+
return Convert_v1beta1_IBMVPCMachineTemplate_To_v1alpha3_IBMVPCMachineTemplate(src, dst, nil)
93+
}
94+
95+
func (src *IBMVPCMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error {
96+
dst := dstRaw.(*v1beta1.IBMVPCMachineTemplateList)
97+
98+
return Convert_v1alpha3_IBMVPCMachineTemplateList_To_v1beta1_IBMVPCMachineTemplateList(src, dst, nil)
99+
}
100+
101+
func (dst *IBMVPCMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error {
102+
src := srcRaw.(*v1beta1.IBMVPCMachineTemplateList)
103+
104+
return Convert_v1beta1_IBMVPCMachineTemplateList_To_v1alpha3_IBMVPCMachineTemplateList(src, dst, nil)
105+
}

api/v1alpha3/doc.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha3 contains the v1alpha3 API implementation.
18+
// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1
19+
package v1alpha3

api/v1alpha3/groupversion_info.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ var (
3333

3434
// AddToScheme adds the types in this group-version to the given scheme.
3535
AddToScheme = SchemeBuilder.AddToScheme
36+
37+
localSchemeBuilder = SchemeBuilder.SchemeBuilder
3638
)

0 commit comments

Comments
 (0)