This repository has been archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathkube-secrets.tf
76 lines (61 loc) · 1.83 KB
/
kube-secrets.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
resource "kubernetes_namespace" "kubeflow" {
metadata {
name = "kubeflow"
}
}
resource "kubernetes_namespace" "istio-system" {
count = var.istio_enabled ? 1 : 0
metadata {
name = "istio-system"
labels = {
"istio-injection" = "disabled"
}
}
}
# Create a Kubernetes secret for the cloudsql-proxy's credentials
resource "kubernetes_secret" "cloudsql-instance-credentials" {
depends_on = ["kubernetes_namespace.kubeflow"]
metadata {
namespace = "kubeflow"
name = "cloudsql-instance-credentials"
}
data = {
"credentials.json" = "${base64decode(google_service_account_key.cloudsql_proxy_key.private_key)}"
}
}
# Kubeflow instructions mention creating a "user-gcp-sa" containing credentials
# for the GCP SA for the "-user" account, which some of the sample pipelines
# expect to use/mount in order to talk to GCP resources in their pipeline
# steps.
resource "kubernetes_secret" "user-gcp-sa" {
depends_on = ["kubernetes_namespace.kubeflow"]
metadata {
namespace = "kubeflow"
name = "user-gcp-sa"
}
data = {
"user-gcp-sa.json" = "${base64decode(google_service_account_key.kubeflow_user_key.private_key)}"
}
}
# Create the admin-gcp-sa secret too
resource "kubernetes_secret" "admin-gcp-sa" {
depends_on = ["kubernetes_namespace.kubeflow"]
metadata {
namespace = "kubeflow"
name = "admin-gcp-sa"
}
data = {
"admin-gcp-sa.json" = "${base64decode(google_service_account_key.kubeflow_admin_key.private_key)}"
}
}
resource "kubernetes_secret" "istio_admin-gcp-sa" {
count = var.istio_enabled ? 1 : 0
depends_on = ["kubernetes_namespace.istio-system"]
metadata {
namespace = "istio-system"
name = "admin-gcp-sa"
}
data = {
"admin-gcp-sa.json" = "${base64decode(google_service_account_key.kubeflow_admin_key.private_key)}"
}
}