-
Notifications
You must be signed in to change notification settings - Fork 7
/
k8s.tf
81 lines (75 loc) · 2.04 KB
/
k8s.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
/**
* Copyright (C) 2019-2021 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
locals {
labels = {
"app.kubernetes.io/name" = local.k8s_app_alias
"app.kubernetes.io/instance" = local.k8s_app_alias
"app.kubernetes.io/managed-by" = local.k8s_app_alias
}
}
resource "kubernetes_ingress_v1" "beekeeper" {
count = var.instance_type == "k8s" && var.k8s_ingress_enabled == 1 ? 1 : 0
metadata {
name = local.k8s_app_alias
labels = local.labels
annotations = {}
namespace = var.k8s_namespace
}
spec {
tls {
hosts = var.k8s_ingress_tls_hosts
secret_name = var.k8s_ingress_tls_secret
}
rule {
host = var.k8s_path_cleanup_ingress_host
http {
path {
path = var.k8s_path_cleanup_ingress_path
backend {
service {
name = kubernetes_service.beekeeper_path_cleanup[0].metadata[0].name
port {
number = kubernetes_service.beekeeper_path_cleanup[0].spec[0].port[0].target_port
}
}
}
}
}
}
rule {
host = var.k8s_metadata_cleanup_ingress_host
http {
path {
path = var.k8s_metadata_cleanup_ingress_path
backend {
service {
name = kubernetes_service.beekeeper_metadata_cleanup[0].metadata[0].name
port {
number = kubernetes_service.beekeeper_metadata_cleanup[0].spec[0].port[0].target_port
}
}
}
}
}
}
rule {
host = var.k8s_scheduler_apiary_ingress_host
http {
path {
path = var.k8s_scheduler_apiary_ingress_path
backend {
service {
name = kubernetes_service.beekeeper_scheduler_apiary[0].metadata[0].name
port {
number = kubernetes_service.beekeeper_scheduler_apiary[0].spec[0].port[0].target_port
}
}
}
}
}
}
}
}