Skip to content

Commit

Permalink
Merge pull request #5279 from enxebre/autonode-karpenter
Browse files Browse the repository at this point in the history
HOSTEDCP-2220: Autonode karpenter
  • Loading branch information
openshift-merge-bot[bot] authored Dec 17, 2024
2 parents 68f7ab0 + f596b35 commit 59e208a
Show file tree
Hide file tree
Showing 46 changed files with 13,577 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ WORKDIR /hypershift

COPY . .

RUN make hypershift hypershift-operator product-cli
RUN make hypershift hypershift-operator product-cli karpenter-operator

FROM registry.access.redhat.com/ubi9:latest
COPY --from=builder /hypershift/bin/hypershift \
/hypershift/bin/hcp \
/hypershift/bin/hypershift-operator \
/hypershift/bin/karpenter-operator \
/usr/bin/

ENTRYPOINT ["/usr/bin/hypershift"]
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ OUT_DIR ?= bin

# run the HO locally
HYPERSHIFT_INSTALL_AWS := ./hack/dev/aws/hypershft-install-aws.sh
RUN_OPERATOR_LOCALLY_AWS := ./hack/dev/aws/run-operator-locally-aws.sh
RUN_OPERATOR_LOCALLY_AWS := ./hack/dev/aws/run-operator-locally-aws-dev.sh

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -89,6 +89,10 @@ tests:
hypershift-operator:
$(GO_BUILD_RECIPE) -o $(OUT_DIR)/hypershift-operator ./hypershift-operator

.PHONY: karpenter-operator
karpenter-operator:
$(GO_BUILD_RECIPE) -o $(OUT_DIR)/karpenter-operator ./karpenter-operator

.PHONY: control-plane-operator
control-plane-operator:
$(GO_BUILD_RECIPE) -o $(OUT_DIR)/control-plane-operator ./control-plane-operator
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
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
85 changes: 85 additions & 0 deletions api/hypershift/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ hostedclusters.hypershift.openshift.io:
Category: ""
FeatureGates:
- AROHCPManagedIdentities
- AutoNodeKarpenter
- DynamicResourceAllocation
- ExternalOIDC
- HCPPodsLabels
Expand Down Expand Up @@ -149,6 +150,7 @@ hostedcontrolplanes.hypershift.openshift.io:
Category: cluster-api
FeatureGates:
- AROHCPManagedIdentities
- AutoNodeKarpenter
- DynamicResourceAllocation
- ExternalOIDC
- NetworkDiagnosticsConfig
Expand Down
Loading

0 comments on commit 59e208a

Please sign in to comment.