Skip to content
Merged
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
30 changes: 30 additions & 0 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 Down Expand Up @@ -234,6 +239,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
355 changes: 355 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_eksclusterconfigs.yaml

Large diffs are not rendered by default.

156 changes: 156 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_eksworkernodeconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Copyright 2024 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.18.0
name: eksworkernodeconfigs.caren.nutanix.com
spec:
group: caren.nutanix.com
names:
kind: EKSWorkerNodeConfig
listKind: EKSWorkerNodeConfigList
plural: eksworkernodeconfigs
singular: eksworkernodeconfig
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: EKSWorkerNodeConfig is the Schema for the eksnodeconfigs API.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: |-
EKSWorkerNodeConfigSpec defines the desired state of EKSNodeConfig.
Place any configuration that can be applied to individual Nodes here.
Otherwise, it should go into the ClusterConfigSpec.
properties:
eks:
properties:
additionalSecurityGroups:
items:
properties:
id:
description: ID is the id of the security group
format: ^sg-[0-9a-f]{8}(?:[0-9a-f]{9})?$
minLength: 1
type: string
type: object
maxItems: 32
type: array
ami:
description: |-
AMI or AMI Lookup arguments for machine image of a AWS machine.
If both AMI ID and AMI lookup arguments are provided then AMI ID takes precedence
properties:
id:
description: AMI ID is the reference to the AMI from which
to create the machine instance.
format: ^ami-[0-9a-f]{8}(?:[0-9a-f]{9})?$
minLength: 1
type: string
lookup:
description: Lookup is the lookup arguments for the AMI.
properties:
baseOS:
description: The name of the base os for image lookup
maxLength: 32
minLength: 1
type: string
format:
description: |-
AMI naming format. Supports substitutions for {{.BaseOS}} and {{.K8sVersion}} with the
base OS and kubernetes version.
example: capa-ami-{{.BaseOS}}-?{{.K8sVersion}}-*
maxLength: 128
minLength: 1
type: string
org:
description: The AWS Organization ID to use for image
lookup.
format: ^o-[0-9a-z]{10,32}$
maxLength: 34
minLength: 12
type: string
type: object
type: object
iamInstanceProfile:
default: nodes.cluster-api-provider-aws.sigs.k8s.io
description: The IAM instance profile to use for the cluster Machines.
maxLength: 128
minLength: 1
type: string
instanceType:
default: m5.2xlarge
description: The AWS instance type to use for the cluster Machines.
maxLength: 32
minLength: 1
type: string
placementGroup:
description: PlacementGroup specifies the placement group in which
to launch the instance.
properties:
name:
description: Name is the name of the placement group.
maxLength: 255
minLength: 1
type: string
required:
- name
type: object
type: object
taints:
description: Taints specifies the taints the Node API object should
be registered with.
items:
description: |-
The node this Taint is attached to has the "effect" on
any pod that does not tolerate the Taint.
properties:
effect:
default: NoSchedule
description: |-
The effect of the taint on pods that do not tolerate the taint.
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
enum:
- NoSchedule
- PreferNoSchedule
- NoExecute
type: string
key:
description: The taint key to be applied to a node.
maxLength: 253
type: string
value:
description: The taint value corresponding to the taint key.
maxLength: 63
minLength: 1
type: string
required:
- effect
- key
type: object
type: array
type: object
type: object
served: true
storage: true
14 changes: 14 additions & 0 deletions api/v1alpha1/eks_clusterconfig_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2023 Nutanix. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

type EKSSpec struct {
// AWS region to create cluster in.
// +kubebuilder:validation:Optional
Region *Region `json:"region,omitempty"`

// AWS network configuration.
// +kubebuilder:validation:Optional
Network *AWSNetwork `json:"network,omitempty"`
}
41 changes: 38 additions & 3 deletions api/v1alpha1/nodeconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ var (
awsNodeConfigCRDDefinition []byte
//go:embed crds/caren.nutanix.com_nutanixworkernodeconfigs.yaml
nutanixNodeConfigCRDDefinition []byte
//go:embed crds/caren.nutanix.com_eksworkernodeconfigs.yaml
eksNodeConfigCRDDefinition []byte

dockerNodeConfigVariableSchema = variables.MustSchemaFromCRDYAML(
dockerNodeConfigCRDDefinition,
)
awsWorkerNodeConfigVariableSchema = variables.MustSchemaFromCRDYAML(awsNodeConfigCRDDefinition)
nutanixNodeConfigVariableSchema = variables.MustSchemaFromCRDYAML(
awsNodeConfigVariableSchema = variables.MustSchemaFromCRDYAML(awsNodeConfigCRDDefinition)
nutanixNodeConfigVariableSchema = variables.MustSchemaFromCRDYAML(
nutanixNodeConfigCRDDefinition,
)
eksNodeConfigVariableSchema = variables.MustSchemaFromCRDYAML(eksNodeConfigCRDDefinition)
)

// +kubebuilder:object:root=true
Expand All @@ -41,7 +44,7 @@ type AWSWorkerNodeConfig struct {
}

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

// AWSWorkerNodeConfigSpec defines the desired state of AWSNodeConfig.
Expand Down Expand Up @@ -114,6 +117,37 @@ type GenericNodeSpec struct {
NodeRegistration *NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
}

// +kubebuilder:object:root=true

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

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

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

// EKSWorkerNodeConfigSpec defines the desired state of EKSNodeConfig.
// Place any configuration that can be applied to individual Nodes here.
// Otherwise, it should go into the ClusterConfigSpec.
type EKSWorkerNodeConfigSpec struct {
// +kubebuilder:validation:Optional
EKS *AWSWorkerNodeSpec `json:"eks,omitempty"`

EKSNodeSpec `json:",inline"`
}

type EKSNodeSpec struct {
// Taints specifies the taints the Node API object should be registered with.
// +kubebuilder:validation:Optional
Taints []Taint `json:"taints,omitempty"`
}

// The node this Taint is attached to has the "effect" on
// any pod that does not tolerate the Taint.
type Taint struct {
Expand Down Expand Up @@ -174,5 +208,6 @@ func init() {
&AWSWorkerNodeConfig{},
&DockerWorkerNodeConfig{},
&NutanixWorkerNodeConfig{},
&EKSWorkerNodeConfig{},
)
}
Loading
Loading