Skip to content

Commit

Permalink
Merge pull request #846 from aws-quickstart/fix/genAIandGravitonBuild…
Browse files Browse the repository at this point in the history
…erClasses

New Decorator for Architecture Type for all Addons and Graviton Builder Classes && Gen AI Builder and Team
  • Loading branch information
shapirov103 authored Oct 6, 2023
2 parents a7737fb + 78d12cb commit 9db7c93
Show file tree
Hide file tree
Showing 69 changed files with 669 additions and 72 deletions.
66 changes: 66 additions & 0 deletions docs/builders/bedrock-builder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Bedrock Builder

The `BedrockBuilder` allows you to get started with a builder class to configure required addons as you prepare a blueprint for setting up EKS cluster with access to Bedrock.

The `BedrockBuilder` creates the following:

- An EKS Cluster` with passed k8s version and cluster tags.
- A nodegroup to schedule Gen AI workloads with parameters passed.
- Sets up IRSA with access to Bedrock service.

### Bedrock on EKS Cluster

The below usage helps you with a demonstration to use `BedrockBuilder` to setup required addons as you prepare a blueprint for setting up Bedrock access to a new EKS cluster.

```typescript
import { ApplicationTeam, BedrockBuilder, ClusterInfo } from "@aws-quickstart/eks-blueprints";
import * as blueprints from "@aws-quickstart/eks-blueprints";
import * as spi from '@aws-quickstart/eks-blueprints/dist/spi';
import { Construct } from "constructs";
import { loadYaml, readYamlDocument } from "@aws-quickstart/eks-blueprints/dist/utils";
import { KubectlProvider, ManifestDeployment } from "@aws-quickstart/eks-blueprints/dist/addons/helm-addon/kubectl-provider";

export default class GenAIShowcase {
constructor(scope: Construct, id: string) {
const account = process.env.CDK_DEFAULT_ACCOUNT!;
const region = process.env.CDK_DEFAULT_REGION!;
const stackID = `${id}-blueprint`;

const bedrockTeamProps: blueprints.teams.BedrockTeamProps = {
name: blueprints.utils.valueFromContext(scope, "bedrock.pattern.name", "showcase"),
namespace: blueprints.utils.valueFromContext(scope, "bedrock.pattern.namespace", "bedrock"),
createNamespace: true,
serviceAccountName: 'bedrock-service-account',
extensionFunction: extensionFunction
};

BedrockBuilder.builder()
.account(account)
.region(region)
.version('auto')
.addBedrockTeam(bedrockTeamProps)
.build(scope, stackID);
}
}

function extensionFunction(team: ApplicationTeam, clusterInfo: ClusterInfo) {
const values: spi.Values = {
namespace: team.teamProps.namespace,
imageName: blueprints.utils.valueFromContext(clusterInfo.cluster, "bedrock.pattern.image.name", undefined),
imageTag: blueprints.utils.valueFromContext(clusterInfo.cluster, "bedrock.pattern.image.tag", undefined)
};

// Apply manifest
const doc = readYamlDocument(__dirname + '/deployment/showcase-deployment.ytpl');
const manifest = doc.split("---").map((e: any) => loadYaml(e));

const manifestDeployment: ManifestDeployment = {
name: team.teamProps.name,
namespace: team.teamProps.namespace!,
manifest,
values
};
const manifestConstruct = new KubectlProvider(clusterInfo).addManifest(manifestDeployment);
manifestConstruct.node.addDependency(team.serviceAccount);
}
```
6 changes: 3 additions & 3 deletions docs/builders/gpu-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `GpuBuilder` allows you to get started with a builder class to configure wit

The `GpuBuilder` creates the following:
- An EKS Cluster` with passed k8s version and cluster tags.
- A nodegroup to schedule windows workloads with parameters passed.
- A nodegroup to schedule GPU workloads with parameters passed.

## Input Parameters

Expand All @@ -13,7 +13,7 @@ The `GpuBuilder` creates the following:
- `kubernetesVersion` : Required field, Kubernetes version to use for the cluster
- `instanceClass`: Required field, Instance class to use for the cluster
- `instanceSize`: Required field, Instance size to use for the cluster
- `nodeRole`: optional, Node IAM Role to be attached to Windows and Non-windows nodes.
- `nodeRole`: optional, Node IAM Role to be attached to nodes.
- `gpuAmiType`: Required field, AMI Type for GPU Nodes. For example `AL2_X86_64_GPU`.
- `desiredNodeSize`: Optional field, Desired number of nodes to use for the cluster
- `minNodeSize`: Optional field, Minimum number of nodes to use for the cluster
Expand All @@ -24,7 +24,7 @@ The `GpuBuilder` creates the following:

### Demonstration - Running GPUs on EKS Cluster

The below usage helps you with a demonstration to use `GpuBuilder` to configure a required setup as you prepare a blueprint for setting up windows nodes on a new EKS cluster.
The below usage helps you with a demonstration to use `GpuBuilder` to configure a required setup as you prepare a blueprint for setting up GPU nodes on a new EKS cluster.

```typescript
import * as blueprints from "@aws-quickstart/eks-blueprints";
Expand Down
92 changes: 92 additions & 0 deletions docs/builders/graviton-builder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# GPU Builder

The `GravitonBuilder` allows you to get started with a builder class to configure with required setup as you prepare a blueprint for setting up EKS cluster with Graviton worker nodes to run your ARM64 workloads.

The `GravitonBuilder` creates the following:

- An EKS Cluster` with passed k8s version and cluster tags.
- A nodegroup to schedule ARM64 workloads with parameters passed.

## Input Parameters

`Partial<MngClusterProviderProps>` parameters can be used as inputs to `GravitonBuilder`. Few parameters shown below:

- `version` : Kubernetes version to use for the cluster
- `instanceTypes`: Instance Type to use for the cluster

### Demonstration - Running Graviton Nodes on EKS Cluster

The below usage helps you with a demonstration to use `GravitonBuilder` to configure a required setup as you prepare a blueprint for setting up Graviton nodes on a new EKS cluster.

```typescript
import * as blueprints from "@aws-quickstart/eks-blueprints";
import { GravitonBuilder } from "@aws-quickstart/eks-blueprints";
import { CfnWorkspace } from "aws-cdk-lib/aws-aps";
import * as ec2 from "aws-cdk-lib/aws-ec2";
import * as eks from "aws-cdk-lib/aws-eks";
import { Construct } from "constructs";

export default class GravitonConstruct {
build(scope: Construct, id: string) {
const account = process.env.CDK_DEFAULT_ACCOUNT!;
const region = process.env.CDK_DEFAULT_REGION!;
const stackID = `${id}-blueprint`;

const ampWorkspaceName = "graviton-amp-workspaces";
const ampWorkspace: CfnWorkspace =
blueprints.getNamedResource(ampWorkspaceName);

const options: Partial<blueprints.MngClusterProviderProps> = {
version: eks.KubernetesVersion.of("1.27"),
instanceTypes: [ec2.InstanceType.of(ec2.InstanceClass.M7G, ec2.InstanceSize.XLARGE)],
desiredSize: 3,
minSize: 2,
maxSize: 5,
};

GravitonBuilder.builder(options)
.account(account)
.region(region)
.resourceProvider(
blueprints.GlobalResources.Vpc,
new blueprints.VpcProvider()
)
.resourceProvider(
"efs-file-system",
new blueprints.CreateEfsFileSystemProvider({
name: "efs-file-systems",
})
)
.resourceProvider(
ampWorkspaceName,
new blueprints.CreateAmpProvider(
ampWorkspaceName,
ampWorkspaceName
)
)
.addOns(
new blueprints.addons.IstioBaseAddOn(),
new blueprints.addons.IstioControlPlaneAddOn(),
new blueprints.addons.KubeStateMetricsAddOn(),
new blueprints.addons.MetricsServerAddOn(),
new blueprints.addons.PrometheusNodeExporterAddOn(),
new blueprints.addons.ExternalsSecretsAddOn(),
new blueprints.addons.SecretsStoreAddOn(),
new blueprints.addons.CalicoOperatorAddOn(),
new blueprints.addons.CertManagerAddOn(),
new blueprints.addons.AdotCollectorAddOn(),
new blueprints.addons.AmpAddOn({
ampPrometheusEndpoint: ampWorkspace.attrPrometheusEndpoint
}),
new blueprints.addons.CloudWatchLogsAddon({
logGroupPrefix: "/aws/eks/graviton-blueprint",
}),
new blueprints.addons.EfsCsiDriverAddOn(),
new blueprints.addons.FluxCDAddOn(),
new blueprints.addons.GrafanaOperatorAddon(),
new blueprints.addons.XrayAdotAddOn()
)
.build(scope, stackID);
}
}
```
6 changes: 5 additions & 1 deletion docs/builders/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ The framework currently provides support for the following Builders:

| Builder | Description |
|-------------------|-----------------------------------------------------------------------------------|
| [`ObservabilityBuilder`](./observability-builder.md) | Allows you to get started with a builder class to configure required addons as you prepare a blueprint for setting up Observability on an existing EKS cluster or a new EKS cluster.
| [`BedrockBuilder`](./bedrock-builder.md) | The `BedrockBuilder` allows you to get started with a builder class to configure required addons as you prepare a blueprint for setting up an EKS cluster with access to Amazon Bedrock.
| [`GpuBuilder`](./gpu-builder.md) | The `GpuBuilder` allows you to get started with a builder class to configure with required setup as you prepare a blueprint for setting up EKS cluster with GPU Operator to run your GPU workloads.
| [`GravitonBuilder`](./graviton-builder.md) | The `GravitonBuilder` allows you to get started with a builder class to configure with required setup as you prepare a blueprint for setting up EKS cluster with Graviton worker nodes to run your ARM64 workloads.
| [`ObservabilityBuilder`](./observability-builder.md) | The `ObservabilityBuilder` allows you to get started with a builder class to configure required addons as you prepare a blueprint for setting up Observability on an existing EKS cluster or a new EKS cluster.
| [`WindowsBuilder`](./windows-builder.md) | The `WindowsBuilder` allows you to get started with a builder class to configure with required setup as you prepare a blueprint for setting up EKS cluster with windows to run your windows workloads.

Loading

0 comments on commit 9db7c93

Please sign in to comment.