Skip to content

Commit

Permalink
add prometheus and grafana for argocd
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Santana <[email protected]>
  • Loading branch information
csantanapr committed Mar 8, 2023
1 parent 16dac42 commit 2515a65
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#Enabling IRSA module for extending the data sources to CloudWatch
serviceAccount:
create: false

resources:
limits:
cpu: 200m
memory: 512Mi
requests:
cpu: 200m
memory: 512Mi

autoscaling:
enabled: true
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 60
- type: Resource
resource:
name: memory
targetAverageUtilization: 60

nodeSelector:
kubernetes.io/os: ${operating_system}


adminUser: admin
# Set this password using set_sensitive values
#adminPassword:

persistence:
type: pvc
enabled: true
storageClassName: gp2
accessModes:
- ReadWriteOnce
size: 8Gi

datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server.prometheus.svc.cluster.local
access: proxy
isDefault: true

## Configure grafana dashboard providers
## ref: http://docs.grafana.org/administration/provisioning/#dashboards
##
## `path` must be /var/lib/grafana/dashboards/<provider_name>
##
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default

## Configure grafana dashboard to import
## NOTE: To use dashboards you must also enable/configure dashboardProviders
## ref: https://grafana.com/dashboards
##
## dashboards per provider, use provider name as key.
##
dashboards:
default:
argocd:
gnetId: 14584
revision: 1
datasource: Prometheus
57 changes: 56 additions & 1 deletion examples/gitops/argocd-multi-cluster/hub-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ module "eks_blueprints_kubernetes_addons" {
"eks.amazonaws.com/role-arn" : module.argocd_irsa.irsa_iam_role_arn
}
}
metrics : {
enabled : true
service : {
annotations : {
"prometheus.io/scrape" : true
}
}
}
}
repoServer : {
autoscaling : {
Expand All @@ -174,9 +182,25 @@ module "eks_blueprints_kubernetes_addons" {
memory : "256Mi"
}
}
metrics : {
enabled : true
service : {
annotations : {
"prometheus.io/scrape" : true
}
}
}
}
applicationSet : {
replicaCount : 2 # The controller doesn't scale horizontally, is active-standby replicas
metrics : {
enabled : true
service : {
annotations : {
"prometheus.io/scrape" : true
}
}
}
}
server : {
autoscaling : {
Expand All @@ -193,6 +217,14 @@ module "eks_blueprints_kubernetes_addons" {
memory : "256Mi"
}
}
metrics : {
enabled : true
service : {
annotations : {
"prometheus.io/scrape" : true
}
}
}
serviceAccount : {
annotations : {
"eks.amazonaws.com/role-arn" : module.argocd_irsa.irsa_iam_role_arn
Expand Down Expand Up @@ -234,7 +266,6 @@ module "eks_blueprints_kubernetes_addons" {
cm : {
"application.resourceTrackingMethod" : "annotation+label" #use annotation for tracking but keep labels for compatibility with other tools
}

}
}
),
Expand All @@ -254,6 +285,11 @@ module "eks_blueprints_kubernetes_addons" {
enable_external_dns = true # ArgoCD Server and UI use valid https domain name
external_dns_route53_zone_arns = [local.argocd_domain_arn] # ArgoCD Server and UI domain name is registered in Route 53

# Observability for ArgoCD
enable_amazon_eks_aws_ebs_csi_driver = true
enable_prometheus = true
enable_amazon_prometheus = true

enable_crossplane = false
crossplane_helm_config = {
version = "1.11.1" # Get the latest version from https://charts.crossplane.io/stable
Expand Down Expand Up @@ -408,6 +444,25 @@ resource "aws_iam_policy" "irsa_policy" {
tags = local.tags
}


resource "helm_release" "grafana" {
name = "grafana"
repository = "https://grafana.github.io/helm-charts"
chart = "grafana"
version = "6.52.1"
namespace = "grafana"
create_namespace = true


values = [templatefile("${path.module}/grafana-argocd/values.yaml", {
operating_system = "linux"
region = local.region
})]

depends_on = [module.eks_blueprints_kubernetes_addons]
}


################################################################################
# Supporting Resources
################################################################################
Expand Down

0 comments on commit 2515a65

Please sign in to comment.