Skip to content

Commit bea6ed2

Browse files
authored
Merge main into target-allocator (aws#232)
NodeJS merging-in from main
1 parent 59fb829 commit bea6ed2

28 files changed

+539
-166
lines changed

.github/workflows/application-signals-e2e-test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ concurrency:
2323

2424
jobs:
2525
java-eks-e2e-test:
26-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-eks-e2e-test.yml@main
26+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-eks-test.yml@main
2727
secrets: inherit
2828
with:
2929
aws-region: us-east-1
@@ -33,7 +33,7 @@ jobs:
3333

3434
java-metric-limiter-e2e-test:
3535
needs: [ java-eks-e2e-test ]
36-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-metric-limiter-e2e-test.yml@main
36+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/metric-limiter-test.yml@main
3737
secrets: inherit
3838
with:
3939
aws-region: us-east-1
@@ -42,15 +42,15 @@ jobs:
4242
cw-agent-operator-tag: ${{ inputs.tag }}
4343

4444
java-k8s-e2e-test:
45-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-k8s-e2e-test.yml@main
45+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-k8s-test.yml@main
4646
secrets: inherit
4747
with:
4848
aws-region: us-east-1
4949
caller-workflow-name: 'main-build'
5050
cw-agent-operator-tag: ${{ inputs.tag }}
5151

5252
python-eks-e2e-test:
53-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-eks-e2e-test.yml@main
53+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-eks-test.yml@main
5454
needs: [ java-metric-limiter-e2e-test ]
5555
secrets: inherit
5656
with:
@@ -61,7 +61,7 @@ jobs:
6161

6262
python-k8s-e2e-test:
6363
needs: [ java-k8s-e2e-test ]
64-
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-k8s-e2e-test.yml@main
64+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-k8s-test.yml@main
6565
secrets: inherit
6666
with:
6767
aws-region: us-east-1

.github/workflows/eks-add-on-integ-test.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,17 @@ jobs:
8383

8484
- name: Confirm EKS Version Support
8585
run: |
86-
if [[
86+
if [[
8787
$(go list -m k8s.io/client-go | cut -d ' ' -f 2 | cut -d '.' -f 2) -lt $( echo ${{ matrix.arrays.k8sVersion }} | cut -d '.' -f 2)
8888
|| $(go list -m k8s.io/apimachinery | cut -d ' ' -f 2 | cut -d '.' -f 2) -lt $( echo ${{ matrix.arrays.k8sVersion }} | cut -d '.' -f 2)
8989
|| $(go list -m k8s.io/component-base | cut -d ' ' -f 2 | cut -d '.' -f 2) -lt $( echo ${{ matrix.arrays.k8sVersion }} | cut -d '.' -f 2)
9090
|| $(go list -m k8s.io/kubectl | cut -d ' ' -f 2 | cut -d '.' -f 2) -lt $( echo ${{ matrix.arrays.k8sVersion }} | cut -d '.' -f 2)
91-
]]; then
91+
]]; then
9292
echo k8s.io/client-go $(go list -m k8s.io/client-go) is less than ${{ matrix.arrays.k8sVersion }}
9393
echo or k8s.io/apimachinery $(go list -m k8s.io/apimachinery) is less than ${{ matrix.arrays.k8sVersion }}
9494
echo or k8s.io/component-base $(go list -m k8s.io/component-base) is less than ${{ matrix.arrays.k8sVersion }}
95-
echo or k8s.io/kubectl $(go list -m k8s.io/kubectl) is less than ${{ matrix.arrays.k8sVersion }}, fail test
96-
echo "please run go get -u && go mod tidy"
97-
exit 1;
95+
echo or k8s.io/kubectl $(go list -m k8s.io/kubectl) is less than ${{ matrix.arrays.k8sVersion }}
96+
echo "[WARNING] Kubernetes dependencies are lower than the latest Kubernetes cluster version. Please check changelog to ensure no breaking changes: https://kubernetes.io/releases/"
9897
fi
9998
10099
- name: Verify Terraform version

.github/workflows/operator-integration-test.yml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,27 @@ jobs:
127127
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/manifests/cmd/ns_instrumentation_env_variables.json
128128
kubectl delete instrumentation sample-instrumentation
129129
130+
- name: Test for default instrumentation resources for nodejs
131+
run: |
132+
kubectl delete pods --all -n default
133+
sleep 5
134+
cat integration-tests/nodejs/sample-deployment-nodejs.yaml
135+
kubectl apply -f integration-tests/nodejs/sample-deployment-nodejs.yaml
136+
sleep 5
137+
kubectl wait --for=condition=Available deployment/nginx -n default
138+
kubectl get pods -A
139+
kubectl describe pods -n default
140+
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/nodejs/default_instrumentation_nodejs_env_variables.json
141+
142+
- name: Test for defined instrumentation resources for nodejs
143+
run: |
144+
kubectl apply -f integration-tests/manifests/sample-instrumentation.yaml
145+
kubectl delete pods --all -n default
146+
sleep 5
147+
kubectl wait --for=condition=Available deployment/nginx -n default
148+
sleep 5
149+
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/manifests/cmd/ns_instrumentation_env_variables.json
150+
kubectl delete instrumentation sample-instrumentation
130151
131152
- name: Test for default instrumentation resources for all languages
132153
run: |
@@ -142,7 +163,8 @@ jobs:
142163
kubectl apply -f integration-tests/manifests/sample-instrumentation.yaml
143164
kubectl delete pods --all -n default
144165
sleep 5
145-
kubectl wait --for=condition=Ready pod --all -n default
166+
kubectl wait --for=condition=Available deployment/nginx -n default
167+
sleep 5
146168
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/manifests/cmd/ns_instrumentation_env_variables.json
147169
kubectl delete instrumentation sample-instrumentation
148170
@@ -183,18 +205,21 @@ jobs:
183205
184206
- name: Test Annotations
185207
run: |
186-
kubectl apply -f integration-tests/manifests/sample-deployment.yaml
187208
kubectl get pods -A
188209
kubectl describe pods -n default
189-
sleep 5
210+
sleep 10
190211
go test -v -run TestAllLanguagesDeployment ./integration-tests/manifests/annotations -timeout 30m
212+
kubectl get pods -A
213+
kubectl describe pods -n default
191214
sleep 5
192215
go test -v -run TestJavaOnlyDeployment ./integration-tests/manifests/annotations -timeout 30m
193216
sleep 5
194217
go test -v -run TestPythonOnlyDeployment ./integration-tests/manifests/annotations -timeout 30m
195218
sleep 5
196219
go test -v -run TestDotNetOnlyDeployment ./integration-tests/manifests/annotations -timeout 30m
197220
sleep 5
221+
go test -v -run TestNodeJSOnlyDeployment ./integration-tests/manifests/annotations -timeout 30m
222+
sleep 5
198223
go test -v -run TestAnnotationsOnMultipleResources ./integration-tests/manifests/annotations -timeout 30m
199224
200225
DaemonsetAnnotationsTest:
@@ -233,18 +258,21 @@ jobs:
233258
234259
- name: Test Annotations
235260
run: |
236-
kubectl apply -f integration-tests/manifests/sample-daemonset.yaml
237261
sleep 5
238262
kubectl get pods -A
239263
kubectl describe pods -n default
240264
go test -v -run TestAllLanguagesDaemonSet ./integration-tests/manifests/annotations -timeout 30m
265+
kubectl get pods -A
266+
kubectl describe pods -n default
241267
sleep 5
242268
go test -v -run TestJavaOnlyDaemonSet ./integration-tests/manifests/annotations -timeout 30m
243269
sleep 5
244270
go test -v -run TestPythonOnlyDaemonSet ./integration-tests/manifests/annotations -timeout 30m
245271
sleep 5
246272
go test -v -run TestDotNetOnlyDaemonSet ./integration-tests/manifests/annotations -timeout 30m
247273
sleep 5
274+
go test -v -run TestNodeJSOnlyDaemonSet ./integration-tests/manifests/annotations -timeout 30m
275+
sleep 5
248276
go test -v -run TestAutoAnnotationForManualAnnotationRemoval ./integration-tests/manifests/annotations -timeout 30m
249277
250278
StatefulsetAnnotationsTest:
@@ -283,16 +311,20 @@ jobs:
283311
284312
- name: Test Annotations
285313
run: |
286-
kubectl apply -f integration-tests/manifests/sample-statefulset.yaml
287-
sleep 5
288314
kubectl get pods -A
289315
kubectl describe pods -n default
290316
go test -v -run TestAllLanguagesStatefulSet ./integration-tests/manifests/annotations -timeout 30m
317+
kubectl get pods -A
318+
kubectl describe pods -n default
291319
sleep 5
292320
go test -v -run TestJavaOnlyStatefulSet ./integration-tests/manifests/annotations -timeout 30m
293321
sleep 5
294322
go test -v -run TestPythonOnlyStatefulSet ./integration-tests/manifests/annotations -timeout 30m
295323
sleep 5
324+
go test -v -run TestDotNetOnlyStatefulSet ./integration-tests/manifests/annotations -timeout 30m
325+
sleep 5
326+
go test -v -run TestNodeJSOnlyStatefulSet ./integration-tests/manifests/annotations -timeout 30m
327+
sleep 5
296328
go test -v -run TestOnlyNonAnnotatedAppsShouldBeRestarted ./integration-tests/manifests/annotations -timeout 30m
297329
298330
@@ -342,4 +374,6 @@ jobs:
342374
sleep 5
343375
go test -v -run TestDotNetOnlyNamespace ./integration-tests/manifests/annotations -timeout 30m
344376
sleep 5
345-
go test -v -run TestAlreadyAutoAnnotatedResourceShouldNotRestart ./integration-tests/manifests/annotations -timeout 30m
377+
go test -v -run TestNodeJSOnlyNamespace ./integration-tests/manifests/annotations -timeout 30m
378+
sleep 5
379+
go test -v -run TestAlreadyAutoAnnotatedResourceShouldNotRestart ./integration-tests/manifests/annotations -timeout 30m

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ ARG AGENT_VERSION
2727
ARG AUTO_INSTRUMENTATION_JAVA_VERSION
2828
ARG AUTO_INSTRUMENTATION_PYTHON_VERSION
2929
ARG AUTO_INSTRUMENTATION_DOTNET_VERSION
30+
ARG AUTO_INSTRUMENTATION_NODEJS_VERSION
3031
ARG DCMG_EXPORTER_VERSION
3132
ARG NEURON_MONITOR_VERSION
3233

3334
# Build
34-
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -ldflags="-X ${VERSION_PKG}.version=${VERSION} -X ${VERSION_PKG}.buildDate=${VERSION_DATE} -X ${VERSION_PKG}.agent=${AGENT_VERSION} -X ${VERSION_PKG}.autoInstrumentationJava=${AUTO_INSTRUMENTATION_JAVA_VERSION} -X ${VERSION_PKG}.autoInstrumentationPython=${AUTO_INSTRUMENTATION_PYTHON_VERSION} -X ${VERSION_PKG}.autoInstrumentationDotNet=${AUTO_INSTRUMENTATION_DOTNET_VERSION} -X ${VERSION_PKG}.dcgmExporter=${DCMG_EXPORTER_VERSION} -X ${VERSION_PKG}.neuronMonitor=${NEURON_MONITOR_VERSION}" -a -o manager main.go
35+
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -ldflags="-X ${VERSION_PKG}.version=${VERSION} -X ${VERSION_PKG}.buildDate=${VERSION_DATE} -X ${VERSION_PKG}.agent=${AGENT_VERSION} -X ${VERSION_PKG}.autoInstrumentationJava=${AUTO_INSTRUMENTATION_JAVA_VERSION} -X ${VERSION_PKG}.autoInstrumentationPython=${AUTO_INSTRUMENTATION_PYTHON_VERSION} -X ${VERSION_PKG}.autoInstrumentationDotNet=${AUTO_INSTRUMENTATION_DOTNET_VERSION} -X ${VERSION_PKG}.autoInstrumentationNodeJS=${AUTO_INSTRUMENTATION_NODEJS_VERSION} -X ${VERSION_PKG}.dcgmExporter=${DCMG_EXPORTER_VERSION} -X ${VERSION_PKG}.neuronMonitor=${NEURON_MONITOR_VERSION}" -a -o manager main.go
3536

3637
# Use distroless as minimal base image to package the manager binary
3738
# Refer to https://github.com/GoogleContainerTools/distroless for more details

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ AGENT_VERSION ?= "$(shell grep -v '\#' versions.txt | grep cloudwatch-agent | aw
66
AUTO_INSTRUMENTATION_JAVA_VERSION ?= "$(shell grep -v '\#' versions.txt | grep aws-otel-java-instrumentation | awk -F= '{print $$2}')"
77
AUTO_INSTRUMENTATION_PYTHON_VERSION ?= "$(shell grep -v '\#' versions.txt | grep aws-otel-python-instrumentation | awk -F= '{print $$2}')"
88
AUTO_INSTRUMENTATION_DOTNET_VERSION ?= "$(shell grep -v '\#' versions.txt | grep aws-otel-dotnet-instrumentation | awk -F= '{print $$2}')"
9+
AUTO_INSTRUMENTATION_NODEJS_VERSION ?= "$(shell grep -v '\#' versions.txt | grep aws-otel-nodejs-instrumentation | awk -F= '{print $$2}')"
910
DCGM_EXPORTER_VERSION ?= "$(shell grep -v '\#' versions.txt | grep dcgm-exporter | awk -F= '{print $$2}')"
1011
NEURON_MONITOR_VERSION ?= "$(shell grep -v '\#' versions.txt | grep neuron-monitor | awk -F= '{print $$2}')"
1112
TARGET_ALLOCATOR_VERSION ?= $(shell grep -v '\#' versions.txt | grep target-allocator | awk -F= '{print $$2}')
@@ -161,7 +162,7 @@ generate: controller-gen api-docs
161162
# buildx is used to ensure same results for arm based systems (m1/2 chips)
162163
.PHONY: container
163164
container:
164-
docker buildx build --load --platform linux/${ARCH} -t ${IMG} --build-arg VERSION_PKG=${VERSION_PKG} --build-arg VERSION=${VERSION} --build-arg VERSION_DATE=${VERSION_DATE} --build-arg AGENT_VERSION=${AGENT_VERSION} --build-arg AUTO_INSTRUMENTATION_JAVA_VERSION=${AUTO_INSTRUMENTATION_JAVA_VERSION} --build-arg AUTO_INSTRUMENTATION_PYTHON_VERSION=${AUTO_INSTRUMENTATION_PYTHON_VERSION} --build-arg AUTO_INSTRUMENTATION_DOTNET_VERSION=${AUTO_INSTRUMENTATION_DOTNET_VERSION} --build-arg DCGM_EXPORTER_VERSION=${DCGM_EXPORTER_VERSION} --build-arg NEURON_MONITOR_VERSION=${NEURON_MONITOR_VERSION} .
165+
docker buildx build --load --platform linux/${ARCH} -t ${IMG} --build-arg VERSION_PKG=${VERSION_PKG} --build-arg VERSION=${VERSION} --build-arg VERSION_DATE=${VERSION_DATE} --build-arg AGENT_VERSION=${AGENT_VERSION} --build-arg AUTO_INSTRUMENTATION_JAVA_VERSION=${AUTO_INSTRUMENTATION_JAVA_VERSION} --build-arg AUTO_INSTRUMENTATION_PYTHON_VERSION=${AUTO_INSTRUMENTATION_PYTHON_VERSION} --build-arg AUTO_INSTRUMENTATION_DOTNET_VERSION=${AUTO_INSTRUMENTATION_DOTNET_VERSION} --build-arg AUTO_INSTRUMENTATION_NODEJS_VERSION=${AUTO_INSTRUMENTATION_NODEJS_VERSION} --build-arg DCGM_EXPORTER_VERSION=${DCGM_EXPORTER_VERSION} --build-arg NEURON_MONITOR_VERSION=${NEURON_MONITOR_VERSION} .
165166

166167
# Push the container image, used only for local dev purposes
167168
.PHONY: container-push

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Supported Languages:
55
- Java
66
- Python
77
- .NET
8+
- NodeJS
89

910
This repo is based off of the [OpenTelemetry Operator](https://github.com/open-telemetry/opentelemetry-operator)
1011

RELEASE_NOTES

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
========================================================================
2+
Amazon CloudWatch Agent Operator v1.7.0 (2024-09-03)
3+
========================================================================
4+
Enhancements:
5+
* [ApplicationSignals] Support NodeJS auto-instrumentation on Linux platforms
6+
17
========================================================================
28
Amazon CloudWatch Agent Operator v1.6.0 (2024-07-30)
39
========================================================================
10+
Enhancements:
411
* [ApplicationSignals] Allow configurable resource requests and limits for auto-instrumentation SDK init containers (#196)
512

613
========================================================================

integration-tests/eks/resourceCount_linuxonly_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ package eks_addon
99
const (
1010
// Services count for CW agent on Linux and Windows
1111
serviceCountLinux = 6
12-
serviceCountWindows = 3
12+
serviceCountWindows = 6
1313

1414
// DaemonSet count for CW agent on Linux and Windows
1515
daemonsetCountLinux = 4
16-
daemonsetCountWindows = 2
16+
daemonsetCountWindows = 3
1717

1818
// Pods count for CW agent on Linux and Windows
1919
podCountLinux = 3

integration-tests/eks/resourceCount_windowslinux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ package eks_addon
99
const (
1010
// Services count for CW agent on Linux and Windows
1111
serviceCountLinux = 6
12-
serviceCountWindows = 3
12+
serviceCountWindows = 6
1313

1414
// DaemonSet count for CW agent on Linux and Windows
1515
daemonsetCountLinux = 4
16-
daemonsetCountWindows = 2
16+
daemonsetCountWindows = 3
1717

1818
// Pods count for CW agent on Linux and Windows
1919
podCountLinux = 3

integration-tests/eks/validateResources_test.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ import (
2626
)
2727

2828
const (
29-
nameSpace = "amazon-cloudwatch"
30-
addOnName = "amazon-cloudwatch-observability"
31-
agentName = "cloudwatch-agent"
32-
agentNameWindows = "cloudwatch-agent-windows"
33-
operatorName = addOnName + "-controller-manager"
34-
fluentBitName = "fluent-bit"
35-
fluentBitNameWindows = "fluent-bit-windows"
36-
dcgmExporterName = "dcgm-exporter"
37-
neuronMonitor = "neuron-monitor"
38-
podNameRegex = "(" + agentName + "|" + agentNameWindows + "|" + operatorName + "|" + fluentBitName + "|" + fluentBitNameWindows + ")-*"
39-
serviceNameRegex = agentName + "(-headless|-monitoring)?|" + agentNameWindows + "(-headless|-monitoring)?|" + addOnName + "-webhook-service|" + dcgmExporterName + "-service|" + neuronMonitor + "-service"
29+
nameSpace = "amazon-cloudwatch"
30+
addOnName = "amazon-cloudwatch-observability"
31+
agentName = "cloudwatch-agent"
32+
agentNameWindows = "cloudwatch-agent-windows"
33+
agentNameWindowsContainerInsights = "cloudwatch-agent-windows-container-insights"
34+
operatorName = addOnName + "-controller-manager"
35+
fluentBitName = "fluent-bit"
36+
fluentBitNameWindows = "fluent-bit-windows"
37+
dcgmExporterName = "dcgm-exporter"
38+
neuronMonitor = "neuron-monitor"
39+
podNameRegex = "(" + agentName + "|" + agentNameWindows + "|" + agentNameWindowsContainerInsights + "|" + operatorName + "|" + fluentBitName + "|" + fluentBitNameWindows + ")-*"
40+
serviceNameRegex = agentName + "(-headless|-monitoring)?|" + agentNameWindows + "(-headless|-monitoring)?|" + agentNameWindowsContainerInsights + "(-headless|-monitoring)?|" + addOnName + "-webhook-service|" + dcgmExporterName + "-service|" + neuronMonitor + "-service"
4041
)
4142

4243
const (
@@ -102,6 +103,9 @@ func TestOperatorOnEKs(t *testing.T) {
102103
// - cloudwatch-agent-windows
103104
// - cloudwatch-agent-windows-headless
104105
// - cloudwatch-agent-windows-monitoring
106+
// - cloudwatch-agent-windows-container-insights
107+
// - cloudwatch-agent-windows-container-insights-headless
108+
// - cloudwatch-agent-windows-container-insights-monitoring
105109
// - dcgm-exporter-service
106110
// - neuron-monitor-service
107111
if match, _ := regexp.MatchString(serviceNameRegex, service.Name); !match {
@@ -133,6 +137,7 @@ func TestOperatorOnEKs(t *testing.T) {
133137
// matches
134138
// - cloudwatch-agent
135139
// - cloudwatch-agent-windows
140+
// - cloudwatch-agent-windows-container-insights
136141
// - fluent-bit
137142
// - fluent-bit-windows
138143
// - dcgm-exporter (this can be removed in the future)

0 commit comments

Comments
 (0)