Skip to content

Commit bc97966

Browse files
authored
fix: timeouts for ingress controller (#185)
1 parent 0e82713 commit bc97966

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

modules/roks-ingress/main.tf

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,34 @@ resource "kubernetes_manifest" "workload_ingress" {
9898
}
9999
}
100100
wait {
101-
# Wait until the ingress controller is fully available
102-
# This requires a TLS secret to be created
103-
# and will give time for the ALB to finish provisioning (private IPs are available)
101+
# Wait until the load balancer is provisioned
102+
# The subsequent wait will give time for the ALB to finish provisioning (private IPs are available)
103+
# The ingress controller will become fully available when the TLS secret is created, but that may take much longer
104104
condition {
105-
type = "Available"
105+
type = "LoadBalancerReady"
106106
status = "True"
107107
}
108108
}
109+
timeouts {
110+
create = "20m"
111+
update = "20m"
112+
delete = "20m"
113+
}
114+
}
115+
116+
# Give some more time for ALB private IPs to become available in case only the ingress is being re-created
117+
resource "time_sleep" "wait_for_ingress_provisioning" {
118+
depends_on = [restapi_object.workload_nlb_dns, kubernetes_manifest.workload_ingress]
119+
120+
destroy_duration = "5s"
121+
create_duration = "7m"
122+
triggers = {
123+
ingress_uid = kubernetes_manifest.workload_ingress.object.metadata.uid
124+
}
109125
}
110126

111127
data "kubernetes_service" "ingress_router_service" {
128+
depends_on = [time_sleep.wait_for_ingress_provisioning]
112129
metadata {
113130
name = "router-${kubernetes_manifest.workload_ingress.object.metadata.name}"
114131
namespace = "openshift-ingress"
@@ -169,7 +186,7 @@ resource "restapi_object" "workload_nlb_dns_cleanup" {
169186
# Need to get private IPs (private_ips) of the ALB to include in ACL
170187
data "ibm_is_lb" "ingress_vpc_alb" {
171188
name = "kube-${local.cluster_id}-${replace(data.kubernetes_service.ingress_router_service.metadata[0].uid, "-", "")}"
172-
depends_on = [time_sleep.wait_for_alb_provisioning]
189+
depends_on = [time_sleep.wait_for_alb_provisioning, time_sleep.wait_for_ingress_provisioning]
173190
}
174191

175192
# Assuming all SLZ zones for the ALB subnet will have the same ACL

solutions/banking/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ locals {
1212
watson_ml_project_name = var.prefix != null ? "${var.prefix}-${var.watson_project_name}" : var.watson_project_name
1313
sensitive_tokendata = sensitive(data.ibm_iam_auth_token.tokendata.iam_access_token)
1414

15-
elastic_index_name = var.prefix != null ? "${var.prefix}-${var.elastic_index_name}" : var.elastic_index_name
15+
# Translate index name to lowercase to avoid Elastic errors
16+
elastic_index_name = lower(var.prefix != null ? "${var.prefix}-${var.elastic_index_name}" : var.elastic_index_name)
1617
elastic_credentials_data = local.use_elastic_index ? jsondecode(data.ibm_resource_key.elastic_credentials[0].credentials_json).connection.https : null
1718
# Compose the URL without credentials to keep the latter sensitive
1819
elastic_service_binding = local.use_elastic_index ? {

0 commit comments

Comments
 (0)