-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #846 from aws-quickstart/fix/genAIandGravitonBuild…
…erClasses New Decorator for Architecture Type for all Addons and Graviton Builder Classes && Gen AI Builder and Team
- Loading branch information
Showing
69 changed files
with
669 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.