Skip to content

Commit

Permalink
docs(cloudwatch): Add docs for the new CloudWatch Metrics plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ovidiupopa07 authored and aimeeu committed Dec 12, 2023
1 parent 56b6984 commit e5ee8d2
Show file tree
Hide file tree
Showing 2 changed files with 248 additions and 0 deletions.
1 change: 1 addition & 0 deletions content/en/includes/plugins/plugin-compat-matrix.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
| Plugin | Spinnaker | Armory CD |
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:----------------------------------:|
| [Armory CD-as-a-Service Plugin](https://developer.armory.io/docs/integrations/plugin-spinnaker)<br>The Armory Continuous Deployment-as-a-Service plugin enables performing canary and blue/green deployments in a single stage from Spinnaker to your Kubernetes deployment target using CD-as-a-Service. | 1.24+ | 2.24+<br>(included with Armory CD) |
| {{< linkWithLinkTitle "plugins/cloudwatch-plugin.md" >}}<br>{{% getPageDesc "/plugins/cloudwatch-plugin.md" %}} | 1.33+ | - |
| {{< linkWithLinkTitle "plugins/aws-event-cache/_index.md" >}}<br>{{% getPageDesc "/plugins/aws-event-cache/_index.md" %}} | 1.28+ | 2.28+ |
| {{< linkWithLinkTitle "plugins/echo-event-filter.md" >}}<br>{{% getPageDesc "/plugins/echo-event-filter.md" %}} | 1.29+ | 2.30+ |
| {{< linkWithLinkTitle "plugins/github-integration/_index.md" >}}<br>{{% getPageDesc "/plugins/github-integration/_index.md" %}} | 1.30+ | 2.30+ |
Expand Down
247 changes: 247 additions & 0 deletions content/en/plugins/cloudwatch-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
---
title: CloudWatch Metrics Plugin
linkTitle: CloudWatch Metrics
description: >
The CloudWatch Metrics Plugin allows users to use AWS CloudWatch as a metric provider for the canary deployments
---

![Proprietary](/images/proprietary.svg) ![Beta](/images/beta.svg)

## What the CloudWatch Metrics plugin does

Check warning on line 10 in content/en/plugins/cloudwatch-plugin.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/en/plugins/cloudwatch-plugin.md#L10

[Google.Headings] 'What the CloudWatch Metrics plugin does' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'What the CloudWatch Metrics plugin does' should use sentence-style capitalization.", "location": {"path": "content/en/plugins/cloudwatch-plugin.md", "range": {"start": {"line": 10, "column": 4}}}, "severity": "WARNING"}

The CloudWatch Metrics Plugin allows users to use AWS CloudWatch as a metric provider for the canary deployments.

Installing the plugin consists of the following:
1. [CloudWatch Configuration](#cloudWatch-configuration)
1. Install in your Spinnaker instance:
* [Spinnaker managed by the Spinnaker Operator](#install---spinnaker-operator)
* [Spinnaker managed by Halyard](#install---halyard)

## Compatiblity matrix

| Spinnaker Version | CloudWatch Metrics Plugin Version |
|-------------------|-----------------------------------|
| 1.33.x | 0.1.0 |


## CloudWatch configuration

Check warning on line 27 in content/en/plugins/cloudwatch-plugin.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/en/plugins/cloudwatch-plugin.md#L27

[Google.Headings] 'CloudWatch configuration' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'CloudWatch configuration' should use sentence-style capitalization.", "location": {"path": "content/en/plugins/cloudwatch-plugin.md", "range": {"start": {"line": 27, "column": 4}}}, "severity": "WARNING"}

To enable [CloudWatch](https://aws.amazon.com/cloudwatch/), update the AWS configuration entry in your `kayenta-local.yml` file. Make sure `METRICS_STORE` is listed under `supportedTypes`. Add the `cloudwatch` entry with `enabled: true`.

The example below uses S3 as the object store and CloudWatch as the metrics store.

```yaml
kayenta:
aws:
enabled: true
accounts:
- name: monitoring
bucket: <your-s3-bucket>
region: <your-region>
# Kayenta can assume a role when connecting to Cloudwatch using the iamRole configs
# iamRoleArn: <your-role-ARN> # For example arn:aws:iam::042225624470:role/theRole
# iamRoleExternalId: Optional. For example 12345
# iamRoleArnTarget: <your-role-ARN-target> # For example arn:aws:iam::042225624470:role/targetcloudwatchaccount
# iamRoleExternalIdTarget: <your-ExternalID> # Optional. For example 84475
rootFolder: kayenta
roleName: default
supportedTypes:
- OBJECT_STORE
- CONFIGURATION_STORE
- METRICS_STORE
cloudwatch:
enabled: true
s3:
enabled: true
```
## Canary configs
In the UI, you need to create a new canary config for the metrics you are interested in.
{{< figure src="/images/user-guides/canary/cloudwatch/canary_config_cloudwatch.png" >}}
Add your Cloudwatch MetricStat JSON in the **Template** field.
```json
{
"Metric": {
"Namespace": "kayenta",
"MetricName": "integration.test.cpu.value",
"Dimensions": [
{
"Name": "scope",
"Value": "myapp-prod-canary-2"
},
{
"Name": "namespace",
"Value": "prod-namespace-2"
}
]
},
"Period": 300,
"Stat": "Average",
"Unit": "None"
}
```

{{< figure src="/images/user-guides/canary/cloudwatch/canary_config_cloudwatch_query.png" >}}

## Pipeline configs

In your canary stage, set up the canary config you just created. Then use the application values from CloudWatch to fill in the **Baseline + Canary Pair** and **MetricScope** fields.

Check warning on line 92 in content/en/plugins/cloudwatch-plugin.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/en/plugins/cloudwatch-plugin.md#L92

[Google.WordList] Use 'app' instead of 'application'.
Raw output
{"message": "[Google.WordList] Use 'app' instead of 'application'.", "location": {"path": "content/en/plugins/cloudwatch-plugin.md", "range": {"start": {"line": 92, "column": 79}}}, "severity": "WARNING"}

{{< figure src="/images/user-guides/canary/cloudwatch/canary_stage_cloudwatch.png" >}}

## Install - Spinnaker Operator

Check warning on line 96 in content/en/plugins/cloudwatch-plugin.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/en/plugins/cloudwatch-plugin.md#L96

[Google.Headings] 'Install - Spinnaker Operator' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Install - Spinnaker Operator' should use sentence-style capitalization.", "location": {"path": "content/en/plugins/cloudwatch-plugin.md", "range": {"start": {"line": 96, "column": 4}}}, "severity": "WARNING"}

Add a Kustomize patch with the following contents:

```yaml
spec:
spinnakerConfig:
profiles:
kayenta:
spinnaker:
extensibility:
plugins:
Armory.CloudWatch:
enabled: true
version: <version>
repositories:
cloudwatch:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
kayenta:
aws:
enabled: true
accounts:
cloudwatch:
enabled: true
```
1. Replace `<version>` with the plugin version that's compatible with your Spinnaker version.
1. Enable AWS CloudWatch as a metric store.
1. Add the patch to the `patchesStrategicMerge` section of your kustomization file.
1. Apply your update.

<details><summary>Show an example with CloudWatch Configured</summary>

```yaml
spec:
spinnakerConfig:
profiles:
kayenta:
spinnaker:
extensibility:
plugins:
Armory.CloudWatch:
enabled: true
version: 0.1.0
repositories:
cloudwatch:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
kayenta:
aws:
enabled: true
accounts:
- name: monitoring
bucket: <your-s3-bucket>
region: <your-region>
# Kayenta can assume a role when connecting to Cloudwatch using the iamRole configs
# iamRoleArn: <your-role-ARN> # For example arn:aws:iam::042225624470:role/theRole
# iamRoleExternalId: Optional. For example 12345
# iamRoleArnTarget: <your-role-ARN-target> # For example arn:aws:iam::042225624470:role/targetcloudwatchaccount
# iamRoleExternalIdTarget: <your-ExternalID> # Optional. For example 84475
rootFolder: kayenta
roleName: default
supportedTypes:
- OBJECT_STORE
- CONFIGURATION_STORE
- METRICS_STORE
cloudwatch:
enabled: true
s3:
enabled: true
```
</details></br>

Alternately, add the plugin configuration in the `spec.spinnakerConfig.profiles.kayenta` section of your `spinnakerservice.yml` and then apply your update.

## Install - Halyard

{{% alert color="warning" title="A note about installing plugins in Spinnaker" %}}
When Halyard adds a plugin to a Spinnaker installation, it adds the plugin repository information to all services, not just the ones the plugin is for. This means that when you restart Spinnaker, each service restarts, downloads the plugin, and checks if an extension exists for that service. Each service restarting is not ideal for large Spinnaker installations due to service restart times. To avoid every Spinnaker service restarting and downloading the plugin, do not add the plugin using Halyard.
{{% /alert %}}

The CloudWatch Metrics Plugin extends Kayenta. You should create or update the extended service's local profile in the same directory as the other Halyard configuration files. This is usually `~/.hal/default/profiles` on the machine where Halyard is running.

Add the following to your `kayenta-local.yml` file:

```yaml
spinnaker:
extensibility:
plugins:
Armory.CloudWatch:
enabled: true
version: <version>
repositories:
cloudwatch:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
kayenta:
aws:
enabled: true
accounts:
cloudwatch:
enabled: true
```

1. Replace `<version>` with the plugin version that's compatible with your Spinnaker version.
1. Enable AWS CloudWatch as a metric store.
1. `hal deploy apply` your update.

<details><summary>Show an example with CloudWatch Configured</summary>

```yaml
spinnaker:
extensibility:
plugins:
Armory.CloudWatch:
enabled: true
version: 0.1.0
repositories:
cloudwatch:
enabled: true
url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
kayenta:
aws:
enabled: true
accounts:
- name: monitoring
bucket: <your-s3-bucket>
region: <your-region>
# Kayenta can assume a role when connecting to Cloudwatch using the iamRole configs
# iamRoleArn: <your-role-ARN> # For example arn:aws:iam::042225624470:role/theRole
# iamRoleExternalId: Optional. For example 12345
# iamRoleArnTarget: <your-role-ARN-target> # For example arn:aws:iam::042225624470:role/targetcloudwatchaccount
# iamRoleExternalIdTarget: <your-ExternalID> # Optional. For example 84475
rootFolder: kayenta
roleName: default
supportedTypes:
- OBJECT_STORE
- CONFIGURATION_STORE
- METRICS_STORE
cloudwatch:
enabled: true
s3:
enabled: true
```

</details></br>

## Release notes

- 0.1.0: Initial release

0 comments on commit e5ee8d2

Please sign in to comment.