Skip to content

Commit 91b1ea3

Browse files
committed
feat: Add EKS handlers
Reusing as much as possible of the AWS handlers, with slight tweaks.
1 parent 113014a commit 91b1ea3

File tree

67 files changed

+2833
-144
lines changed

Some content is hidden

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

67 files changed

+2833
-144
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"`
@@ -107,7 +112,7 @@ type DockerClusterConfigSpec struct {
107112
// +kubebuilder:validation:Optional
108113
Docker *DockerSpec `json:"docker,omitempty"`
109114

110-
GenericClusterConfigSpec `json:",inline"`
115+
GenericClusterConfigResource `json:",inline"`
111116

112117
// +kubebuilder:validation:Optional
113118
Addons *DockerAddons `json:"addons,omitempty"`
@@ -149,7 +154,7 @@ type NutanixClusterConfigSpec struct {
149154
// +kubebuilder:validation:Optional
150155
Nutanix *NutanixSpec `json:"nutanix,omitempty"`
151156

152-
GenericClusterConfigSpec `json:",inline"`
157+
GenericClusterConfigResource `json:",inline"`
153158

154159
// +kubebuilder:validation:Optional
155160
Addons *NutanixAddons `json:"addons,omitempty"`
@@ -195,6 +200,13 @@ func (s GenericClusterConfig) VariableSchema() clusterv1.VariableSchema { //noli
195200

196201
// GenericClusterConfigSpec defines the desired state of GenericClusterConfig.
197202
type GenericClusterConfigSpec struct {
203+
GenericClusterConfigResource `json:",inline"`
204+
205+
// +kubebuilder:validation:Optional
206+
Addons *GenericAddons `json:"addons,omitempty"`
207+
}
208+
209+
type GenericClusterConfigResource struct {
198210
// Sets the Kubernetes image repository used for the KubeadmControlPlane.
199211
// +kubebuilder:validation:Optional
200212
// +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]+)*)*$`
@@ -234,6 +246,31 @@ type GenericClusterConfigSpec struct {
234246
NTP *NTP `json:"ntp,omitempty"`
235247
}
236248

249+
// +kubebuilder:object:root=true
250+
251+
// EKSClusterConfig is the Schema for the eksclusterconfigs API.
252+
type EKSClusterConfig struct {
253+
metav1.TypeMeta `json:",inline"`
254+
metav1.ObjectMeta `json:"metadata,omitempty"`
255+
256+
// +kubebuilder:validation:Optional
257+
Spec EKSClusterConfigSpec `json:"spec,omitempty"`
258+
}
259+
260+
func (s EKSClusterConfig) VariableSchema() clusterv1.VariableSchema { //nolint:gocritic,lll // Passed by value for no potential side-effect.
261+
return eksClusterConfigVariableSchema
262+
}
263+
264+
// EKSClusterConfigSpec defines the desired state of ClusterConfig.
265+
type EKSClusterConfigSpec struct {
266+
// EKS cluster configuration.
267+
// +kubebuilder:validation:Optional
268+
EKS *EKSSpec `json:"eks,omitempty"`
269+
270+
// +kubebuilder:validation:Optional
271+
Addons *AWSAddons `json:"addons,omitempty"`
272+
}
273+
237274
type Image struct {
238275
// Repository is used to override the image repository to pull from.
239276
// +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)