Skip to content

feat: Add EKS handlers #1254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: jimmi/add-eks-external-api
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions api/v1alpha1/clusterconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ var (
nutanixClusterConfigCRDDefinition []byte
//go:embed crds/caren.nutanix.com_genericclusterconfigs.yaml
genericClusterConfigCRDDefinition []byte
//go:embed crds/caren.nutanix.com_eksclusterconfigs.yaml
eksClusterConfigCRDDefinition []byte

dockerClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
dockerClusterConfigCRDDefinition,
Expand All @@ -47,6 +49,9 @@ var (
genericClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
genericClusterConfigCRDDefinition,
)
eksClusterConfigVariableSchema = variables.MustSchemaFromCRDYAML(
eksClusterConfigCRDDefinition,
)
)

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

GenericClusterConfigSpec `json:",inline"`
GenericClusterConfigResource `json:",inline"`

// +kubebuilder:validation:Optional
Addons *AWSAddons `json:"addons,omitempty"`
Expand Down Expand Up @@ -105,7 +110,7 @@ type DockerClusterConfigSpec struct {
// +kubebuilder:validation:Optional
Docker *DockerSpec `json:"docker,omitempty"`

GenericClusterConfigSpec `json:",inline"`
GenericClusterConfigResource `json:",inline"`

// +kubebuilder:validation:Optional
Addons *DockerAddons `json:"addons,omitempty"`
Expand Down Expand Up @@ -145,7 +150,7 @@ type NutanixClusterConfigSpec struct {
// +kubebuilder:validation:Optional
Nutanix *NutanixSpec `json:"nutanix,omitempty"`

GenericClusterConfigSpec `json:",inline"`
GenericClusterConfigResource `json:",inline"`

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

// GenericClusterConfigSpec defines the desired state of GenericClusterConfig.
type GenericClusterConfigSpec struct {
GenericClusterConfigResource `json:",inline"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please clarify why this is changing


// +kubebuilder:validation:Optional
Addons *GenericAddons `json:"addons,omitempty"`
}

type GenericClusterConfigResource struct {
// Sets the Kubernetes image repository used for the KubeadmControlPlane.
// +kubebuilder:validation:Optional
// +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]+)*)*$`
Expand Down Expand Up @@ -222,6 +234,31 @@ type GenericClusterConfigSpec struct {
NTP *NTP `json:"ntp,omitempty"`
}

// +kubebuilder:object:root=true

// EKSClusterConfig is the Schema for the eksclusterconfigs API.
type EKSClusterConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:validation:Optional
Spec EKSClusterConfigSpec `json:"spec,omitempty"`
}

func (s EKSClusterConfig) VariableSchema() clusterv1.VariableSchema { //nolint:gocritic,lll // Passed by value for no potential side-effect.
return eksClusterConfigVariableSchema
}

// EKSClusterConfigSpec defines the desired state of ClusterConfig.
type EKSClusterConfigSpec struct {
// EKS cluster configuration.
// +kubebuilder:validation:Optional
EKS *EKSSpec `json:"eks,omitempty"`

// +kubebuilder:validation:Optional
Addons *AWSAddons `json:"addons,omitempty"`
}

type Image struct {
// Repository is used to override the image repository to pull from.
// +kubebuilder:validation:Optional
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const (
DockerVariableName = "docker"
// NutanixVariableName is the Nutanix config patch variable name.
NutanixVariableName = "nutanix"
// AWSVariableName is the EKS config patch variable name.
EKSVariableName = "eks"

// CNIVariableName is the CNI external patch variable name.
CNIVariableName = "cni"
Expand Down
Loading
Loading