forked from rtlnl/terraform-kubernetes-flux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemcached.tf
76 lines (64 loc) · 1.58 KB
/
memcached.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_deployment" "flux_memcached" {
count = var.install_memcached ? 1 : 0
metadata {
name = local.memcached
namespace = kubernetes_namespace.flux.metadata.0.name
labels = local.memcached_labels
}
spec {
replicas = var.memcached_replicas
selector {
match_labels = local.memcached_labels
}
template {
metadata {
labels = local.memcached_labels
}
spec {
container {
name = "memcached"
image = "memcached:${var.memcached_version}"
args = var.memcached_arguments
port {
name = "memcached"
container_port = 11211
}
resources {
requests {
cpu = var.memcached_resources["cpu"]
memory = var.memcached_resources["memory"]
}
}
image_pull_policy = "IfNotPresent"
security_context {
run_as_user = 11211
run_as_group = 11211
}
}
node_selector = {
"beta.kubernetes.io/os" = "linux"
}
}
}
strategy {
type = "Recreate"
}
}
}
resource "kubernetes_service" "flux_memcached" {
count = var.install_memcached ? 1 : 0
metadata {
name = local.memcached
namespace = kubernetes_namespace.flux.metadata.0.name
labels = local.memcached_labels
}
spec {
port {
name = "memcached"
protocol = "TCP"
port = 11211
target_port = "memcached"
}
selector = local.memcached_labels
}
}