Skip to content
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

KubeRay Operator add-on #849

Merged
merged 19 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
1 change: 1 addition & 0 deletions docs/addons/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The framework currently supports the following add-ons.
| [`KonveyorAddOn`](https://github.com/claranet-ch/konveyor-eks-blueprint-addon) | Adds [Konveyor](https://www.konveyor.io/) to the EKS Cluster. | ✅ | ✅ |
| [`KubecostAddOn`](./kubecost.md) | Adds [Kubecost](https://kubecost.com) cost analyzer to the EKS cluster. | ✅ |
| [`KubeflowAddOn`](./kubeflow.md) | Adds [kubeflow](https://awslabs.github.io/kubeflow-manifests/) Kubeflow pipeline addon the EKS cluster. | ✅ |
| [`KubeRayAddOn`](./kuberay-operator.md) | Installs the [KubeRay Operator](https://docs.ray.io/en/latest/cluster/kubernetes/index.html). | ✅ | ✅ |
| [`KubeviousAddOn`](./kubevious.md) | Adds [Kubevious](https://github.com/kubevious/kubevious) open source Kubernetes dashboard to an EKS cluster. | ✅ |
| [`KarpenterAddOn`](./karpenter.md) | Adds [Karpenter](https://github.com/awslabs/karpenter) support for Amazon EKS. | ✅ | ✅ |
| [`KubeProxyAddOn`](./kube-proxy.md) | Adds kube-proxy Amazon EKS add-on. Kube-proxy maintains network rules on each Amazon EC2 node. | ✅ | ✅ |
Expand Down
51 changes: 51 additions & 0 deletions docs/addons/kuberay-operator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# KubeRay Operator Add-on
elamaran11 marked this conversation as resolved.
Show resolved Hide resolved

[Ray](https://github.com/ray-project/ray) is a framework for scaling AI applications written in Python. Ray consists of a core distributed runtime and a set of AI libraries for simplifying ML compute. Ray allows scaling applications from a laptop to a cluster.

KubeRay is a Kubernetes Operator that simplifies the deployment and management of Ray applications on Kubernetes. It is made of the following components:

- KubeRay core, the official, fully-maintained component of KubeRay that provides three custom resource definitions, RayCluster, RayJob, and RayService
- Community-managed components (optional): KubeRay APIServer, KubeRay Python client and KubeRay CLI

Please refer to [KubeRay Operator documentation](https://docs.ray.io/en/latest/cluster/kubernetes/index.html) for detailed information.

This add-on installs the KubeRay Operator [Helm chart](https://github.com/ray-project/kuberay/blob/master/helm-chart/kuberay-operator/README.md).

## Usage

```typescript
import { Construct } from 'constructs';
import * as blueprints from '@aws-quickstart/eks-blueprints';

export class KubeRayConstruct extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);

const stackID = `${id}-blueprint`;

const addOn = new blueprints.addons.KubeRayAddOn();

blueprints.EksBlueprint.builder()
.account(process.env.CDK_DEFAULT_ACCOUNT!)
.region(process.env.CDK_DEFAULT_REGION!)
.version('auto')
.addOns(addOn)
.build(scope, stackID);
}
}
```

## Validation

To validate the KubeRay Operator installation, please run the following command:

```bash
kubectl get pods
```

Expected output:

```bash
NAME READY STATUS RESTARTS AGE
kuberay-operator-58c98b495b-5k75l 1/1 Running 0 112m
```
3 changes: 2 additions & 1 deletion examples/blueprint-construct/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ export default class BlueprintConstruct {
}),
new blueprints.ExternalsSecretsAddOn(),
new blueprints.EksPodIdentityAgentAddOn(),
new blueprints.NeuronPluginAddOn(),
new blueprints.KubeRayAddOn(),
new blueprints.NeuronPluginAddOn()
];

// Instantiated to for helm version check.
Expand Down
1 change: 1 addition & 0 deletions lib/addons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export * from './helm-addon';
export * from './karpenter';
export * from './kube-proxy';
export * from './kube-state-metrics';
elamaran11 marked this conversation as resolved.
Show resolved Hide resolved
export * from './kuberay';
export * from './metrics-server';
export * from './nested-stack';
export * from './nginx';
Expand Down
55 changes: 55 additions & 0 deletions lib/addons/kuberay/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Construct } from 'constructs';
import merge from "ts-deepmerge";
import { ClusterInfo, Values } from "../../spi";
import { createNamespace } from "../../utils";
import { HelmAddOn, HelmAddOnProps, HelmAddOnUserProps } from "../helm-addon";

/**
* User provided options for the Helm Chart
*/
export interface KubeRayAddOnProps extends HelmAddOnUserProps {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there any common values that customers should configure when deploying this addon, that would make sense to promote to this struct and make explicit for the customers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there are no config values, please see here: https://ray-project.github.io/kuberay/deploy/helm/

/**
* To Create Namespace using CDK
*/
createNamespace?: boolean;
}

/**
* Default props to be used when creating the Helm chart
*/
const defaultProps: HelmAddOnProps & KubeRayAddOnProps = {
name: "kuberay-operator",
chart: "kuberay-operator",
namespace: "default",
version: "1.0.0",
release: "kuberay-operator",
repository: "https://ray-project.github.io/kuberay-helm",
values: {},
createNamespace: true
};

/**
* Main class to instantiate the Helm chart
*/
export class KubeRayAddOn extends HelmAddOn {

readonly options: KubeRayAddOnProps;
constructor(props?: KubeRayAddOnProps) {
super({...defaultProps, ...props});
this.options = this.props as KubeRayAddOnProps;
}

deploy(clusterInfo: ClusterInfo): Promise<Construct> {
const cluster = clusterInfo.cluster;
let values: Values = this.options.values ?? {};
values = merge(values, this.props.values ?? {});

const chart = this.addHelmChart(clusterInfo, values);

if( this.options.createNamespace == true){
const namespace = createNamespace(this.options.namespace! , cluster);
chart.node.addDependency(namespace);
}
return Promise.resolve(chart);
}
}
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ nav:
- Kube Proxy: 'addons/kube-proxy.md'
- Kubecost: 'addons/kubecost.md'
- Kubeflow: 'addons/kubeflow.md'
- KubeRay Operator: 'addons/kuberay-operator.md'
- Kubevious: 'addons/kubevious.md'
- Kube State Metrics: 'addons/kube-state-metrics.md'
- Metrics Server: 'addons/metrics-server.md'
Expand Down
Loading