-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update after second PR review comment
replaced chaos- by chaos_ chaos-mesh : mobed data block and use output rename modules/k8s/chaos-mesh to modules/k8s/chaos)mesh infrastructure/modules/k8s/chaos_mesh/variables.tf : update debug versions.tfvars.json : debug infrastructure/quick-deploy/localhost/all-in-one/variables.tf : debug infrastructure/quick-deploy/localhost/all-in-one/variables.tf : debug infrastructure/modules/k8s/chaos_mesh/main.tf : debug terraform fmt -recursive tryinh kubernetes_service infrastructure/modules/k8s/chaos_mesh/outputs.tf : debug debug debug terraform fmt -recursive sync localhost debug debug debug debug debug debug debug debug debug debug debug debug debug debug debug terraform fmt -recursive debug
- Loading branch information
1 parent
e1d86c9
commit 6566b65
Showing
15 changed files
with
123 additions
and
115 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...tructure/modules/k8s/chaos-mesh/README.md → ...tructure/modules/k8s/chaos_mesh/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Module for deploying Chaos Mesh | ||
|
||
https://chaos-mesh.org/docs/production-installation-using-helm/ | ||
https://chaos-mesh.org/docs/offline-installation/ | ||
https://chaos_mesh.org/docs/production-installation-using-helm/ | ||
https://chaos_mesh.org/docs/offline-installation/ | ||
https://github.com/3191110276/terraform-kubernetes-chaosmesh/blob/main/main.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
resource "kubernetes_namespace" "chaosmesh" { | ||
metadata { | ||
name = var.namespace | ||
} | ||
} | ||
|
||
resource "helm_release" "chaosmesh" { | ||
name = "chaosmesh" | ||
namespace = kubernetes_namespace.chaosmesh.metadata[0].name | ||
chart = "chaos-mesh" | ||
repository = var.helm_chart_repository | ||
version = var.helm_chart_version | ||
|
||
set { | ||
name = "image.chaosmesh.repository" | ||
value = var.docker_image.chaosmesh.image | ||
} | ||
set { | ||
name = "image.chaosdaemon.tag" | ||
value = var.docker_image.chaosdaemon.tag | ||
} | ||
set { | ||
name = "image.chaosdashboard.tag" | ||
value = var.docker_image.chaosdashboard.tag | ||
} | ||
|
||
set { | ||
name = "dashboard.service.type" | ||
value = var.service_type | ||
} | ||
|
||
# commented coz it crash with the error : | ||
# var.node_selector is object with no attributes | ||
# Inappropriate value for attribute "value": string required | ||
|
||
#set { | ||
# name = "controllerManager.nodeSelector" | ||
# value = var.node_selector | ||
#} | ||
|
||
#set { | ||
# name = "chaosDaemon.nodeSelector" | ||
# value = var.node_selector | ||
#} | ||
|
||
#set { | ||
# name = "dashboard.nodeSelector" | ||
# value = var.node_selector | ||
#} | ||
|
||
#set { | ||
# name = "dnsServer.nodeSelector" | ||
# value = var.node_selector | ||
#} | ||
|
||
#set { | ||
# name = "prometheus.nodeSelector" | ||
# value = var.node_selector | ||
#} | ||
|
||
} | ||
|
||
data "kubernetes_service" "chaos_dashboard" { | ||
metadata { | ||
name = "chaos-dashboard" | ||
namespace = var.namespace | ||
} | ||
depends_on = [resource.helm_release.chaosmesh] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "chaos_mesh_url" { | ||
description = "Chaos Mesh endpoint URL" | ||
value = "http://${data.kubernetes_service.chaos_dashboard.status.0.load_balancer.0.ingress.0.ip}:${data.kubernetes_service.chaos_dashboard.spec.0.port.0.node_port}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
# Chaos Mesh | ||
module "chaos-mesh" { | ||
count = var.chaos-mesh.enable ? 1 : 0 | ||
source = "../../../modules/k8s/chaos-mesh/" | ||
namespace = var.chaos-mesh.namespace | ||
module "chaos_mesh" { | ||
count = var.chaos_mesh != null ? 1 : 0 | ||
source = "../../../modules/k8s/chaos_mesh/" | ||
namespace = var.chaos_mesh.namespace | ||
docker_image = { | ||
chaosmesh = { | ||
image = var.chaos-mesh.chaosmesh_image_name | ||
tag = try(coalesce(var.chaos-mesh.chaosmesh_image_tag), local.default_tags[var.chaos-mesh.chaosmesh_image_name]) | ||
image = var.chaos_mesh.chaosmesh_image_name | ||
tag = try(coalesce(var.chaos_mesh.chaosmesh_image_tag), local.default_tags[var.chaos_mesh.chaosmesh_image_name]) | ||
} | ||
chaosdaemon = { | ||
image = var.chaos-mesh.chaosdaemon_image_name | ||
tag = try(coalesce(var.chaos-mesh.chaosdaemon_image_tag), local.default_tags[var.chaos-mesh.chaosdaemon_image_name]) | ||
image = var.chaos_mesh.chaosdaemon_image_name | ||
tag = try(coalesce(var.chaos_mesh.chaosdaemon_image_tag), local.default_tags[var.chaos_mesh.chaosdaemon_image_name]) | ||
} | ||
chaosdashboard = { | ||
image = var.chaos-mesh.chaosdashboard_image_name | ||
tag = try(coalesce(var.chaos-mesh.chaosdashboard_image_tag), local.default_tags[var.chaos-mesh.chaosdashboard_image_name]) | ||
image = var.chaos_mesh.chaosdashboard_image_name | ||
tag = try(coalesce(var.chaos_mesh.chaosdashboard_image_tag), local.default_tags[var.chaos_mesh.chaosdashboard_image_name]) | ||
} | ||
} | ||
helm_chart_repository = try(coalesce(var.chaos-mesh.helm_chart_repository), var.helm_charts.chaos-mesh.repository) | ||
helm_chart_version = try(coalesce(var.chaos-mesh.helm_chart_verison), var.helm_charts.chaos-mesh.version) | ||
service_type = var.chaos-mesh.service_type | ||
helm_chart_repository = try(coalesce(var.chaos_mesh.helm_chart_repository), var.helm_charts.chaos_mesh.repository) | ||
helm_chart_version = try(coalesce(var.chaos_mesh.helm_chart_verison), var.helm_charts.chaos_mesh.version) | ||
service_type = var.chaos_mesh.service_type | ||
node_selector = var.chaos_mesh.node_selector | ||
} | ||
|
||
data "external" "get_chaos_dashboard_port" { | ||
program = ["sh", "-c", "kubectl get svc chaos-dashboard -n chaos-mesh -o jsonpath='{\"{\"}\"nodeport\": \"{.spec.ports[0].nodePort}\"}'"] | ||
depends_on = [module.chaos-mesh] | ||
} | ||
|
||
data "external" "get_chaos_dashboard_ip" { | ||
program = ["sh", "-c", "kubectl get svc chaos-dashboard -n chaos-mesh -o jsonpath='{\"{\"}\"ip\": \"{.status.loadBalancer.ingress[0].ip}\"}'"] | ||
depends_on = [module.chaos-mesh] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 14 additions & 23 deletions
37
infrastructure/quick-deploy/localhost/all-in-one/chaos-mesh.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
# Chaos Mesh | ||
module "chaos-mesh" { | ||
count = var.chaos-mesh.enable ? 1 : 0 | ||
source = "../../../modules/k8s/chaos-mesh/" | ||
namespace = var.chaos-mesh.namespace | ||
module "chaos_mesh" { | ||
count = var.chaos_mesh != null ? 1 : 0 | ||
source = "../../../modules/k8s/chaos_mesh/" | ||
namespace = var.chaos_mesh.namespace | ||
docker_image = { | ||
chaosmesh = { | ||
image = var.chaos-mesh.chaosmesh_image_name | ||
tag = try(coalesce(var.chaos-mesh.chaosmesh_image_tag), local.default_tags[var.chaos-mesh.chaosmesh_image_name]) | ||
image = var.chaos_mesh.chaosmesh_image_name | ||
tag = try(coalesce(var.chaos_mesh.chaosmesh_image_tag), local.default_tags[var.chaos_mesh.chaosmesh_image_name]) | ||
} | ||
chaosdaemon = { | ||
image = var.chaos-mesh.chaosdaemon_image_name | ||
tag = try(coalesce(var.chaos-mesh.chaosdaemon_image_tag), local.default_tags[var.chaos-mesh.chaosdaemon_image_name]) | ||
image = var.chaos_mesh.chaosdaemon_image_name | ||
tag = try(coalesce(var.chaos_mesh.chaosdaemon_image_tag), local.default_tags[var.chaos_mesh.chaosdaemon_image_name]) | ||
} | ||
chaosdashboard = { | ||
image = var.chaos-mesh.chaosdashboard_image_name | ||
tag = try(coalesce(var.chaos-mesh.chaosdashboard_image_tag), local.default_tags[var.chaos-mesh.chaosdashboard_image_name]) | ||
image = var.chaos_mesh.chaosdashboard_image_name | ||
tag = try(coalesce(var.chaos_mesh.chaosdashboard_image_tag), local.default_tags[var.chaos_mesh.chaosdashboard_image_name]) | ||
} | ||
} | ||
helm_chart_repository = try(coalesce(var.chaos-mesh.helm_chart_repository), var.helm_charts.chaos-mesh.repository) | ||
helm_chart_version = try(coalesce(var.chaos-mesh.helm_chart_verison), var.helm_charts.chaos-mesh.version) | ||
service_type = var.chaos-mesh.service_type | ||
helm_chart_repository = try(coalesce(var.chaos_mesh.helm_chart_repository), var.helm_charts.chaos_mesh.repository) | ||
helm_chart_version = try(coalesce(var.chaos_mesh.helm_chart_verison), var.helm_charts.chaos_mesh.version) | ||
service_type = var.chaos_mesh.service_type | ||
node_selector = var.chaos_mesh.node_selector | ||
} | ||
|
||
data "external" "get_chaos_dashboard_port" { | ||
program = ["sh", "-c", "kubectl get svc chaos-dashboard -n chaos-mesh -o jsonpath='{\"{\"}\"nodeport\": \"{.spec.ports[0].nodePort}\"}'"] | ||
depends_on = [module.chaos-mesh] | ||
} | ||
|
||
data "external" "get_chaos_dashboard_ip" { | ||
program = ["sh", "-c", "kubectl get svc chaos-dashboard -n chaos-mesh -o jsonpath='{\"{\"}\"ip\": \"{.status.loadBalancer.ingress[0].ip}\"}'"] | ||
depends_on = [module.chaos-mesh] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters