Skip to content

Commit 3770543

Browse files
authored
Merge branch 'main' into release-4.6.0
2 parents af81e87 + b07c797 commit 3770543

File tree

23 files changed

+609
-37
lines changed

23 files changed

+609
-37
lines changed

.github/workflows/amazon-cloudwatch-observability-integration-test.yaml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,51 @@ jobs:
3232
- name: Build
3333
run: make all
3434

35+
Minikube-IntegrationTests:
36+
name: Minikube
37+
needs: [ Build ]
38+
runs-on: ubuntu-latest
39+
timeout-minutes: 30
40+
strategy:
41+
matrix:
42+
# TODO: add webhooks-disabled
43+
scenario:
44+
- default
45+
- appsignals-disabled
46+
- appsignals-disabled-multi-agents
47+
- appsignals-enabled-multi-agents
48+
- appsignals-unsupported
49+
- webhooks-partially-enabled
50+
- webhooks-configured
51+
steps:
52+
- uses: actions/checkout@v3
53+
54+
- name: Start minikube
55+
uses: medyagh/setup-minikube@master
56+
with:
57+
driver: docker
58+
59+
- name: Install Terraform
60+
uses: hashicorp/setup-terraform@v3
61+
with:
62+
terraform_version: "1.1.7"
63+
64+
- name: Run scenario test
65+
run: |
66+
cd integration-tests/amazon-cloudwatch-observability/terraform/minikube/scenarios/${{ matrix.scenario }}
67+
terraform init
68+
terraform apply -auto-approve
69+
terraform destroy -auto-approve
70+
71+
- name: Cleanup on failure
72+
if: ${{ cancelled() || failure() }}
73+
run: |
74+
cd integration-tests/amazon-cloudwatch-observability/terraform/minikube/scenarios/${{ matrix.scenario }}
75+
terraform destroy -auto-approve || true
76+
3577
EKS-IntegrationTest:
3678
name: EKS-IntegrationTest
37-
needs: [ Build ]
79+
needs: [ Minikube-IntegrationTests ]
3880
runs-on: ubuntu-latest
3981
timeout-minutes: 60
4082
steps:
@@ -95,7 +137,7 @@ jobs:
95137
96138
EKS-IntegrationTest-Win2022:
97139
name: EKS-IntegrationTest-Win2022
98-
needs: [ Build ]
140+
needs: [ Minikube-IntegrationTests ]
99141
runs-on: ubuntu-latest
100142
timeout-minutes: 60
101143
steps:
@@ -156,7 +198,7 @@ jobs:
156198
157199
EKS-IntegrationTest-Win2019:
158200
name: EKS-IntegrationTest-Win2019
159-
needs: [ Build ]
201+
needs: [ Minikube-IntegrationTests ]
160202
runs-on: ubuntu-latest
161203
timeout-minutes: 60
162204
steps:

charts/amazon-cloudwatch-observability/templates/_helpers.tpl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,42 @@ tolerations:
1919
{{- end }}
2020
{{- end }}
2121

22+
{{/*
23+
Helper function to determine monitorAllServices based on region
24+
*/}}
25+
{{- define "manager.monitorAllServices" -}}
26+
{{- $region := .Values.region | required ".Values.region is required." -}}
27+
{{- if regexMatch "ap-east-2|ap-southeast-6|cn-.*|.*-iso[a-z]*-.*" $region -}}
28+
false
29+
{{- else -}}
30+
true
31+
{{- end -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Helper function to modify auto-monitor config based on agent configurations
36+
*/}}
37+
{{- define "manager.modify-auto-monitor-config" -}}
38+
{{- $autoMonitorConfig := deepCopy .Values.manager.applicationSignals.autoMonitor -}}
39+
{{- $hasAppSignals := false -}}
40+
{{- range .Values.agents -}}
41+
{{- $agent := merge . (deepCopy $.Values.agent) -}}
42+
{{- $agentConfig := $agent.config | default $agent.defaultConfig -}}
43+
{{- if and (hasKey $agentConfig "logs") (hasKey $agentConfig.logs "metrics_collected") (hasKey $agentConfig.logs.metrics_collected "application_signals") -}}
44+
{{- $hasAppSignals = true -}}
45+
{{- end -}}
46+
{{- if and (hasKey $agentConfig "traces") (hasKey $agentConfig.traces "traces_collected") (hasKey $agentConfig.traces.traces_collected "application_signals") -}}
47+
{{- $hasAppSignals = true -}}
48+
{{- end -}}
49+
{{- end -}}
50+
{{- if not $hasAppSignals -}}
51+
{{- $_ := set $autoMonitorConfig "monitorAllServices" false -}}
52+
{{- else if not (hasKey $autoMonitorConfig "monitorAllServices") -}}
53+
{{- $_ := set $autoMonitorConfig "monitorAllServices" (include "manager.monitorAllServices" . | trim | eq "true") -}}
54+
{{- end -}}
55+
{{- $autoMonitorConfig | toJson -}}
56+
{{- end -}}
57+
2258
{{/*
2359
Helper function to modify cloudwatch-agent config
2460
*/}}

charts/amazon-cloudwatch-observability/templates/operator-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
args:
2929
- {{ printf "--auto-instrumentation-config=%s" (dict "java" (merge .Values.manager.autoInstrumentationResources.java .Values.manager.autoInstrumentationConfiguration.java) "python" (merge .Values.manager.autoInstrumentationResources.python .Values.manager.autoInstrumentationConfiguration.python) "dotnet" (merge .Values.manager.autoInstrumentationResources.dotnet .Values.manager.autoInstrumentationConfiguration.dotnet) "nodejs" (.Values.manager.autoInstrumentationResources.nodejs) | toJson) | quote }}
3030
- {{ printf "--auto-annotation-config=%s" (.Values.manager.autoAnnotateAutoInstrumentation | toJson) | quote }}
31-
- {{ printf "--auto-monitor-config=%s" (.Values.manager.applicationSignals.autoMonitor | toJson) | quote }}
31+
- {{ printf "--auto-monitor-config=%s" (include "manager.modify-auto-monitor-config" .) | quote }}
3232
- "--auto-instrumentation-java-image={{ template "auto-instrumentation-java.image" . }}"
3333
- "--auto-instrumentation-python-image={{ template "auto-instrumentation-python.image" . }}"
3434
- "--auto-instrumentation-dotnet-image={{ template "auto-instrumentation-dotnet.image" . }}"

charts/amazon-cloudwatch-observability/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ manager:
10741074
tag: v0.7.0
10751075
applicationSignals:
10761076
autoMonitor:
1077-
monitorAllServices: false
1077+
# monitorAllServices: true; Defaults to true for regions where AppSignals is supported, false otherwise
10781078
languages:
10791079
- java
10801080
- python
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
terraform {
5+
required_providers {
6+
helm = {
7+
source = "hashicorp/helm"
8+
version = "~> 2.0"
9+
}
10+
kubernetes = {
11+
source = "hashicorp/kubernetes"
12+
version = "~> 2.0"
13+
}
14+
}
15+
}
16+
17+
provider "kubernetes" {
18+
config_path = "~/.kube/config"
19+
}
20+
21+
provider "helm" {
22+
kubernetes {
23+
config_path = "~/.kube/config"
24+
}
25+
}
26+
27+
resource "null_resource" "minikube_start" {
28+
provisioner "local-exec" {
29+
command = <<-EOT
30+
minikube start --driver=docker --kubernetes-version=${var.k8s_version}
31+
minikube status
32+
EOT
33+
}
34+
35+
provisioner "local-exec" {
36+
when = destroy
37+
command = "minikube delete"
38+
}
39+
}
40+
41+
resource "helm_release" "cloudwatch_observability" {
42+
depends_on = [null_resource.minikube_start]
43+
44+
name = "amazon-cloudwatch-observability"
45+
namespace = "amazon-cloudwatch"
46+
create_namespace = true
47+
chart = var.helm_dir
48+
49+
values = [file(var.helm_values_file)]
50+
}
51+
52+
output "helm_release" {
53+
value = helm_release.cloudwatch_observability
54+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
module "base" {
5+
source = "../.."
6+
helm_values_file = "${path.module}/values.yaml"
7+
helm_dir = var.helm_dir
8+
}
9+
10+
variable "helm_dir" {
11+
type = string
12+
default = "../../../../../../charts/amazon-cloudwatch-observability"
13+
}
14+
15+
resource "null_resource" "validator" {
16+
depends_on = [module.base.helm_release]
17+
18+
provisioner "local-exec" {
19+
command = "go test ${var.test_dir} -v -run=TestAppSignalsDisabledMultiAgents"
20+
}
21+
}
22+
23+
variable "test_dir" {
24+
type = string
25+
default = "../../../../validations/minikube/scenarios"
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
region: us-west-2
2+
clusterName: minikube
3+
4+
agents:
5+
- name: cloudwatch-agent
6+
config:
7+
{
8+
"logs": {
9+
"metrics_collected": {
10+
"kubernetes": {
11+
"enhanced_container_insights": true
12+
}
13+
}
14+
}
15+
}
16+
- name: cloudwatch-agent-prom
17+
mode: deployment
18+
config:
19+
{
20+
"metrics": {
21+
"metrics_collected": {
22+
"prometheus": {
23+
"prometheus_config_path": "/test/path"
24+
}
25+
}
26+
}
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
module "base" {
5+
source = "../.."
6+
helm_values_file = "${path.module}/values.yaml"
7+
helm_dir = var.helm_dir
8+
}
9+
10+
variable "helm_dir" {
11+
type = string
12+
default = "../../../../../../charts/amazon-cloudwatch-observability"
13+
}
14+
15+
resource "null_resource" "validator" {
16+
depends_on = [module.base.helm_release]
17+
18+
provisioner "local-exec" {
19+
command = "go test ${var.test_dir} -v -run=TestAppSignalsDisabled"
20+
}
21+
}
22+
23+
variable "test_dir" {
24+
type = string
25+
default = "../../../../validations/minikube/scenarios"
26+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
region: us-west-2
2+
clusterName: minikube
3+
4+
agents:
5+
- name: cloudwatch-agent
6+
config:
7+
{
8+
"logs": {
9+
"metrics_collected": {
10+
"kubernetes": {
11+
"enhanced_container_insights": true
12+
}
13+
}
14+
}
15+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
module "base" {
5+
source = "../.."
6+
helm_dir = var.helm_dir
7+
helm_values_file = "${path.module}/values.yaml"
8+
}
9+
10+
variable "helm_dir" {
11+
type = string
12+
default = "../../../../../../charts/amazon-cloudwatch-observability"
13+
}
14+
15+
resource "null_resource" "validator" {
16+
depends_on = [module.base.helm_release]
17+
18+
provisioner "local-exec" {
19+
command = "go test ${var.test_dir} -v -run=TestAppSignalsEnabledMultiAgents"
20+
}
21+
}
22+
23+
variable "test_dir" {
24+
type = string
25+
default = "../../../../validations/minikube/scenarios"
26+
}

0 commit comments

Comments
 (0)