forked from ExpediaGroup/apiary-lifecycle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s.tf
68 lines (62 loc) · 1.84 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
/**
* Copyright (C) 2019-2020 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" "beekeeper" {
count = var.instance_type == "k8s" && var.k8s_ingress_enabled == 1 ? 1 : 0
metadata {
name = local.k8s_app_alias
labels = local.labels
annotations = {}
}
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[count.index].metadata.name
service_port = kubernetes_service.beekeeper_path_cleanup[count.index].spec.port.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[count.index].metadata.name
service_port = kubernetes_service.beekeeper_metadata_cleanup[count.index].spec.port.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[count.index].metadata.name
service_port = kubernetes_service.beekeeper_scheduler_apiary[count.index].spec.port.target_port
}
}
}
}
}
}