-
Notifications
You must be signed in to change notification settings - Fork 0
/
velero.tf
59 lines (52 loc) · 1.46 KB
/
velero.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
resource "kubernetes_namespace" "velero" {
count = var.enable_velero ? 1 : 0
metadata {
name = var.velero_namespace_name
}
}
# Namespace admin role
resource "kubernetes_role" "tiller-velero" {
count = var.enable_velero ? 1 : 0
metadata {
name = "tiller-velero"
namespace = kubernetes_namespace.velero[0].metadata[0].name
}
# Read/write access to velero resources
rule {
api_groups = ["velero.io"]
resources = ["*"]
verbs = ["get", "list", "watch", "create", "update", "patch", "delete", "edit", "exec"]
}
}
# Namespace admin role bindings
resource "kubernetes_role_binding" "tiller-velero" {
count = var.enable_velero ? 1 : 0
metadata {
name = "tiller-velero"
namespace = kubernetes_namespace.velero[0].metadata[0].name
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "Role"
name = "tiller-velero"
}
# Users
subject {
kind = "ServiceAccount"
name = "tiller"
namespace = kubernetes_namespace.velero[0].metadata[0].name
}
}
resource "helm_release" "velero" {
count = var.enable_velero ? 1 : 0
depends_on = [kubernetes_role.tiller-velero, kubernetes_role_binding.tiller-velero]
name = "velero"
repository = var.velero_helm_repository
chart = "velero"
version = var.velero_helm_chart_version
namespace = kubernetes_namespace.velero[0].metadata[0].name
timeout = 1200
values = [
var.extra_velero_helm_values,
]
}