Skip to content

Commit 5a6ccd8

Browse files
committed
refactor: move kubeadm config out of GenericNodeSpec
1 parent 1ef4f34 commit 5a6ccd8

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

api/v1alpha1/controlplane_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type DockerControlPlaneSpec struct {
2626

2727
GenericControlPlaneSpec `json:",inline"`
2828

29+
KubeadmNodeSpec `json:",inline"`
2930
GenericNodeSpec `json:",inline"`
3031
}
3132

@@ -36,6 +37,7 @@ type NutanixControlPlaneSpec struct {
3637

3738
GenericControlPlaneSpec `json:",inline"`
3839

40+
KubeadmNodeSpec `json:",inline"`
3941
GenericNodeSpec `json:",inline"`
4042
}
4143

@@ -46,5 +48,6 @@ type AWSControlPlaneSpec struct {
4648

4749
GenericControlPlaneSpec `json:",inline"`
4850

51+
KubeadmNodeSpec `json:",inline"`
4952
GenericNodeSpec `json:",inline"`
5053
}

api/v1alpha1/nodeconfig_types.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type AWSWorkerNodeConfigSpec struct {
5454
// +kubebuilder:validation:Optional
5555
AWS *AWSWorkerNodeSpec `json:"aws,omitempty"`
5656

57+
KubeadmNodeSpec `json:",inline"`
5758
GenericNodeSpec `json:",inline"`
5859
}
5960

@@ -79,6 +80,7 @@ type DockerWorkerNodeConfigSpec struct {
7980
// +kubebuilder:validation:Optional
8081
Docker *DockerNodeSpec `json:"docker,omitempty"`
8182

83+
KubeadmNodeSpec `json:",inline"`
8284
GenericNodeSpec `json:",inline"`
8385
}
8486

@@ -102,19 +104,22 @@ type NutanixWorkerNodeConfigSpec struct {
102104
// +kubebuilder:validation:Optional
103105
Nutanix *NutanixWorkerNodeSpec `json:"nutanix,omitempty"`
104106

107+
KubeadmNodeSpec `json:",inline"`
105108
GenericNodeSpec `json:",inline"`
106109
}
107110

111+
type KubeadmNodeSpec struct {
112+
// NodeRegistration holds fields that relate to registering the new control-plane node to the cluster.
113+
// +kubebuilder:validation:Optional
114+
// +kubebuilder:default={}
115+
NodeRegistration *NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
116+
}
117+
108118
type GenericNodeSpec struct {
109119
// Taints specifies the taints the Node API object should be registered with.
110120
// +kubebuilder:validation:Optional
111121
// +kubebuilder:validation:MaxItems=32
112122
Taints []Taint `json:"taints,omitempty"`
113-
114-
// NodeRegistration holds fields that relate to registering the new control-plane node to the cluster.
115-
// +kubebuilder:validation:Optional
116-
// +kubebuilder:default={}
117-
NodeRegistration *NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
118123
}
119124

120125
// +kubebuilder:object:root=true

api/v1alpha1/zz_generated.deepcopy.go

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

api/variables/aggregate_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type ControlPlaneSpec struct {
4141

4242
carenv1.GenericControlPlaneSpec `json:",inline"`
4343

44+
carenv1.KubeadmNodeSpec `json:",inline"`
4445
carenv1.GenericNodeSpec `json:",inline"`
4546
}
4647

@@ -53,6 +54,7 @@ type WorkerNodeConfigSpec struct {
5354

5455
EKS *carenv1.AWSWorkerNodeSpec `json:"eks,omitempty"`
5556

57+
carenv1.KubeadmNodeSpec `json:",inline"`
5658
carenv1.GenericNodeSpec `json:",inline"`
5759
}
5860

pkg/handlers/generic/mutation/noderegistration/variables_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestVariableValidation(t *testing.T) {
2424
Name: "specified IgnorePreflightErrors",
2525
Vals: v1alpha1.NutanixClusterConfigSpec{
2626
ControlPlane: &v1alpha1.NutanixControlPlaneSpec{
27-
GenericNodeSpec: v1alpha1.GenericNodeSpec{
27+
KubeadmNodeSpec: v1alpha1.KubeadmNodeSpec{
2828
NodeRegistration: &v1alpha1.NodeRegistrationOptions{
2929
IgnorePreflightErrors: []string{"all"},
3030
},

0 commit comments

Comments
 (0)