Skip to content

Commit

Permalink
docs(ecs-service-extensions): clarify docs (#14554)
Browse files Browse the repository at this point in the history
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
SoManyHs authored May 6, 2021
1 parent 7dd6836 commit 46a1631
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,27 @@ import { EnvironmentCapacityType } from './extensions/extension-interfaces';
import { Construct } from '@aws-cdk/core';

/**
* Settings for the environment you want to deploy.
* services within.
* Settings for the environment where you want to deploy your services.
*/
export interface EnvironmentProps {
/**
* The VPC used by the service for networking
* The VPC used by the service for networking.
*
* @default - Create a new VPC
*/
readonly vpc?: ec2.IVpc,

/**
* The ECS cluster which provides compute capacity to this service.
*
* [disable-awslint:ref-via-interface]
* @default - Create a new cluster
*/
readonly cluster?: ecs.Cluster

/**
* The type of capacity to use for this environment.
*
* @default - EnvironmentCapacityType.FARGATE
*/
readonly capacityType?: EnvironmentCapacityType
Expand Down Expand Up @@ -64,8 +66,8 @@ export interface IEnvironment {

/**
* An environment into which to deploy a service. This environment
* can either be instantiated with a preexisting AWS VPC and ECS cluster,
* or it can create it's own VPC and cluster. By default it will create
* can either be instantiated with a pre-existing AWS VPC and ECS cluster,
* or it can create its own VPC and cluster. By default, it will create
* a cluster with Fargate capacity.
*/
export class Environment extends Construct implements IEnvironment {
Expand All @@ -82,7 +84,7 @@ export class Environment extends Construct implements IEnvironment {
public readonly id: string;

/**
* The VPC into which environment services should be placed.
* The VPC where environment services should be placed.
*/
public readonly vpc: ec2.IVpc;

Expand Down Expand Up @@ -159,10 +161,10 @@ export class ImportedEnvironment extends Construct implements IEnvironment {
}

/**
* Refuses to add a default cloudmap namespace to the cluster as we don't
* Adding a default cloudmap namespace to the cluster will throw an error, as we don't
* own it.
*/
addDefaultCloudMapNamespace(_options: ecs.CloudMapNamespaceOptions) {
throw new Error('the cluster environment is immutable when imported');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const APP_MESH_ENVOY_SIDECAR_VERSION = 'v1.15.1.0-prod';
*/
export interface MeshProps {
/**
* The service mesh into which to register the service
* The service mesh into which to register the service.
*/
readonly mesh: appmesh.Mesh;

Expand All @@ -39,9 +39,9 @@ export interface MeshProps {
* to the container in a service mesh.
*
* The service will then be available to other App Mesh services at the
* address `<service name>.<environment name>`. For example a service called
* address `<service name>.<environment name>`. For example, a service called
* `orders` deploying in an environment called `production` would be accessible
* to other App Mesh enabled services at the address `http://orders.production`
* to other App Mesh enabled services at the address `http://orders.production`.
*/
export class AppMeshExtension extends ServiceExtension {
protected virtualNode!: appmesh.VirtualNode;
Expand Down Expand Up @@ -249,7 +249,7 @@ export class AppMeshExtension extends ServiceExtension {
} as ServiceBuild;
}

// Now that the service is defined we can create the AppMesh virtual service
// Now that the service is defined, we can create the AppMesh virtual service
// and virtual node for the real service
public useService(service: ecs.Ec2Service | ecs.FargateService) {
const containerextension = this.parentService.serviceDescription.get('service-container') as Container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const CLOUDWATCH_AGENT_IMAGE = 'amazon/cloudwatch-agent:latest';

/**
* This extension adds a CloudWatch agent to the task definition and
* configures the task to be able to publish metrics to CloudWatch
* configures the task to be able to publish metrics to CloudWatch.
*/
export class CloudwatchAgentExtension extends ServiceExtension {
private CW_CONFIG_CONTENT = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,33 @@ import { ServiceExtension } from './extension-interfaces';
import { Construct } from '@aws-cdk/core';

/**
* Setting for the main application container of a service
* Setting for the main application container of a service.
*/
export interface ContainerExtensionProps {
/**
* How much CPU the container requires
* How much CPU the container requires.
*/
readonly cpu: number,

/**
* How much memory in megabytes the container requires
* How much memory in megabytes the container requires.
*/
readonly memoryMiB: number,

/**
* The image to run
* The image to run.
*/
readonly image: ecs.ContainerImage,

/**
* What port the image listen for traffic on
* What port the image listen for traffic on.
*/
readonly trafficPort: number,

/**
* Environment variables to pass into the container
* @default - No environment variables
* Environment variables to pass into the container.
*
* @default - No environment variables.
*/
readonly environment?: {
[key: string]: string,
Expand All @@ -51,7 +52,7 @@ export class Container extends ServiceExtension {
public readonly trafficPort: number;

/**
* The settings for the container
* The settings for the container.
*/
private props: ContainerExtensionProps;

Expand Down
Loading

0 comments on commit 46a1631

Please sign in to comment.