Skip to content

Commit c06c78a

Browse files
committed
feat: Add EKS handlers
Reusing as much as possible of the AWS handlers, with slight tweaks.
1 parent d182347 commit c06c78a

File tree

69 files changed

+2836
-146
lines changed

Some content is hidden

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

69 files changed

+2836
-146
lines changed

api/v1alpha1/clusterconfig_types.go

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ var (
3434
nutanixClusterConfigCRDDefinition []byte
3535
//go:embed crds/caren.nutanix.com_genericclusterconfigs.yaml
3636
genericClusterConfigCRDDefinition []byte
37+
//go:embed crds/caren.nutanix.com_eksclusterconfigs.yaml
38+
eksClusterConfigCRDDefinition []byte
3739

3840
dockerClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
3941
dockerClusterConfigCRDDefinition,
@@ -47,6 +49,9 @@ var (
4749
genericClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
4850
genericClusterConfigCRDDefinition,
4951
)
52+
eksClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
53+
eksClusterConfigCRDDefinition,
54+
)
5055
)
5156

5257
// +kubebuilder:object:root=true
@@ -70,7 +75,7 @@ type AWSClusterConfigSpec struct {
7075
// +kubebuilder:validation:Optional
7176
AWS *AWSSpec `json:"aws,omitempty"`
7277

73-
GenericClusterConfigSpec `json:",inline"`
78+
GenericClusterConfigResource `json:",inline"`
7479

7580
// +kubebuilder:validation:Optional
7681
Addons *AWSAddons `json:"addons,omitempty"`
@@ -105,7 +110,7 @@ type DockerClusterConfigSpec struct {
105110
// +kubebuilder:validation:Optional
106111
Docker *DockerSpec `json:"docker,omitempty"`
107112

108-
GenericClusterConfigSpec `json:",inline"`
113+
GenericClusterConfigResource `json:",inline"`
109114

110115
// +kubebuilder:validation:Optional
111116
Addons *DockerAddons `json:"addons,omitempty"`
@@ -145,7 +150,7 @@ type NutanixClusterConfigSpec struct {
145150
// +kubebuilder:validation:Optional
146151
Nutanix *NutanixSpec `json:"nutanix,omitempty"`
147152

148-
GenericClusterConfigSpec `json:",inline"`
153+
GenericClusterConfigResource `json:",inline"`
149154

150155
// +kubebuilder:validation:Optional
151156
Addons *NutanixAddons `json:"addons,omitempty"`
@@ -187,6 +192,13 @@ func (s GenericClusterConfig) VariableSchema() clusterv1.VariableSchema { //noli
187192

188193
// GenericClusterConfigSpec defines the desired state of GenericClusterConfig.
189194
type GenericClusterConfigSpec struct {
195+
GenericClusterConfigResource `json:",inline"`
196+
197+
// +kubebuilder:validation:Optional
198+
Addons *GenericAddons `json:"addons,omitempty"`
199+
}
200+
201+
type GenericClusterConfigResource struct {
190202
// Sets the Kubernetes image repository used for the KubeadmControlPlane.
191203
// +kubebuilder:validation:Optional
192204
// +kubebuilder:validation:Pattern=`^((?:[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*|\[(?:[a-fA-F0-9:]+)\])(:[0-9]+)?/)?[a-z0-9]+((?:[._]|__|[-]+)[a-z0-9]+)*(/[a-z0-9]+((?:[._]|__|[-]+)[a-z0-9]+)*)*$`
@@ -222,6 +234,31 @@ type GenericClusterConfigSpec struct {
222234
NTP *NTP `json:"ntp,omitempty"`
223235
}
224236

237+
// +kubebuilder:object:root=true
238+
239+
// EKSClusterConfig is the Schema for the eksclusterconfigs API.
240+
type EKSClusterConfig struct {
241+
metav1.TypeMeta `json:",inline"`
242+
metav1.ObjectMeta `json:"metadata,omitempty"`
243+
244+
// +kubebuilder:validation:Optional
245+
Spec EKSClusterConfigSpec `json:"spec,omitempty"`
246+
}
247+
248+
func (s EKSClusterConfig) VariableSchema() clusterv1.VariableSchema { //nolint:gocritic,lll // Passed by value for no potential side-effect.
249+
return eksClusterConfigVariableSchema
250+
}
251+
252+
// EKSClusterConfigSpec defines the desired state of ClusterConfig.
253+
type EKSClusterConfigSpec struct {
254+
// EKS cluster configuration.
255+
// +kubebuilder:validation:Optional
256+
EKS *EKSSpec `json:"eks,omitempty"`
257+
258+
// +kubebuilder:validation:Optional
259+
Addons *AWSAddons `json:"addons,omitempty"`
260+
}
261+
225262
type Image struct {
226263
// Repository is used to override the image repository to pull from.
227264
// +kubebuilder:validation:Optional

api/v1alpha1/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const (
1717
DockerVariableName = "docker"
1818
// NutanixVariableName is the Nutanix config patch variable name.
1919
NutanixVariableName = "nutanix"
20+
// AWSVariableName is the EKS config patch variable name.
21+
EKSVariableName = "eks"
2022

2123
// CNIVariableName is the CNI external patch variable name.
2224
CNIVariableName = "cni"

0 commit comments

Comments
 (0)