Skip to content

Commit

Permalink
Add AutoNode Karpenter feature gated API support
Browse files Browse the repository at this point in the history
  • Loading branch information
enxebre committed Dec 17, 2024
1 parent 2c4aee6 commit 258e974
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"featureGates": [
{
"disabled": [
{
"name": "AutoNodeKarpenter",
},
{
"name": "AROHCPManagedIdentities"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
{
"disabled": [],
"enabled": [
{
"name": "AutoNodeKarpenter",
},
{
"name": "AROHCPManagedIdentities"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"featureGates": [
{
"disabled": [
{
"name": "AutoNodeKarpenter",
},
{
"name": "AROHCPManagedIdentities"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
{
"disabled": [],
"enabled": [
{
"name": "AutoNodeKarpenter",
},
{
"name": "AROHCPManagedIdentities"
},
Expand Down
4 changes: 4 additions & 0 deletions api/hypershift/v1beta1/hosted_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ type HostedControlPlaneSpec struct {
// +optional
Autoscaling ClusterAutoscaling `json:"autoscaling,omitempty"`

// autoNode specifies the configuration for the autoNode feature.
// +openshift:enable:FeatureGate=AutoNodeKarpenter
AutoNode *AutoNode `json:"autoNode,omitempty"`

// NodeSelector when specified, must be true for the pods managed by the HostedCluster to be scheduled.
//
// +optional
Expand Down
45 changes: 45 additions & 0 deletions api/hypershift/v1beta1/hostedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ type HostedClusterSpec struct {
// +optional
Autoscaling ClusterAutoscaling `json:"autoscaling,omitempty"`

// autoNode specifies the configuration for the autoNode feature.
// +openshift:enable:FeatureGate=AutoNodeKarpenter
AutoNode *AutoNode `json:"autoNode,omitempty"`

// etcd specifies configuration for the control plane etcd cluster. The
// default managementType is Managed. Once set, the managementType cannot be
// changed.
Expand Down Expand Up @@ -1096,6 +1100,47 @@ type Release struct {
Image string `json:"image"`
}

// We expose here internal configuration knobs that won't be exposed to the service.
type AutoNode struct {
// provisioner is the implementation used for Node auto provisioning.
// +required
Provisioner *ProvisionerConfig `json:"provisionerConfig"`
}

// ProvisionerConfig is a enum specifying the strategy for auto managing Nodes.
type ProvisionerConfig struct {
// name specifies the name of the provisioner to use.
// +required
// +kubebuilder:validation:Enum=Karpenter
Name Provisioner `json:"name"`
// karpenter specifies the configuration for the Karpenter provisioner.
// +optional
Karpenter *KarpenterConfig `json:"karpenter,omitempty"`
}

type KarpenterConfig struct {
// platform specifies the platform-specific configuration for Karpenter.
// +required
Platform PlatformType `json:"platform"`
// aws specifies the AWS-specific configuration for Karpenter.
// +optional
AWS *KarpenterAWSConfig `json:"aws,omitempty"`
}

type KarpenterAWSConfig struct {
//arn specifies the ARN of the Karpenter provisioner.
// +required
RoleARN string `json:"roleARN"`
}

const (
ProvisionerKarpeneter Provisioner = "Karpenter"
)

// provisioner is a enum specifying the strategy for auto managing Nodes.
// +kubebuilder:validation:Enum=Karpenter
type Provisioner string

// ClusterAutoscaling specifies auto-scaling behavior that applies to all
// NodePools associated with a control plane.
type ClusterAutoscaling struct {
Expand Down

0 comments on commit 258e974

Please sign in to comment.