Skip to content

Commit

Permalink
Add sample applicatin configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
musa-asad committed Nov 15, 2024
1 parent ef3d5ee commit 661107a
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 6 deletions.
51 changes: 51 additions & 0 deletions terraform/e2e/eks/$HOME/.kube/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCRENDQWV5Z0F3SUJBZ0lIZVhUTi9jOWtRREFOQmdrcWhraUc5dzBCQVFzRkFEQVZNUk13RVFZRFZRUUQKRXdwcmRXSmxjbTVsZEdWek1CNFhEVEkwTVRFeE5ERTRORGswTlZvWERUTTBNVEV4TWpFNE5UUTBOVm93RlRFVApNQkVHQTFVRUF4TUthM1ZpWlhKdVpYUmxjekNDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DCmdnRUJBUFFiVmdUa20wQnF4NTA4UnhCczZETmdlQnFva1hBdW9SUnpOT2RwVlQrbGhhTW11U3RTNElFQnNBbWgKNWQyMTFrRy9RMnV3L0NJVXNTc25Kdm5PU1UxTU9mdVVpRFRublJIUGhuT3hTbklaSjNwSFlTTXJrdGljVzRHSgp6dTMyeHhUdEk3WWpZVG1QcUUyS1JBcjZSN2c4R1dkNGpmVzUyb1RHMTRxVE9QNDVyNlJsYmQvSUtmUi9KN01iCm81cVdrdW9PVnFyNkt3ZGh2eG04aGlaL0t0UDMyTWJUbzdxajFrUEpGQVhPK2ZWNGlDWnd5ZXZnRGd2bUJEZ1MKeGVwTDZSdUNRa2JwZldieXdFRmcwU2tWYVVibTB5ZUJCUXpFWDdjSU5ZQkJaN3ptN3NqdGNuaWZNd1B1RlJueApwK2VlZ2tkU1dUTVNqcjIrd21KVjJhQXcxb01DQXdFQUFhTlpNRmN3RGdZRFZSMFBBUUgvQkFRREFnS2tNQThHCkExVWRFd0VCL3dRRk1BTUJBZjh3SFFZRFZSME9CQllFRktQcWlsakFMSk4rRWIveUZrREM3YXZKZVE1aU1CVUcKQTFVZEVRUU9NQXlDQ210MVltVnlibVYwWlhNd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFBeisxZUViK0VnNgo2QUhFVTlHOUVnSFBNUHpQSE4veHd3WXY4NlEyWE5aRWRIOWFOakpHTjN4ZDl1WnZvWjBmbzJnNmdSbHE5d0lFCmxHVjl2TEljZS8xVnhlcDFaL21WMDY5dUFwTnlWZkZQekJPTXJXSTJxbW5VTVc1NWJYZktnbnNUM1E3dWVDYlIKa1I2c3RrY0JkMmNYME14THVaanNEa0tOcU5vVDkxUzhyOFpVWnNPRzUrSWN6K09ySWEyOUhaNWR0Rk96WHVYYQpqZ1pJc0JvdTQwNVF1L1ZlL0pkS3haTDJjbE9BUk5FN0NjVEZpSmJ6WkNQbnJXdVFhQUZCdTgvTkx1K2x6dXlSCllMZ1UrNWVjcDdXVm5oYVhPYk50Rk5INTR0TzZ2d2s0NXhBWDVRMVhnVi9jVk8zK1ZIYkE4dHRjRGVlbTJEeUQKK1FvVVAvN25tZ0U9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
server: https://815134A5AA1C2E4604C5B7AFE69DC525.gr7.us-west-2.eks.amazonaws.com
name: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a99ef5b36c745ce4
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJTUZtWEF4QloyeXN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRFeE1UUXlNREEzTlRoYUZ3MHpOREV4TVRJeU1ERXlOVGhhTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJB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ZSnpMblptUXRvbVFVZ0MwbitKNG95QjFtSmlMVk4vaHJBaDAvV29Wd2VoQ2xmRjNEVW1JZ1JUQ1dVM3UKZk1UYUNEaE5XemUyCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
server: https://92BAADEAD75DB06218CE1125A95FFA4B.gr7.us-west-2.eks.amazonaws.com
name: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a6f5c8bba2ff85f1
contexts:
- context:
cluster: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a99ef5b36c745ce4
user: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a99ef5b36c745ce4
name: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a99ef5b36c745ce4
- context:
cluster: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a6f5c8bba2ff85f1
user: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a6f5c8bba2ff85f1
name: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a6f5c8bba2ff85f1
current-context: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a6f5c8bba2ff85f1
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a99ef5b36c745ce4
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --region
- us-west-2
- eks
- get-token
- --cluster-name
- cwagent-otel-config-e2e-eks-a99ef5b36c745ce4
- --output
- json
command: aws
- name: arn:aws:eks:us-west-2:637423426239:cluster/cwagent-otel-config-e2e-eks-a6f5c8bba2ff85f1
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --region
- us-west-2
- eks
- get-token
- --cluster-name
- cwagent-otel-config-e2e-eks-a6f5c8bba2ff85f1
- --output
- json
command: aws
19 changes: 13 additions & 6 deletions terraform/e2e/eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ resource "aws_eks_node_group" "this" {
subnet_ids = module.basic_components.public_subnet_ids

scaling_config {
desired_size = 1
max_size = 1
min_size = 1
desired_size = 2
max_size = 2
min_size = 2
}

ami_type = "AL2_x86_64"
Expand Down Expand Up @@ -121,14 +121,18 @@ resource "null_resource" "helm_charts" {
}
}

resource "null_resource" "install_helm_release" {
resource "null_resource" "install_helm_release_and_sample_app" {
depends_on = [
null_resource.kubectl,
aws_eks_cluster.this
null_resource.helm_charts,
aws_eks_cluster.this,
aws_eks_node_group.this
]

provisioner "local-exec" {
command = <<-EOT
${local.aws_eks} update-kubeconfig --name ${aws_eks_cluster.this.name}
helm upgrade --install amazon-cloudwatch-observability \
${path.module}/helm-charts/charts/amazon-cloudwatch-observability \
--values ${path.module}/helm-charts/charts/amazon-cloudwatch-observability/values.yaml \
Expand All @@ -145,6 +149,9 @@ resource "null_resource" "install_helm_release" {
${var.agent-config != "" ? "--set-json agent.config='${jsonencode(jsondecode(file(var.agent-config)))}'" : ""} \
${var.otel-config != "" ? "--set-file agent.otelConfig=${yamlencode(yamldecode(file(var.otel-config)))}" : ""} \
${var.prometheus-config != "" ? "--set-file agent.prometheus.config=${yamlencode(yamldecode(file(var.prometheus-config)))}" : ""}
kubectl apply -f ${var.sample-app}
kubectl wait --for=condition=available --timeout=300s deployment/${var.sample-app-name}
EOT

environment = {
Expand All @@ -155,7 +162,7 @@ resource "null_resource" "install_helm_release" {

resource "null_resource" "test" {
depends_on = [
null_resource.install_helm_release
null_resource.install_helm_release_and_sample_app
]

provisioner "local-exec" {
Expand Down
10 changes: 10 additions & 0 deletions terraform/e2e/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,14 @@ variable "cloudwatch_agent_operator_repository_url" {
variable "validate_test" {
type = string
default = "../../../test/e2e/jmx/validate_test.go"
}

variable "sample-app" {
type = string
default = "../../../test/e2e/jmx/files/sample_applications/tomcat-deployment.yaml"
}

variable "sample-app-name" {
type = string
default = "tomcat-deployment"
}
40 changes: 40 additions & 0 deletions test/e2e/jmx/files/cwagent_configs/jvm_tomcat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"metrics": {
"namespace": "JVM_TOMCAT_E2E",
"metrics_collected": {
"jmx": {
"jvm": {
"measurement": [
"jvm.classes.loaded",
"jvm.gc.collections.count",
"jvm.gc.collections.elapsed",
"jvm.memory.heap.committed",
"jvm.memory.heap.init",
"jvm.memory.heap.max",
"jvm.memory.heap.used",
"jvm.memory.nonheap.committed",
"jvm.memory.nonheap.init",
"jvm.memory.nonheap.max",
"jvm.memory.nonheap.used",
"jvm.memory.pool.committed",
"jvm.memory.pool.init",
"jvm.memory.pool.max",
"jvm.memory.pool.used",
"jvm.threads.count"
]
},
"tomcat": {
"measurement": [
"tomcat.sessions",
"tomcat.errors",
"tomcat.request_count",
"tomcat.max_time",
"tomcat.processing_time",
"tomcat.traffic",
"tomcat.threads"
]
}
}
}
}
}
Empty file.
14 changes: 14 additions & 0 deletions test/e2e/jmx/validate_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package jmx

import (
"fmt"
"testing"
)

func TestMetrics(t *testing.T) {
fmt.Printf("TestMetrics")
}

func TestResources(t *testing.T) {
fmt.Printf("TestResources")
}

0 comments on commit 661107a

Please sign in to comment.