forked from particuleio/terraform-kubernetes-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
strimzi-kafka-operator.tf
101 lines (88 loc) · 3.66 KB
/
strimzi-kafka-operator.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
locals {
strimzi-kafka-operator = merge(
local.helm_defaults,
{
name = "strimzi-kafka-operator"
namespace = "strimzi-kafka-operator"
chart = "strimzi-kafka-operator"
repository = "https://strimzi.io/charts/"
enabled = false
create_ns = true
chart_version = "0.21.0"
version = "0.21.0"
default_network_policy = true
},
var.strimzi-kafka-operator
)
values_strimzi-kafka-operator = <<VALUES
VALUES
}
resource "kubernetes_namespace" "strimzi-kafka-operator" {
count = local.strimzi-kafka-operator["enabled"] && local.strimzi-kafka-operator["create_ns"] ? 1 : 0
metadata {
labels = {
name = local.strimzi-kafka-operator["namespace"]
}
name = local.strimzi-kafka-operator["namespace"]
}
}
resource "helm_release" "strimzi-kafka-operator" {
count = local.strimzi-kafka-operator["enabled"] ? 1 : 0
repository = local.strimzi-kafka-operator["repository"]
name = local.strimzi-kafka-operator["name"]
chart = local.strimzi-kafka-operator["chart"]
version = local.strimzi-kafka-operator["chart_version"]
timeout = local.strimzi-kafka-operator["timeout"]
force_update = local.strimzi-kafka-operator["force_update"]
recreate_pods = local.strimzi-kafka-operator["recreate_pods"]
wait = local.strimzi-kafka-operator["wait"]
atomic = local.strimzi-kafka-operator["atomic"]
cleanup_on_fail = local.strimzi-kafka-operator["cleanup_on_fail"]
dependency_update = local.strimzi-kafka-operator["dependency_update"]
disable_crd_hooks = local.strimzi-kafka-operator["disable_crd_hooks"]
disable_webhooks = local.strimzi-kafka-operator["disable_webhooks"]
render_subchart_notes = local.strimzi-kafka-operator["render_subchart_notes"]
replace = local.strimzi-kafka-operator["replace"]
reset_values = local.strimzi-kafka-operator["reset_values"]
reuse_values = local.strimzi-kafka-operator["reuse_values"]
skip_crds = local.strimzi-kafka-operator["skip_crds"]
verify = local.strimzi-kafka-operator["verify"]
values = [
local.values_strimzi-kafka-operator,
local.strimzi-kafka-operator["extra_values"]
]
namespace = local.strimzi-kafka-operator["create_ns"] ? kubernetes_namespace.strimzi-kafka-operator.*.metadata.0.name[count.index] : local.strimzi-kafka-operator["namespace"]
}
resource "kubernetes_network_policy" "strimzi-kafka-operator_default_deny" {
count = local.strimzi-kafka-operator["enabled"] && local.strimzi-kafka-operator["default_network_policy"] ? 1 : 0
metadata {
name = "${local.strimzi-kafka-operator["namespace"]}-${local.strimzi-kafka-operator["name"]}-default-deny"
namespace = local.strimzi-kafka-operator["namespace"]
}
spec {
pod_selector {
}
policy_types = ["Ingress"]
}
}
resource "kubernetes_network_policy" "strimzi-kafka-operator_allow_namespace" {
count = local.strimzi-kafka-operator["enabled"] && local.strimzi-kafka-operator["default_network_policy"] ? 1 : 0
metadata {
name = "${local.strimzi-kafka-operator["namespace"]}-${local.strimzi-kafka-operator["name"]}-default-namespace"
namespace = local.strimzi-kafka-operator["namespace"]
}
spec {
pod_selector {
}
ingress {
from {
namespace_selector {
match_labels = {
name = local.strimzi-kafka-operator["namespace"]
}
}
}
}
policy_types = ["Ingress"]
}
}