Skip to content

Commit 56fa5dd

Browse files
committed
fix: helm auth and args
1 parent 2d34cf8 commit 56fa5dd

File tree

6 files changed

+129
-67
lines changed

6 files changed

+129
-67
lines changed

examples/basic/main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ provider "google-beta" {
1010
zone = var.zone
1111
}
1212

13+
data "google_client_config" "current" {}
14+
15+
provider "helm" {
16+
kubernetes {
17+
host = "https://${module.ctrlplane.cluster_endpoint}"
18+
cluster_ca_certificate = base64decode(module.ctrlplane.cluster_ca_certificate)
19+
token = data.google_client_config.current.access_token
20+
}
21+
}
22+
1323
module "ctrlplane" {
1424
source = "../../"
1525
namespace = var.namespace

modules/gke/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11

2+
output "cluster_ca_certificate" {
3+
value = google_container_cluster.this.master_auth.0.cluster_ca_certificate
4+
sensitive = true
5+
}
6+
7+
output "cluster_endpoint" {
8+
value = google_container_cluster.this.endpoint
9+
}

modules/gke/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ variable "deletion_protection" {
1818
type = bool
1919
default = true
2020
}
21+

modules/helm_release/main.tf

Lines changed: 95 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,103 @@ resource "helm_release" "this" {
22
name = "ctrlplane"
33
chart = "ctrlplane"
44
repository = "https://charts.ctrlplane.dev/"
5+
version = "0.1.13"
56

7+
set {
8+
name = "migrations.image.tag"
9+
value = "bf077e5"
10+
}
11+
12+
13+
set {
14+
name = "webservice.image.tag"
15+
value = "72ce135"
16+
}
17+
18+
19+
set {
20+
name = "event-worker.image.tag"
21+
value = "72ce135"
22+
}
23+
24+
25+
set {
26+
name = "job-policy-checker.image.tag"
27+
value = "72ce135"
28+
}
29+
30+
set {
31+
name = "global.postgresql.user"
32+
value = var.postgres_user
33+
}
34+
35+
set {
36+
name = "global.postgresql.password"
37+
value = var.postgres_password
38+
}
39+
40+
set {
41+
name = "global.postgresql.host"
42+
value = var.postgres_host
43+
}
44+
45+
set {
46+
name = "global.postgresql.port"
47+
value = var.postgres_port
48+
}
49+
50+
set {
51+
name = "global.postgresql.database"
52+
value = var.postgres_database
53+
}
54+
55+
set {
56+
name = "global.redis.host"
57+
value = var.redis_host
58+
}
59+
60+
set {
61+
name = "global.redis.password"
62+
value = var.redis_password
63+
}
64+
65+
set {
66+
name = "global.redis.port"
67+
value = var.redis_port
68+
}
69+
70+
set {
71+
name = "ingress.annotations.kubernetes\\.io/ingress\\.class"
72+
value = "gce"
73+
}
74+
75+
set {
76+
name = "ingress.annotations.kubernetes\\.io/ingress\\.global-static-ip-name"
77+
value = var.global_static_ip_name
78+
}
79+
80+
set {
81+
name = "ingress.annotations.ingress\\.gcp\\.kubernetes\\.io/pre-shared-cert"
82+
value = var.pre_shared_cert
83+
}
84+
85+
# set {
86+
# name = "ingress.annotations.kubernetes\\.io/ingress\\.allow-http"
87+
# value = "true " # idk how to make this a string not a booleaning
88+
# }
89+
90+
set {
91+
name = "webservice.annotations.iam\\.gke\\.io/gcp-service-account"
92+
value = var.service_account_email
93+
}
94+
95+
set {
96+
name = "job-policy-checker.annotations.iam\\.gke\\.io/gcp-service-account"
97+
value = var.service_account_email
98+
}
699

7100
set {
8-
name = "global"
9-
value = yamlencode({
10-
"postgres" = {
11-
"user" = var.postgres_user
12-
"password" = var.postgres_password
13-
"host" = var.postgres_host
14-
"port" = var.postgres_port
15-
"database" = var.postgres_database
16-
}
17-
18-
"reds" = {
19-
"host" = var.redis_host
20-
"port" = var.redis_port
21-
"password" = var.redis_password
22-
}
23-
})
24-
}
25-
26-
set {
27-
name = "ingress"
28-
value = yamlencode({
29-
"enabled" = true
30-
"annotations" = {
31-
"kubernetes.io/ingress.class" = "gce"
32-
"kubernetes.io/ingress.global-static-ip-name" = var.global_static_ip_name
33-
"ingress.gcp.kubernetes.io/pre-shared-cert" = var.pre_shared_cert
34-
"kubernetes.io/ingress.allow-http" = "false"
35-
}
36-
})
37-
}
38-
39-
set {
40-
name = "webservice"
41-
value = yamlencode({
42-
"serviceAccount" = {
43-
"create" = true
44-
"annotations" = {
45-
"iam.gke.io/gcp-service-account" = var.service_account_email
46-
}
47-
}
48-
})
49-
}
50-
51-
set {
52-
name = "job-policy-checker"
53-
value = yamlencode({
54-
"serviceAccount" = {
55-
"create" = true
56-
"annotations" = {
57-
"iam.gke.io/gcp-service-account" = var.service_account_email
58-
}
59-
}
60-
})
61-
}
62-
63-
set {
64-
name = "migrations"
65-
value = yamlencode({
66-
"serviceAccount" = {
67-
"create" = true
68-
"annotations" = {
69-
"iam.gke.io/gcp-service-account" = var.service_account_email
70-
}
71-
}
72-
})
101+
name = "migrations.annotations.iam\\.gke\\.io/gcp-service-account"
102+
value = var.service_account_email
73103
}
74104
}

outputs.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,17 @@ output "redis_port" {
3232
value = module.redis.redis_port
3333
description = "The port of the Redis instance."
3434
}
35+
36+
output "cluster_ca_certificate" {
37+
value = module.gke.cluster_ca_certificate
38+
sensitive = true
39+
}
40+
41+
output "cluster_endpoint" {
42+
value = module.gke.cluster_endpoint
43+
sensitive = true
44+
}
45+
46+
output "ip" {
47+
value = google_compute_global_address.this.address
48+
}

variables.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@ variable "deletion_protection" {
4242
variable "domains" {
4343
description = "The domains to use for the SSL certificate."
4444
type = list(string)
45-
46-
}
45+
}

0 commit comments

Comments
 (0)