From 0aef5cbeaee0474c62858f9fa767dc838991f04b Mon Sep 17 00:00:00 2001 From: Matthew Creal Morgan Date: Mon, 17 Mar 2025 14:02:20 -0700 Subject: [PATCH] autoscaling (#12) * revert replicas change * autoscaling * try tempo-distributed * would require config update * use bitnami image * rebase * update values --- .github/dependabot.yml | 11 +++ .github/workflows/terragrunt-cicd.yml | 101 ++++++++++++++++++++++++++ README.md | 2 + copy_images.tf | 4 +- main.tf | 10 +-- outputs.tf | 4 +- tempo_values.yaml | 36 ++++++++- 7 files changed, 156 insertions(+), 12 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/terragrunt-cicd.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..867570d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "terraform" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/workflows/terragrunt-cicd.yml b/.github/workflows/terragrunt-cicd.yml new file mode 100644 index 0000000..a78523e --- /dev/null +++ b/.github/workflows/terragrunt-cicd.yml @@ -0,0 +1,101 @@ +name: 'Terraform Module CI' + +on: + push: + branches: + - main + paths: + - '**/*.hcl' + - '**/*.tf' + pull_request: + branches: + - main + paths: + - '**/*.hcl' + - '**/*.tf' + +permissions: + contents: read + pull-requests: write + +jobs: + validate: + name: 'Validate Module' + runs-on: self-hosted + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: 1.5.0 + + - name: Terraform Init + run: | + terraform init -backend=false + + - name: Terraform Format + run: | + terraform fmt -check + + - name: Terraform Validate + run: | + terraform validate + + - name: Run tflint + uses: terraform-linters/setup-tflint@v3 + if: github.event_name == 'pull_request' + + - name: Lint Terraform + if: github.event_name == 'pull_request' + run: | + tflint --format compact + + release: + name: 'Create Release' + needs: validate + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + runs-on: self-hosted + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install Commitizen + run: | + pip install commitizen + + - name: Configure Git + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Bump Version and Generate Changelog + id: cz + run: | + cz bump --yes + echo "new_version=$(cz version --project)" >> $GITHUB_OUTPUT + echo "changelog=$(cz changelog --dry-run)" >> $GITHUB_OUTPUT + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.cz.outputs.new_version }} + release_name: Release v${{ steps.cz.outputs.new_version }} + draft: false + prerelease: false + body: ${{ steps.cz.outputs.changelog }} diff --git a/README.md b/README.md index 2f92f12..e587c7f 100644 --- a/README.md +++ b/README.md @@ -72,4 +72,6 @@ Developer NOTE: We should automate this configuration. |------|-------------| | [module\_name](#output\_module\_name) | The name of this module. | | [module\_version](#output\_module\_version) | The version of this module. | +| [tempo\_internal\_endpoint](#output\_tempo\_internal\_endpoint) | internal endpoint for tempo | +| [tempo\_otlp\_endpoint](#output\_tempo\_otlp\_endpoint) | internal otlp endpoint for tempo | diff --git a/copy_images.tf b/copy_images.tf index 71b92d2..7d14060 100644 --- a/copy_images.tf +++ b/copy_images.tf @@ -6,8 +6,8 @@ locals { enabled = true dest_path = null name = "tempo" - source_image = "grafana/tempo" - source_registry = "docker.io" + source_image = "bitnami/grafana-tempo" + source_registry = "public.ecr.aws" source_tag = var.tempo_tag tag = var.tempo_tag } diff --git a/main.tf b/main.tf index 9c9b28e..745a29c 100644 --- a/main.tf +++ b/main.tf @@ -7,8 +7,8 @@ locals { tempo_internal_port_number = 3100 tempo_internal_url = format("http://%v:%v/", local.tempo_internal_hostname, local.tempo_internal_port_number) - tempo_otlp_port_number = 4317 - tempo_otlp_url = format("http://%v:%v", local.tempo_internal_hostname, local.tempo_otlp_port_number) + tempo_otlp_port_number = 4317 + tempo_otlp_url = format("http://%v:%v", local.tempo_internal_hostname, local.tempo_otlp_port_number) } ################################################################################ @@ -54,11 +54,7 @@ resource "helm_release" "tempo" { set { name = "replicas" - value = "3" - } - set { - name = "tempo.storage.trace.s3.insecure" - value = "false" + value = "1" } set { name = "tempo.repository" diff --git a/outputs.tf b/outputs.tf index 35a58ea..de75fba 100644 --- a/outputs.tf +++ b/outputs.tf @@ -9,7 +9,7 @@ output "tempo_internal_endpoint" { port_number = local.tempo_internal_port_number url = local.tempo_internal_url } -} +} output "tempo_otlp_endpoint" { description = "internal otlp endpoint for tempo" @@ -18,7 +18,7 @@ output "tempo_otlp_endpoint" { port_number = local.tempo_otlp_port_number url = local.tempo_otlp_url } -} +} output "module_name" { description = "The name of this module." diff --git a/tempo_values.yaml b/tempo_values.yaml index 24b0ce7..24a6bbd 100644 --- a/tempo_values.yaml +++ b/tempo_values.yaml @@ -25,19 +25,53 @@ persistence: ingester: autoscaling: enabled: true + resources: + requests: + cpu: "1m" + memory: "1Mi" + limits: + cpu: "200m" + memory: "256Mi" distributor: autoscaling: enabled: true + resources: + requests: + cpu: "1m" + memory: "1Mi" + limits: + cpu: "200m" + memory: "256Mi" compactor: autoscaling: enabled: true + resources: + requests: + cpu: "1m" + memory: "1Mi" + limits: + cpu: "200m" + memory: "256Mi" querier: autoscaling: enabled: true + resources: + requests: + cpu: "1m" + memory: "1Mi" + limits: + cpu: "200m" + memory: "256Mi" gateway: autoscaling: enabled: true - + resources: + requests: + cpu: "1m" + memory: "1Mi" + limits: + cpu: "200m" + memory: "256Mi" traces: jaeger: zipkin: