Skip to content

Commit 68dee24

Browse files
committed
CABPK - v1alpha3 types
1 parent 7a1f750 commit 68dee24

38 files changed

+3162
-721
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ generate-go: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related generate tar
153153
--input-dirs=./api/v1alpha2 \
154154
--output-file-base=zz_generated.conversion \
155155
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
156+
$(CONVERSION_GEN) \
157+
--input-dirs=./bootstrap/kubeadm/api/v1alpha2 \
158+
--output-file-base=zz_generated.conversion \
159+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
156160

157161
.PHONY: generate-bindata
158162
generate-bindata: $(KUSTOMIZE) $(GOBINDATA) clean-bindata ## Generate code for embedding the clusterctl api manifest
@@ -170,17 +174,14 @@ generate-bindata: $(KUSTOMIZE) $(GOBINDATA) clean-bindata ## Generate code for e
170174
generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
171175
$(CONTROLLER_GEN) \
172176
paths=./api/... \
177+
paths=./bootstrap/kubeadm/api/... \
173178
paths=./controllers/... \
174179
paths=./bootstrap/kubeadm/controllers/... \
175180
crd:preserveUnknownFields=false \
176181
rbac:roleName=manager-role \
177182
output:crd:dir=./config/crd/bases \
178183
output:webhook:dir=./config/webhook \
179184
webhook
180-
$(CONTROLLER_GEN) \
181-
paths=./bootstrap/kubeadm/api/... \
182-
crd:trivialVersions=true,preserveUnknownFields=false \
183-
output:crd:dir=./config/crd/bases
184185
$(CONTROLLER_GEN) \
185186
paths=./cmd/clusterctl/api/... \
186187
crd:trivialVersions=true,preserveUnknownFields=false \

api/v1alpha3/kubeadm_control_plane_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package v1alpha3
1919
import (
2020
corev1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22-
cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2"
22+
cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
2323
"sigs.k8s.io/cluster-api/errors"
2424
)
2525

@@ -90,7 +90,7 @@ type KubeadmControlPlaneStatus struct {
9090
// state, and will be set to a token value suitable for
9191
// programmatic interpretation.
9292
// +optional
93-
Failurereason errors.KubeadmControlPlaneStatusError `json:"failureReason,omitempty"`
93+
FailureReason errors.KubeadmControlPlaneStatusError `json:"failureReason,omitempty"`
9494

9595
// ErrorMessage indicates that there is a terminal problem reconciling the
9696
// state, and will be set to a descriptive error message.

bootstrap/kubeadm/PROJECT

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ resources:
88
- group: bootstrap
99
version: v1alpha2
1010
kind: KubeadmConfigTemplate
11+
- group: bootstrap
12+
version: v1alpha3
13+
kind: KubeadmConfig
14+
- group: bootstrap
15+
version: v1alpha3
16+
kind: KubeadmConfigTemplate
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
Copyright 2019 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 v1alpha2
18+
19+
import (
20+
apiconversion "k8s.io/apimachinery/pkg/conversion"
21+
kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
22+
"sigs.k8s.io/controller-runtime/pkg/conversion"
23+
)
24+
25+
// ConvertTo converts this KubeadmConfig to the Hub version (v1alpha3).
26+
func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { // nolint
27+
dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig)
28+
return Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(src, dst, nil)
29+
}
30+
31+
// ConvertFrom converts from the KubeadmConfig Hub version (v1alpha3) to this version.
32+
func (dst *KubeadmConfig) ConvertFrom(srcRaw conversion.Hub) error { // nolint
33+
src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig)
34+
return Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(src, dst, nil)
35+
}
36+
37+
// ConvertTo converts this KubeadmConfigList to the Hub version (v1alpha3).
38+
func (src *KubeadmConfigList) ConvertTo(dstRaw conversion.Hub) error { // nolint
39+
dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList)
40+
return Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(src, dst, nil)
41+
}
42+
43+
// ConvertFrom converts from the KubeadmConfigList Hub version (v1alpha3) to this version.
44+
func (dst *KubeadmConfigList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
45+
src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList)
46+
return Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(src, dst, nil)
47+
}
48+
49+
// ConvertTo converts this KubeadmConfigTemplate to the Hub version (v1alpha3).
50+
func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { // nolint
51+
dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate)
52+
return Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(src, dst, nil)
53+
}
54+
55+
// ConvertFrom converts from the KubeadmConfigTemplate Hub version (v1alpha3) to this version.
56+
func (dst *KubeadmConfigTemplate) ConvertFrom(srcRaw conversion.Hub) error { // nolint
57+
src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate)
58+
return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(src, dst, nil)
59+
}
60+
61+
// ConvertTo converts this KubeadmConfigTemplateList to the Hub version (v1alpha3).
62+
func (src *KubeadmConfigTemplateList) ConvertTo(dstRaw conversion.Hub) error { // nolint
63+
dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList)
64+
return Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(src, dst, nil)
65+
}
66+
67+
// ConvertFrom converts from the KubeadmConfigTemplateList Hub version (v1alpha3) to this version.
68+
func (dst *KubeadmConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error { // nolint
69+
src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList)
70+
return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(src, dst, nil)
71+
}
72+
73+
// Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus converts this KubeadmConfigStatus to the Hub version (v1alpha3).
74+
func Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *KubeadmConfigStatus, out *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, s apiconversion.Scope) error { // nolint
75+
if err := autoConvert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in, out, s); err != nil {
76+
return err
77+
}
78+
79+
// Manually convert the Error fields to the Failure fields
80+
out.FailureMessage = in.ErrorMessage
81+
out.FailureReason = in.ErrorReason
82+
83+
return nil
84+
}
85+
86+
// Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus converts from the Hub version (v1alpha3) of the KubeadmConfigStatus to this version.
87+
func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, out *KubeadmConfigStatus, s apiconversion.Scope) error { // nolint
88+
if err := autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in, out, s); err != nil {
89+
return err
90+
}
91+
92+
// Manually convert the Failure fields to the Error fields
93+
out.ErrorMessage = in.FailureMessage
94+
out.ErrorReason = in.FailureReason
95+
96+
return nil
97+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Copyright 2019 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+
// +k8s:conversion-gen=sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3
18+
package v1alpha2

bootstrap/kubeadm/api/v1alpha2/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
)

bootstrap/kubeadm/api/v1alpha2/kubeadmbootstrapconfig_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ type KubeadmConfigStatus struct {
8282

8383
// +kubebuilder:object:root=true
8484
// +kubebuilder:resource:path=kubeadmconfigs,scope=Namespaced,categories=cluster-api
85-
// +kubebuilder:storageversion
8685
// +kubebuilder:subresource:status
8786

8887
// KubeadmConfig is the Schema for the kubeadmconfigs API

bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type KubeadmConfigTemplateSpec struct {
2727

2828
// +kubebuilder:object:root=true
2929
// +kubebuilder:resource:path=kubeadmconfigtemplates,scope=Namespaced,categories=cluster-api
30-
// +kubebuilder:storageversion
3130

3231
// KubeadmConfigTemplate is the Schema for the kubeadmconfigtemplates API
3332
type KubeadmConfigTemplate struct {

0 commit comments

Comments
 (0)