Skip to content

Commit a65deed

Browse files
migrate v1alpha4 to v1beta1 (#445)
* migrate v1alpha4 to v1beta1 Signed-off-by: Prajyot-Parab <[email protected]> * part-2: migrate v1alpha4 to v1beta1 Signed-off-by: Prajyot-Parab <[email protected]> * part-3: migrate v1alpha4 to v1beta1 Signed-off-by: Prajyot-Parab <[email protected]>
1 parent 0a7ce2e commit a65deed

File tree

68 files changed

+4051
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4051
-263
lines changed

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ GO_INSTALL = ./scripts/go_install.sh
3131
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
3232
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
3333
GOJQ := $(TOOLS_BIN_DIR)/gojq
34+
CONVERSION_GEN := $(TOOLS_BIN_DIR)/conversion-gen
3435

3536
STAGING_REGISTRY ?= gcr.io/k8s-staging-capi-ibmcloud
3637
STAGING_BUCKET ?= artifacts.k8s-staging-capi-ibmcloud.appspot.com
@@ -62,6 +63,13 @@ else
6263
GOBIN=$(shell go env GOBIN)
6364
endif
6465

66+
# Set --output-base for conversion-gen if we are not within GOPATH
67+
ifneq ($(abspath $(ROOT_DIR_RELATIVE)),$(shell go env GOPATH)/src/sigs.k8s.io/cluster-api-provider-ibmcloud)
68+
CONVERSION_GEN_OUTPUT_BASE := --output-base=$(ROOT_DIR_RELATIVE)
69+
else
70+
export GOPATH := $(shell go env GOPATH)
71+
endif
72+
6573
all: manager
6674

6775
# Run tests
@@ -93,6 +101,16 @@ deploy: manifests $(KUSTOMIZE)
93101
manifests: controller-gen
94102
#$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
95103
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=config/crd/bases
104+
105+
.PHONY: generate-go-conversions-core
106+
generate-go-conversions-core: $(CONVERSION_GEN)
107+
$(MAKE) clean-generated-conversions SRC_DIRS="./api/v1alpha4"
108+
$(CONVERSION_GEN) \
109+
--input-dirs=./api/v1alpha4 \
110+
--build-tag=ignore_autogenerated_core \
111+
--output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \
112+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
113+
96114
# Run go fmt against code
97115
fmt:
98116
go fmt ./...
@@ -301,6 +319,10 @@ clean-temporary: ## Remove all temporary files and folders
301319
clean-release: ## Remove the release folder
302320
rm -rf $(RELEASE_DIR)
303321

322+
.PHONY: clean-generated-conversions
323+
clean-generated-conversions: ## Remove files generated by conversion-gen from the mentioned dirs
324+
(IFS=','; for i in $(SRC_DIRS); do find $$i -type f -name 'zz_generated.conversion*' -exec rm -f {} \;; done)
325+
304326
.PHONY: verify
305327
verify:
306328
./hack/verify-boilerplate.sh

PROJECT

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
domain: cluster.x-k8s.io
22
repo: sigs.k8s.io/cluster-api-provider-ibmcloud
33
resources:
4+
# v1alpha4 types
5+
- group: infrastructure
6+
kind: IBMVPCCluster
7+
version: v1alpha4
8+
- group: infrastructure
9+
kind: IBMVPCMachine
10+
version: v1alpha4
11+
- group: infrastructure
12+
kind: IBMVPCMachineTemplate
13+
version: v1alpha4
414
- group: infrastructure
515
kind: IBMPowerVSCluster
616
version: v1alpha4
@@ -10,4 +20,23 @@ resources:
1020
- group: infrastructure
1121
kind: IBMPowerVSMachineTemplate
1222
version: v1alpha4
23+
# v1beta1 types
24+
- group: infrastructure
25+
kind: IBMVPCCluster
26+
version: v1beta1
27+
- group: infrastructure
28+
kind: IBMVPCMachine
29+
version: v1beta1
30+
- group: infrastructure
31+
kind: IBMVPCMachineTemplate
32+
version: v1beta1
33+
- group: infrastructure
34+
kind: IBMPowerVSCluster
35+
version: v1beta1
36+
- group: infrastructure
37+
kind: IBMPowerVSMachine
38+
version: v1beta1
39+
- group: infrastructure
40+
kind: IBMPowerVSMachineTemplate
41+
version: v1beta1
1342
version: "2"

api/v1alpha3/ibmvpccluster_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package v1alpha3
1818

1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21-
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
21+
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
2222
)
2323

2424
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
@@ -60,7 +60,7 @@ type IBMVPCClusterStatus struct {
6060
// Bastion Instance `json:"bastion,omitempty"`
6161
Ready bool `json:"ready"`
6262
Subnet Subnet `json:"subnet,omitempty"`
63-
APIEndpoint APIEndpoint `json:"apiEndpoint,omitempty"`
63+
VPCEndpoint VPCEndpoint `json:"vpcEndpoint,omitempty"`
6464
}
6565

6666
// VPC holds the VPC information

api/v1alpha3/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ type Subnet struct {
3030
Zone *string `json:"zone"`
3131
}
3232

33-
// APIEndpoint describes a APIEndpoint
34-
type APIEndpoint struct {
33+
// VPCEndpoint describes a VPCEndpoint
34+
type VPCEndpoint struct {
3535
Address *string `json:"address"`
3636
FIPID *string `json:"floatingIPID"`
3737
}

api/v1alpha3/zz_generated.deepcopy.go

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha4/conversion.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 v1alpha4
18+
19+
import (
20+
apiconversion "k8s.io/apimachinery/pkg/conversion"
21+
clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4"
22+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
23+
)
24+
25+
func Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in *clusterv1alpha4.APIEndpoint, out *clusterv1.APIEndpoint, s apiconversion.Scope) error {
26+
return clusterv1alpha4.Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in, out, s)
27+
}
28+
29+
func Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in *clusterv1.APIEndpoint, out *clusterv1alpha4.APIEndpoint, s apiconversion.Scope) error {
30+
return clusterv1alpha4.Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in, out, s)
31+
}

api/v1alpha4/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 v1alpha4 contains the v1alpha4 API implementation.
18+
// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1
19+
package v1alpha4

api/v1alpha4/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
)

api/v1alpha4/ibmpowervs_conversion.go

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
Copyright 2020 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 v1alpha4
18+
19+
import (
20+
"sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
21+
"sigs.k8s.io/controller-runtime/pkg/conversion"
22+
)
23+
24+
func (src *IBMPowerVSCluster) ConvertTo(dstRaw conversion.Hub) error {
25+
dst := dstRaw.(*v1beta1.IBMPowerVSCluster)
26+
27+
return Convert_v1alpha4_IBMPowerVSCluster_To_v1beta1_IBMPowerVSCluster(src, dst, nil)
28+
}
29+
30+
func (dst *IBMPowerVSCluster) ConvertFrom(srcRaw conversion.Hub) error {
31+
src := srcRaw.(*v1beta1.IBMPowerVSCluster)
32+
33+
return Convert_v1beta1_IBMPowerVSCluster_To_v1alpha4_IBMPowerVSCluster(src, dst, nil)
34+
}
35+
36+
func (src *IBMPowerVSClusterList) ConvertTo(dstRaw conversion.Hub) error {
37+
dst := dstRaw.(*v1beta1.IBMPowerVSClusterList)
38+
39+
return Convert_v1alpha4_IBMPowerVSClusterList_To_v1beta1_IBMPowerVSClusterList(src, dst, nil)
40+
}
41+
42+
func (dst *IBMPowerVSClusterList) ConvertFrom(srcRaw conversion.Hub) error {
43+
src := srcRaw.(*v1beta1.IBMPowerVSClusterList)
44+
45+
return Convert_v1beta1_IBMPowerVSClusterList_To_v1alpha4_IBMPowerVSClusterList(src, dst, nil)
46+
}
47+
48+
func (src *IBMPowerVSMachine) ConvertTo(dstRaw conversion.Hub) error {
49+
dst := dstRaw.(*v1beta1.IBMPowerVSMachine)
50+
51+
return Convert_v1alpha4_IBMPowerVSMachine_To_v1beta1_IBMPowerVSMachine(src, dst, nil)
52+
}
53+
54+
func (dst *IBMPowerVSMachine) ConvertFrom(srcRaw conversion.Hub) error {
55+
src := srcRaw.(*v1beta1.IBMPowerVSMachine)
56+
57+
return Convert_v1beta1_IBMPowerVSMachine_To_v1alpha4_IBMPowerVSMachine(src, dst, nil)
58+
}
59+
60+
func (src *IBMPowerVSMachineList) ConvertTo(dstRaw conversion.Hub) error {
61+
dst := dstRaw.(*v1beta1.IBMPowerVSMachineList)
62+
63+
return Convert_v1alpha4_IBMPowerVSMachineList_To_v1beta1_IBMPowerVSMachineList(src, dst, nil)
64+
}
65+
66+
func (dst *IBMPowerVSMachineList) ConvertFrom(srcRaw conversion.Hub) error {
67+
src := srcRaw.(*v1beta1.IBMPowerVSMachineList)
68+
69+
return Convert_v1beta1_IBMPowerVSMachineList_To_v1alpha4_IBMPowerVSMachineList(src, dst, nil)
70+
}
71+
72+
func (src *IBMPowerVSMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
73+
dst := dstRaw.(*v1beta1.IBMPowerVSMachineTemplate)
74+
75+
return Convert_v1alpha4_IBMPowerVSMachineTemplate_To_v1beta1_IBMPowerVSMachineTemplate(src, dst, nil)
76+
}
77+
78+
func (dst *IBMPowerVSMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
79+
src := srcRaw.(*v1beta1.IBMPowerVSMachineTemplate)
80+
81+
return Convert_v1beta1_IBMPowerVSMachineTemplate_To_v1alpha4_IBMPowerVSMachineTemplate(src, dst, nil)
82+
}
83+
84+
func (src *IBMPowerVSMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error {
85+
dst := dstRaw.(*v1beta1.IBMPowerVSMachineTemplateList)
86+
87+
return Convert_v1alpha4_IBMPowerVSMachineTemplateList_To_v1beta1_IBMPowerVSMachineTemplateList(src, dst, nil)
88+
}
89+
90+
func (dst *IBMPowerVSMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error {
91+
src := srcRaw.(*v1beta1.IBMPowerVSMachineTemplateList)
92+
93+
return Convert_v1beta1_IBMPowerVSMachineTemplateList_To_v1alpha4_IBMPowerVSMachineTemplateList(src, dst, nil)
94+
}

0 commit comments

Comments
 (0)