Skip to content

Mcm cluster #2

Merged
merged 6 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .cz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
commitizen:
major_version_zero: true
name: cz_gitmoji
tag_format: $version
update_changelog_on_bump: true
version_provider: scm
version_scheme: semver2
80 changes: 40 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Local .terraform directories
**/.terraform/*
# terraform lock file.
**/.terraform.lock.hcl
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data,
# such as password, private keys, and other secrets. These should not be
# part of version control as they are data points which are potentially
# sensitive and subject to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources
# locally and so are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc
# It's a module, shouldn't have a providers.tf
provider*.tf
# Local .terraform directories
**/.terraform/*

# terraform lock file.
**/.terraform.lock.hcl

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data,
# such as password, private keys, and other secrets. These should not be
# part of version control as they are data points which are potentially
# sensitive and subject to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources
# locally and so are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

# It's a module, shouldn't have a providers.tf
provider*.tf
99 changes: 99 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# Git style
- id: check-added-large-files
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: forbid-new-submodules
- id: no-commit-to-branch

# Common errors
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: CHANGELOG.md
- id: check-yaml
- id: check-merge-conflict
- id: check-executables-have-shebangs

# Cross platform
- id: check-case-conflict
- id: mixed-line-ending
args: [--fix=lf]

# Security
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- id: detect-private-key

# JSON5 Linter
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
files: '.json5$'

# Terraform Hooks
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.94.2 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
hooks:
- id: terraform_fmt
args:
- --hook-config=--parallelism-ci-cpu-cores=2
- id: terraform_docs
args:
- --hook-config=--parallelism-ci-cpu-cores=2
- id: terraform_tflint
name: Terraform validate with tflint
description: Validates all Terraform configuration files with TFLint.
require_serial: true
entry: hooks/terraform_tflint.sh
language: script
files: (\.tf|\.tfvars)$
exclude: \.(terraform/.*|terragrunt-cache)$
args:
- --hook-config=--parallelism-ci-cpu-cores=2
- id: terragrunt_fmt
name: Terragrunt fmt
description: Rewrites all Terragrunt configuration files to a canonical format.
entry: hooks/terragrunt_fmt.sh
language: script
files: (\.hcl)$
exclude: \.(terraform/.*|terragrunt-cache)$
args:
- --hook-config=--parallelism-ci-cpu-cores=2
### DISABLED UNTIL MINIFIED TERRAGRUNT.HCL IS CREATED
# - id: terragrunt_validate
# name: Terragrunt validate
# description: Validates all Terragrunt configuration files.
# entry: hooks/terragrunt_validate.sh
# language: script
# files: (\.hcl)$
# exclude: \.(terraform/.*|terragrunt-cache)$
# args:
# - --hook-config=--parallelism-ci-cpu-cores=2
# - id: terragrunt_validate_inputs
# name: Terragrunt validate inputs
# description: Validates Terragrunt unused and undefined inputs.
# entry: hooks/terragrunt_validate_inputs.sh
# language: script
# files: (\.hcl)$
# exclude: \.(terraform/.*|terragrunt-cache)$
# args:
# - --hook-config=--parallelism-ci-cpu-cores=2
# - id: terragrunt_providers_lock
# name: Terragrunt providers lock
# description: Updates provider signatures in dependency lock files using terragrunt.
# entry: hooks/terragrunt_providers_lock.sh
# language: script
# files: (terragrunt|\.terraform\.lock)\.hcl$
# exclude: \.(terraform/.*|terragrunt-cache)$
# args:
# - --hook-config=--parallelism-ci-cpu-cores=2

- repo: https://github.com/ljnsn/cz-conventional-gitmoji
rev: v0.3.3
hooks:
- id: conventional-gitmoji
36 changes: 36 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"branches": [
"main",
"master"
],
"ci": false,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"successComment":
"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:",
"labels": false,
"releasedLabels": false
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file."
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
],
"message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
44 changes: 44 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
formatter: markdown table

header-from: main.tf
footer-from: ""

sections:
## hide: []
show:
- data-sources
- header
- footer
- inputs
- modules
- outputs
- providers
- requirements
- resources

output:
file: README.md
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
output-values:
enabled: false
from: ""

sort:
enabled: true
by: name

settings:
anchor: true
color: true
default: true
description: true
escape: true
indent: 2
required: true
sensitive: true
type: true
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@




# CHANGELOG
* 0.0.2 -- 2024-07-30
- updated docs
- updated images module
- NOTE: this is the single binary deploy, there is a disributed version we can use, different helm chart.
* 0.0.1 -- 2024-07-26
- Code genesis
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Tempo is an open source distributed tracing backend from Grafana. Tempo supports the major standard tracing protocols like Jaeger, Zipkin and OpenTelemetry, allowing flexibility in implementation for development teams. Traces in microservice contexts are a means to track and observe the flow of requests through the various services and components of the distributed system and are a key means to understanding an applications behavior and optimizing performance. Tempo is being adopted as a replacement to Jaeger Tracing because it uses object storage for trace retention that eliminates the costly dependency of running Jaeger's backend (Cassandra or Elasticsearch). Additionally, Tempo is heavily integrated with the other components of our monitoring and operations stack, Grafana, Prometheus and Loki. "Grafana Tempo lets you scale tracing as far as possible with minimal operational cost and less complexity than ever before." - [Grafana Tempo](https://grafana.com/oss/tempo/)

Tempo depends upon Prometheus because we are enabling the [metrics-generator](https://grafana.com/docs/tempo/latest/metrics-generator/) feature that derives RED (Request, Error and Duration) metrics from spans. Capturing these details allow for far more depth in system analysis. See [tfmod-prometheus](https://github.e.it.census.gov/SCT-Engineering/tfmod-prometheus) for ensuring Prometheus is accessible to Tempo.
Tempo depends upon Prometheus because we are enabling the [metrics-generator](https://grafana.com/docs/tempo/latest/metrics-generator/) feature that derives RED (Request, Error and Duration) metrics from spans. Capturing these details allow for far more depth in system analysis. See [tfmod-prometheus](https://github.e.it.census.gov/SCT-Engineering/tfmod-prometheus) for ensuring Prometheus is accessible to Tempo.

#### To enable service graph in Grafana:
1. Add tempo as data-source.
Expand All @@ -14,11 +14,6 @@ Developer NOTE: We should automate this configuration.
- Apps within the cluster should push to `http://tempo.$TEMPO_NAMESPACE:9411/api/v2/spans`
- Apps outside the cluster should push to tempo external endpoint e.g. `https://tempo.adsd-cumulus-dev.dev.csp1.census.gov/api/v2/spans`. You need to create the external endpoint, ex. `https://tempo.adsd-cumulus-dev.dev.csp1.census.gov`, it will not be created as part of this module.

# CHANGELOG

* 0.0.1 -- 2024-07-26
- Code genesis

<!-- BEGIN_TF_DOCS -->
## Requirements

Expand All @@ -35,9 +30,8 @@ Developer NOTE: We should automate this configuration.

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.14.0 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | >= 2.11.0 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | >= 2.23.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.68.0 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.15.0 |

## Modules

Expand All @@ -52,31 +46,29 @@ Developer NOTE: We should automate this configuration.
| Name | Type |
|------|------|
| [helm_release.tempo](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [kubernetes_namespace.ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_eks_cluster.cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source |
| [aws_eks_cluster_auth.cluster_auth](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster_auth) | data source |
| [aws_s3_bucket.s3_server_access_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source |
| [kubernetes_namespace.existing-ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/namespace) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_additional_tags"></a> [additional\_tags](#input\_additional\_tags) | Additional tags to add to resources created in AWS (s3 bucket, ...) | `map(string)` | `{}` | no |
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | EKS cluster name name component used through out the EKS cluster describing its purpose (ex: dice-dev) | `string` | n/a | yes |
| <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Indicates whether the `namespace` needs to be created ('true') or already exists (not `true`) | `string` | `"true"` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | The namespace into which tempo will be deployed | `string` | `"tempo"` | no |
| <a name="input_oidc_provider_arn"></a> [oidc\_provider\_arn](#input\_oidc\_provider\_arn) | The ARN in the EKS cluster for the OpenID Connect identity provider. | `string` | n/a | yes |
| <a name="input_profile"></a> [profile](#input\_profile) | AWS config profile used to upload images into ECR | `string` | `""` | no |
| <a name="input_prometheus_namespace"></a> [prometheus\_namespace](#input\_prometheus\_namespace) | Namespace where Prometheus is installed. | `string` | `"log-trace-monitor"` | no |
| <a name="input_prometheus_namespace"></a> [prometheus\_namespace](#input\_prometheus\_namespace) | Namespace where Prometheus is installed. | `string` | `"prometheus"` | no |
| <a name="input_prometheus_port"></a> [prometheus\_port](#input\_prometheus\_port) | Port number of Prometheus service, mostly either 80 or 9090 | `string` | `"80"` | no |
| <a name="input_prometheus_svc"></a> [prometheus\_svc](#input\_prometheus\_svc) | Prometheus service name. | `string` | `"prometheus-server"` | no |
| <a name="input_region"></a> [region](#input\_region) | The region holding these resources (for the s3 bucket.) | `string` | n/a | yes |
| <a name="input_rwo_storage_class"></a> [rwo\_storage\_class](#input\_rwo\_storage\_class) | Specify the storage class for persistent volumes. | `string` | `"gp3-encrypted"` | no |
| <a name="input_tempo_chart_version"></a> [tempo\_chart\_version](#input\_tempo\_chart\_version) | Which version of the grafana/tempo helm chart to use. | `string` | `"1.10.1"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags to add to resources created in AWS (s3 bucket, ...) | `map(string)` | `{}` | no |
| <a name="input_tempo_chart_version"></a> [tempo\_chart\_version](#input\_tempo\_chart\_version) | Which version of the grafana/tempo helm chart to use. | `string` | `"1.10.3"` | no |
| <a name="input_tempo_tag"></a> [tempo\_tag](#input\_tempo\_tag) | The tag of the tempo image to use. | `string` | `"2.5.0"` | no |

## Outputs

No outputs.
<!-- END_TF_DOCS -->
| Name | Description |
|------|-------------|
| <a name="output_module_name"></a> [module\_name](#output\_module\_name) | The name of this module. |
| <a name="output_module_version"></a> [module\_version](#output\_module\_version) | The version of this module. |
<!-- END_TF_DOCS -->
Loading