From aa7966cddafb998773c06e548fc53cf1fe24b730 Mon Sep 17 00:00:00 2001 From: Musa <165414028+musa-asad@users.noreply.github.com> Date: Mon, 29 Apr 2024 14:42:32 -0400 Subject: [PATCH] Modify operator integration test to use yaml instead of helm templating. (#162) * Modify operator integration test to use yaml instead of helm templating. * Added missing file. * Updated to latest. --- .../workflows/operator-integration-test.yml | 2 +- .../manifests/cloudwatch-agent-daemonset.yaml | 80 +++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 integration-tests/manifests/cloudwatch-agent-daemonset.yaml diff --git a/.github/workflows/operator-integration-test.yml b/.github/workflows/operator-integration-test.yml index fe32ea98d..0888c3003 100644 --- a/.github/workflows/operator-integration-test.yml +++ b/.github/workflows/operator-integration-test.yml @@ -56,7 +56,7 @@ jobs: - name: Test case for AmazonCloudWatchAgent pod creation run: | - helm template --namespace amazon-cloudwatch -s templates/linux/cloudwatch-agent-daemonset.yaml ./helm --set region=us-west-2 | kubectl apply --namespace amazon-cloudwatch -f - + kubectl apply -f integration-tests/manifests/cloudwatch-agent-daemonset.yaml -n amazon-cloudwatch sleep 60 kubectl describe pods -n amazon-cloudwatch pod_name="$(kubectl get pods -n amazon-cloudwatch -l app.kubernetes.io/component=amazon-cloudwatch-agent,app.kubernetes.io/instance=amazon-cloudwatch.cloudwatch-agent -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}')" diff --git a/integration-tests/manifests/cloudwatch-agent-daemonset.yaml b/integration-tests/manifests/cloudwatch-agent-daemonset.yaml new file mode 100644 index 000000000..dd5655877 --- /dev/null +++ b/integration-tests/manifests/cloudwatch-agent-daemonset.yaml @@ -0,0 +1,80 @@ +apiVersion: cloudwatch.aws.amazon.com/v1alpha1 +kind: AmazonCloudWatchAgent +metadata: + name: cloudwatch-agent + namespace: amazon-cloudwatch +spec: + mode: daemonset + serviceAccount: cloudwatch-agent + image: public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest + config: | + { + "agent": { + "region": "${REGION}", + "debug": true + }, + "traces": { + "traces_collected": { + "app_signals": {} + } + }, + "logs": { + "metrics_collected": { + "app_signals": {} + } + } + } + volumeMounts: + - mountPath: /rootfs + name: rootfs + readOnly: true + - mountPath: /var/run/docker.sock + name: dockersock + readOnly: true + - mountPath: /run/containerd/containerd.sock + name: containerdsock + - mountPath: /var/lib/docker + name: varlibdocker + readOnly: true + - mountPath: /sys + name: sys + readOnly: true + - mountPath: /dev/disk + name: devdisk + readOnly: true + volumes: + - name: rootfs + hostPath: + path: / + - hostPath: + path: /var/run/docker.sock + name: dockersock + - hostPath: + path: /var/lib/docker + name: varlibdocker + - hostPath: + path: /run/containerd/containerd.sock + name: containerdsock + - hostPath: + path: /sys + name: sys + - hostPath: + path: /dev/disk/ + name: devdisk + env: + - name: K8S_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: HOST_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: K8S_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace \ No newline at end of file