terraform-provider-helm
terraform-provider-helm copied to clipboard
circuit breaker is open. This request was not sent to the service
Hello,
We are trying to deploy helm charts using terraform helm provider and we end with below error.
ERROR:
circuit breaker is open. This request was not sent to the service. Look for earlier errors to determine why the circuit breaker was opened.
│ An open circuit breaker means service failed too many times in the recent past. Because the circuit breaker has been opened, requests within the openStateWindow of 30.00 seconds since the circuit breaker was opened will not be sent to the service.
│ For more information on the exact errors with which the service responds to your requests, enable Info-level logs and rerun your code.
│ URL which circuit breaker prevented request to - containerengine.me-jeddah-1.oci.oraclecloud.com/20180222/clusters/ocid1.cluster.oc1.me-jeddah-1.aaaaaaaab2aneb34x2um3ppsytsz5jsagm556vepfq5dakptycbresghwevq/kubeconfig/content
│ Circuit Breaker Info
│ Name - DefaultCircuitBreaker
│ State - open
│ Number of requests - 0
│ Number of success - 0
│ Number of failures - 0
│
│ with module.helm.data.oci_containerengine_cluster_kube_config.cluster["2"],
│ on .terraform/modules/helm/main.tf line 11, in data "oci_containerengine_cluster_kube_config" "cluster":
│ 11: data "oci_containerengine_cluster_kube_config" "cluster" {
Terraform config code:
helm = [
{
cluster_name = "fss-int-mgmt-mej1-iac"
compartment_id = "ocid1.compartment.oc1..aaaaaaaaevtr522gnz5hrcoqfrmevr23jiyhd3zme2h7fujpu4lr3txgm36q23ds"
charts = [
{
name = "metrics-server"
chart_path = "../helm-charts/metrics-server/"
namespace = "devops"
set = []
},
{
name = "nginx-ingress"
chart_path = "../helm-charts/nginx-ingress/"
namespace = "devops"
set = [
{
name = "controller.service.annotations.service.beta.kubernetes.io/oci-load-balancer-internal"
value = "false"
}
]
},
{
name = "jenkins"
chart_path = "../helm-charts/jenkins/"
namespace = "devops"
set = []
}
]
},
{
cluster_name = "fss-int-mgmt-mej1-common"
compartment_id = "ocid1.compartment.oc1..aaaaaaaaevtr522gnz5hrcoqfrmevr23jiyhd3zme2h7fujpu4lr3txgm36q23ds"
charts = [
{
name = "metrics-server"
chart_path = "../helm-charts/metrics-server/"
namespace = "devops"
set = []
},
{
name = "nginx-ingress"
chart_path = "../helm-charts/nginx-ingress/"
namespace = "devops"
set = [
{
name = "controller.service.annotations.service.beta.kubernetes.io/oci-load-balancer-internal"
value = "false"
}
]
},
{
name = "sonarqube"
chart_path = "../helm-charts/sonarqube/"
namespace = "devops"
set = []
},
{
name = "nexus"
chart_path = "../helm-charts/nexus/"
namespace = "devops"
set = []
},
]
},
{
cluster_name = "fss-int-mgmt-mej1-egress"
compartment_id = "ocid1.compartment.oc1..aaaaaaaaevtr522gnz5hrcoqfrmevr23jiyhd3zme2h7fujpu4lr3txgm36q23ds"
charts = [
{
name = "metrics-server"
chart_path = "../helm-charts/metrics-server/"
namespace = "devops"
set = []
},
{
name = "nginx-ingress"
chart_path = "../helm-charts/nginx-ingress/"
namespace = "devops"
set = [
{
name = "controller.service.annotations.service.beta.kubernetes.io/oci-load-balancer-internal"
value = "false"
}
]
}
]
}
]
Terraform module:
locals {
helm = { for k, v in var.helm : k => v }
}
data "oci_containerengine_clusters" "cluster_id" {
for_each = local.helm
compartment_id = each.value.compartment_id
name = each.value.cluster_name
}
data "oci_containerengine_cluster_kube_config" "cluster" {
for_each = local.helm
cluster_id = data.oci_containerengine_clusters.cluster_id[each.key].clusters[0].id
}
/* ****************************************
To fetch the cce cluster config and write into the text file
***************************************** */
resource "local_file" "config" {
for_each = local.helm
content = <<-EOL
${data.oci_containerengine_cluster_kube_config.cluster[each.key].content}
EOL
filename = "/tmp/kube-config.yaml"
}
locals {
charts = { for i in flatten([for n in local.helm :
[for a in lookup(n, "charts", []) :
merge(a, {
cluster_name = n.cluster_name
})]
]) : "${i.cluster_name}:${i.name}" => i }
}
resource "helm_release" "helm" {
for_each = local.charts
name = each.value.name
chart = each.value.chart_path
namespace = each.value.namespace
dynamic "set" {
for_each = each.value.set
content {
name = set.value.name
value = set.value.value
}
}
}