Skip to content

Commit 64a3dd9

Browse files
feat: Add support for mimir on gcp (#885)
* Add support for mimir on gcp Will use this to test grafana agent on our cd-demo cluster * add more bucket tf config
1 parent ae12190 commit 64a3dd9

File tree

8 files changed

+59
-5
lines changed

8 files changed

+59
-5
lines changed

mimir/helm/mimir/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: mimir
33
description: helm chart for mimir
44
type: application
5-
version: 0.1.6
5+
version: 0.1.7
66
appVersion: 2.7.1
77
dependencies:
88
- name: mimir-distributed

mimir/helm/mimir/values.yaml.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ mimir-distributed:
5252
annotations:
5353
eks.amazonaws.com/role-arn: {{ importValue "Terraform" "iam_role_arn" }}
5454
{{- end }}
55+
{{- if $isGcp }}
56+
serviceAccount:
57+
annotations:
58+
iam.gke.io/gcp-service-account: {{ importValue "Terraform" "service_account_email" }}
59+
{{ end }}
5560
{{- if and .Values.basicAuth .Values.hostname (not $traceShield) }}
5661
gateway:
5762
enabledNonEnterprise: true

mimir/plural/recipes/mimir-gcp.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: mimir-gcp
22
description: Installs mimir on an aws eks cluster
33
provider: GCP
44
primary: true
5-
private: true
65
dependencies:
76
- repo: bootstrap
87
name: gcp-k8s

mimir/terraform/gcp/deps.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ apiVersion: plural.sh/v1alpha1
22
kind: Dependencies
33
metadata:
44
description: mimir gcp setup
5-
version: 0.1.0
5+
version: 0.1.1
66
spec:
77
dependencies:
88
- name: gcp-bootstrap
99
repo: bootstrap
1010
type: terraform
1111
version: '>= 0.1.1'
1212
providers:
13-
- gcp
13+
- gcp
14+
outputs:
15+
service_account_email: service_account_email

mimir/terraform/gcp/main.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,23 @@ resource "kubernetes_namespace" "mimir" {
99
}
1010
}
1111

12+
13+
module "mimir-workload-identity" {
14+
source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity"
15+
name = "${var.cluster_name}-mimir-sa"
16+
namespace = var.namespace
17+
project_id = var.project_id
18+
use_existing_k8s_sa = true
19+
annotate_k8s_sa = false
20+
k8s_sa_name = var.mimir_serviceaccount
21+
roles = ["roles/storage.admin"]
22+
}
23+
24+
module "gcs_buckets" {
25+
source = "github.com/pluralsh/module-library//terraform/gcs-buckets"
26+
27+
project_id = var.project_id
28+
bucket_names = [var.mimir_blocks_bucket, var.mimir_alert_bucket, var.mimir_ruler_bucket]
29+
service_account_email = module.mimir-workload-identity.gcp_service_account_email
30+
location = var.bucket_location
31+
}

mimir/terraform/gcp/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "service_account_email" {
2+
value = module.mimir-workload-identity.gcp_service_account_email
3+
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
namespace = {{ .Namespace | quote }}
2-
cluster_name = {{ .Cluster | quote }}
2+
cluster_name = {{ .Cluster | quote }}
3+
mimir_blocks_bucket = {{ .Values.mimirBlocksBucket | quote }}
4+
mimir_alert_bucket = {{ .Values.mimirAlertBucket | quote }}
5+
mimir_ruler_bucket = {{ .Values.mimirRulerBucket | quote }}
6+
bucket_location = {{ .Context.BucketLocation | quote }}

mimir/terraform/gcp/variables.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,24 @@ variable "namespace" {
66
variable "cluster_name" {
77
type = string
88
}
9+
10+
variable "mimir_serviceaccount" {
11+
type = string
12+
default = "mimir"
13+
}
14+
15+
variable "mimir_blocks_bucket" {
16+
type = string
17+
}
18+
19+
variable "mimir_alert_bucket" {
20+
type = string
21+
}
22+
23+
variable "mimir_ruler_bucket" {
24+
type = string
25+
}
26+
27+
variable "bucket_location" {
28+
type = string
29+
}

0 commit comments

Comments
 (0)