diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5f39d4822..837153080 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -61,8 +61,8 @@ jobs: shell: bash run: | set -ex - export ADMIN_API_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.admin_api_url') - export ADMIN_APP_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.admin_app_url') + export ADMIN_API_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.admin_api_url') + export ADMIN_APP_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.admin_app_url') : "Add -f again when a success endpoint has been implemented" curl -sSL "${ADMIN_API_URL}" -o /dev/null || true "in v2.7.2, there is no api endpoint" curl -fsSL "${ADMIN_APP_URL}" -o /dev/null || true "in v2.7.2, there is no app endpoint" @@ -74,10 +74,10 @@ jobs: logs/infra/tfstates \ logs/app - if [ -e infrastructure/quick-deploy/localhost/all/generated/armonik-output.json ] ; then - cp infrastructure/quick-deploy/localhost/all/generated/armonik-output.json logs/infra/generated + if [ -e infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json ] ; then + cp infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json logs/infra/generated fi - make -C infrastructure/quick-deploy/localhost/all/ state-pull > logs/infra/tfstates/armonik-terraform.tfstate + make -C infrastructure/quick-deploy/localhost/all-in-one/ state-pull > logs/infra/tfstates/armonik-terraform.tfstate sudo cp -rL /var/log/pods/armonik_* logs/app sudo chown $USER -R logs tar -czf admin-gui.tar.gz logs @@ -89,7 +89,7 @@ jobs: - name: Destroy deployment uses: aneoconsulting/ArmoniK.Action.Deploy/destroy@main with: - type: localhost + type: localhost coreStream: runs-on: ubuntu-latest @@ -125,7 +125,7 @@ jobs: shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e Partition="stream" \ @@ -138,10 +138,10 @@ jobs: core-stream/infra/tfstates \ core-stream/app - if [ -e infrastructure/quick-deploy/localhost/all/generated/armonik-output.json ] ; then - cp infrastructure/quick-deploy/localhost/all/generated/armonik-output.json core-stream/infra/generated + if [ -e infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json ] ; then + cp infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json core-stream/infra/generated fi - make -C infrastructure/quick-deploy/localhost/all/ state-pull > core-stream/infra/tfstates/armonik-terraform.tfstate + make -C infrastructure/quick-deploy/localhost/all-in-one/ state-pull > core-stream/infra/tfstates/armonik-terraform.tfstate sudo cp -rL /var/log/pods/armonik_* core-stream/app sudo chown $USER -R core-stream tar -czf core-stream.tar.gz core-stream @@ -180,7 +180,7 @@ jobs: docker: true terraform: true k3s: true - aws: true + aws: true - name: Deploy uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main with: @@ -189,7 +189,7 @@ jobs: shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e HtcMock__NTasks=2000 \ @@ -201,12 +201,12 @@ jobs: -e HtcMock__EnableSmallOutput=false \ -e HtcMock__EnableFastCompute=false \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:${{ steps.core.outputs.tag }} + dockerhubaneo/armonik_core_htcmock_test_client:${{ steps.core.outputs.tag }} - name: Test HTC Mock - 1 level shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e HtcMock__NTasks=1000 \ @@ -223,7 +223,7 @@ jobs: shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e HtcMock__NTasks=1000 \ @@ -240,7 +240,7 @@ jobs: shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e HtcMock__NTasks=1000 \ @@ -261,10 +261,10 @@ jobs: htcmock/infra/tfstates \ htcmock/app - if [ -e infrastructure/quick-deploy/localhost/all/generated/armonik-output.json ] ; then - cp infrastructure/quick-deploy/localhost/all/generated/armonik-output.json htcmock/infra/generated + if [ -e infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json ] ; then + cp infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json htcmock/infra/generated fi - make -C infrastructure/quick-deploy/localhost/all/ state-pull > htcmock/infra/tfstates/armonik-terraform.tfstate + make -C infrastructure/quick-deploy/localhost/all-in-one/ state-pull > htcmock/infra/tfstates/armonik-terraform.tfstate sudo cp -rL /var/log/pods/armonik_* htcmock/app sudo chown $USER -R htcmock tar -czf htcmock.tar.gz htcmock @@ -305,16 +305,16 @@ jobs: docker: true terraform: true k3s: true - aws: true + aws: true - name: Deploy uses: aneoconsulting/ArmoniK.Action.Deploy/deploy@main with: - type: localhost + type: localhost - name: Test Bench - many tasks (200) shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e BenchOptions__NTasks=200 \ @@ -325,7 +325,7 @@ jobs: shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e BenchOptions__NTasks=2 \ @@ -336,7 +336,7 @@ jobs: shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e BenchOptions__NTasks=10 \ @@ -349,7 +349,7 @@ jobs: shell: bash run: | set -ex - export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + export CONTROL_PLANE_URL=$(cat infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ -e BenchOptions__NTasks=10 \ @@ -366,10 +366,10 @@ jobs: bench/infra/tfstates \ bench/app - if [ -e infrastructure/quick-deploy/localhost/all/generated/armonik-output.json ] ; then - cp infrastructure/quick-deploy/localhost/all/generated/armonik-output.json bench/infra/generated + if [ -e infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json ] ; then + cp infrastructure/quick-deploy/localhost/all-in-one/generated/armonik-output.json bench/infra/generated fi - make -C infrastructure/quick-deploy/localhost/all/ state-pull > bench/infra/tfstates/armonik-terraform.tfstate + make -C infrastructure/quick-deploy/localhost/all-in-one/ state-pull > bench/infra/tfstates/armonik-terraform.tfstate sudo cp -rL /var/log/pods/armonik_* bench/app sudo chown $USER -R bench tar -czf bench.tar.gz bench diff --git a/CHANGELOG.md b/CHANGELOG.md index d8d1b6148..33f9239af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Changed * Upgrade version of SeqCli from `2023.1` to `2023.2` * Upgrade version of Admin GUI from `0.9.1` to `0.9.2`. * Upgrade version of MinIO from `RELEASE.2023-02-10T18-48-39Z` to `RELEASE.2023-07-18T17-49-40Z`. +* Upgrade version of infrastructure from `0.0.2` to `1.0.0`. ## [v2.14.0](https://github.com/aneoconsulting/armonik/tree/v2.14.0) (2023-07-05) diff --git a/armonik-versions.txt b/armonik-versions.txt index 8e5996d4a..fcdf246be 100644 --- a/armonik-versions.txt +++ b/armonik-versions.txt @@ -1,4 +1,4 @@ -infra=0.0.2 +infra=1.0.0 core=0.14.3 worker=0.12.1 admin-gui=0.9.2 diff --git a/infrastructure/quick-deploy/localhost/all/Makefile b/infrastructure/quick-deploy/localhost/all-in-one/Makefile similarity index 95% rename from infrastructure/quick-deploy/localhost/all/Makefile rename to infrastructure/quick-deploy/localhost/all-in-one/Makefile index c5878cfc3..9e58a9466 100644 --- a/infrastructure/quick-deploy/localhost/all/Makefile +++ b/infrastructure/quick-deploy/localhost/all-in-one/Makefile @@ -11,6 +11,7 @@ MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') export KUBE_CONFIG_PATH?=$(HOME)/.kube/config export TF_DATA_DIR?=$(GENERATED_DIR) +export TF_PLUGIN_CACHE_DIR?=$(GENERATED_DIR)/terraform-plugins export NAMESPACE?=armonik export PREFIX?=armonik-local export TF_VAR_namespace?=$(NAMESPACE) @@ -26,6 +27,7 @@ env: @set init: + mkdir -p $(TF_PLUGIN_CACHE_DIR) mkdir -p $(GENERATED_DIR) terraform init -upgrade -reconfigure -backend-config="secret_suffix=$(PREFIX)" -var-file=$(VERSIONS_FILE) -var-file=$(PARAMETERS_FILE) -var-file=$(EXTRA_PARAMETERS_FILE) diff --git a/infrastructure/quick-deploy/localhost/all/armonik.tf b/infrastructure/quick-deploy/localhost/all-in-one/armonik.tf similarity index 92% rename from infrastructure/quick-deploy/localhost/all/armonik.tf rename to infrastructure/quick-deploy/localhost/all-in-one/armonik.tf index 51ae58279..6ed0c464d 100644 --- a/infrastructure/quick-deploy/localhost/all/armonik.tf +++ b/infrastructure/quick-deploy/localhost/all-in-one/armonik.tf @@ -1,11 +1,8 @@ module "armonik" { - source = "./generated/infra-modules/armonik" - working_dir = "${path.root}/../../.." - namespace = local.namespace - logging_level = var.logging_level - storage_endpoint_url = local.storage_endpoint_url - monitoring = local.monitoring - extra_conf = var.extra_conf + source = "./generated/infra-modules/armonik" + namespace = local.namespace + logging_level = var.logging_level + extra_conf = var.extra_conf // To avoid the "known after apply" behavior that arises from using depends_on, we are using a ternary expression to impose implicit dependencies on the below secrets. fluent_bit_secret_name = kubernetes_secret.fluent_bit.id != null ? kubernetes_secret.fluent_bit.metadata[0].name : kubernetes_secret.fluent_bit.metadata[0].name diff --git a/infrastructure/quick-deploy/localhost/all/backend.tf b/infrastructure/quick-deploy/localhost/all-in-one/backend.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/all/backend.tf rename to infrastructure/quick-deploy/localhost/all-in-one/backend.tf diff --git a/infrastructure/quick-deploy/localhost/all/common.tf b/infrastructure/quick-deploy/localhost/all-in-one/common.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/all/common.tf rename to infrastructure/quick-deploy/localhost/all-in-one/common.tf diff --git a/infrastructure/quick-deploy/localhost/all/data/.keep b/infrastructure/quick-deploy/localhost/all-in-one/data/.keep similarity index 100% rename from infrastructure/quick-deploy/localhost/all/data/.keep rename to infrastructure/quick-deploy/localhost/all-in-one/data/.keep diff --git a/infrastructure/quick-deploy/localhost/all/images.tf b/infrastructure/quick-deploy/localhost/all-in-one/images.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/all/images.tf rename to infrastructure/quick-deploy/localhost/all-in-one/images.tf diff --git a/infrastructure/quick-deploy/localhost/all/keda.tf b/infrastructure/quick-deploy/localhost/all-in-one/keda.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/all/keda.tf rename to infrastructure/quick-deploy/localhost/all-in-one/keda.tf diff --git a/infrastructure/quick-deploy/localhost/all/metrics-server.tf b/infrastructure/quick-deploy/localhost/all-in-one/metrics-server.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/all/metrics-server.tf rename to infrastructure/quick-deploy/localhost/all-in-one/metrics-server.tf diff --git a/infrastructure/quick-deploy/localhost/all/monitoring.tf b/infrastructure/quick-deploy/localhost/all-in-one/monitoring.tf similarity index 87% rename from infrastructure/quick-deploy/localhost/all/monitoring.tf rename to infrastructure/quick-deploy/localhost/all-in-one/monitoring.tf index 9d77d4480..2c0582ee0 100644 --- a/infrastructure/quick-deploy/localhost/all/monitoring.tf +++ b/infrastructure/quick-deploy/localhost/all-in-one/monitoring.tf @@ -16,7 +16,6 @@ module "seq" { tag = try(coalesce(var.seq.cli_image_tag), local.default_tags[var.seq.cli_image_name]) image_pull_secrets = var.seq.cli_pull_secrets } - working_dir = "${path.root}/../../.." authentication = var.seq.authentication system_ram_target = var.seq.system_ram_target retention_in_days = var.seq.retention_in_days @@ -53,23 +52,20 @@ module "node_exporter" { tag = try(coalesce(var.node_exporter.image_tag), local.default_tags[var.node_exporter.image_name]) image_pull_secrets = var.node_exporter.pull_secrets } - working_dir = "${path.root}/../../../.." } # Metrics exporter module "metrics_exporter" { - source = "./generated/infra-modules/monitoring/onpremise/exporters/metrics-exporter" - namespace = local.namespace - service_type = var.metrics_exporter.service_type - node_selector = var.metrics_exporter.node_selector - storage_endpoint_url = local.storage_endpoint_url + source = "./generated/infra-modules/monitoring/onpremise/exporters/metrics-exporter" + namespace = local.namespace + service_type = var.metrics_exporter.service_type + node_selector = var.metrics_exporter.node_selector docker_image = { image = var.metrics_exporter.image_name tag = try(coalesce(var.metrics_exporter.image_tag), local.default_tags[var.metrics_exporter.image_name]) image_pull_secrets = var.metrics_exporter.pull_secrets } - extra_conf = var.metrics_exporter.extra_conf - working_dir = "${path.root}/../../.." + extra_conf = var.metrics_exporter.extra_conf } resource "kubernetes_secret" "metrics_exporter" { @@ -93,16 +89,14 @@ module "partition_metrics_exporter" { namespace = local.namespace service_type = var.partition_metrics_exporter.service_type node_selector = var.partition_metrics_exporter.node_selector - storage_endpoint_url = local.storage_endpoint_url metrics_exporter_url = "${module.metrics_exporter.host}:${module.metrics_exporter.port}" docker_image = { image = var.partition_metrics_exporter.image_name tag = try(coalesce(var.partition_metrics_exporter.image_tag), local.default_tags[var.partition_metrics_exporter.image_name]) image_pull_secrets = var.partition_metrics_exporter.pull_secrets } - extra_conf = var.partition_metrics_exporter.extra_conf - working_dir = "${path.root}/../../.." - depends_on = [module.metrics_exporter] + extra_conf = var.partition_metrics_exporter.extra_conf + depends_on = [module.metrics_exporter] } resource "kubernetes_secret" "partition_metrics_exporter" { @@ -127,18 +121,16 @@ resource "kubernetes_secret" "partition_metrics_exporter" { # Prometheus module "prometheus" { - source = "./generated/infra-modules/monitoring/onpremise/prometheus" - namespace = local.namespace - service_type = var.prometheus.service_type - node_selector = var.prometheus.node_selector - metrics_exporter_url = "${module.metrics_exporter.host}:${module.metrics_exporter.port}" - partition_metrics_exporter_url = length(module.partition_metrics_exporter) == 1 ? "${module.partition_metrics_exporter[0].host}:${module.partition_metrics_exporter[0].port}" : null + source = "./generated/infra-modules/monitoring/onpremise/prometheus" + namespace = local.namespace + service_type = var.prometheus.service_type + node_selector = var.prometheus.node_selector + metrics_exporter_url = "${module.metrics_exporter.host}:${module.metrics_exporter.port}" docker_image = { image = var.prometheus.image_name tag = try(coalesce(var.prometheus.image_tag), local.default_tags[var.prometheus.image_name]) image_pull_secrets = var.prometheus.pull_secrets } - working_dir = "${path.root}/../../.." } resource "kubernetes_secret" "prometheus" { @@ -167,7 +159,6 @@ module "grafana" { tag = try(coalesce(var.grafana.image_tag), local.default_tags[var.grafana.image_name]) image_pull_secrets = var.grafana.pull_secrets } - working_dir = "${path.root}/../../.." authentication = var.grafana.authentication } diff --git a/infrastructure/quick-deploy/localhost/all/outputs.tf b/infrastructure/quick-deploy/localhost/all-in-one/outputs.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/all/outputs.tf rename to infrastructure/quick-deploy/localhost/all-in-one/outputs.tf diff --git a/infrastructure/quick-deploy/localhost/all/parameters.tfvars b/infrastructure/quick-deploy/localhost/all-in-one/parameters.tfvars similarity index 100% rename from infrastructure/quick-deploy/localhost/all/parameters.tfvars rename to infrastructure/quick-deploy/localhost/all-in-one/parameters.tfvars diff --git a/infrastructure/quick-deploy/localhost/all-in-one/providers.tf b/infrastructure/quick-deploy/localhost/all-in-one/providers.tf new file mode 100644 index 000000000..19329fcf3 --- /dev/null +++ b/infrastructure/quick-deploy/localhost/all-in-one/providers.tf @@ -0,0 +1,13 @@ +provider "kubernetes" { + config_path = var.k8s_config_path + config_context = var.k8s_config_context +} + +# package manager for kubernetes +provider "helm" { + helm_driver = "configmap" + kubernetes { + config_path = var.k8s_config_path + config_context = var.k8s_config_context + } +} diff --git a/infrastructure/quick-deploy/localhost/all/storage.tf b/infrastructure/quick-deploy/localhost/all-in-one/storage.tf similarity index 92% rename from infrastructure/quick-deploy/localhost/all/storage.tf rename to infrastructure/quick-deploy/localhost/all-in-one/storage.tf index 4a9072c0a..477c17c72 100644 --- a/infrastructure/quick-deploy/localhost/all/storage.tf +++ b/infrastructure/quick-deploy/localhost/all-in-one/storage.tf @@ -1,8 +1,7 @@ # ActiveMQ module "activemq" { - source = "./generated/infra-modules/storage/onpremise/activemq" - namespace = local.namespace - working_dir = "${path.root}/../../.." + source = "./generated/infra-modules/storage/onpremise/activemq" + namespace = local.namespace activemq = { image = var.activemq.image_name tag = try(coalesce(var.activemq.image_tag), local.default_tags[var.activemq.image_name]) @@ -13,9 +12,8 @@ module "activemq" { # MongoDB module "mongodb" { - source = "./generated/infra-modules/storage/onpremise/mongodb" - namespace = local.namespace - working_dir = "${path.root}/../../.." + source = "./generated/infra-modules/storage/onpremise/mongodb" + namespace = local.namespace mongodb = { image = var.mongodb.image_name tag = try(coalesce(var.mongodb.image_tag), local.default_tags[var.mongodb.image_name]) @@ -28,10 +26,9 @@ module "mongodb" { # Redis module "redis" { - count = var.redis != null ? 1 : 0 - source = "./generated/infra-modules/storage/onpremise/redis" - namespace = local.namespace - working_dir = "${path.root}/../../.." + count = var.redis != null ? 1 : 0 + source = "./generated/infra-modules/storage/onpremise/redis" + namespace = local.namespace redis = { image = var.redis.image_name tag = try(coalesce(var.redis.image_tag), local.default_tags[var.redis.image_name]) diff --git a/infrastructure/quick-deploy/localhost/all/variables.tf b/infrastructure/quick-deploy/localhost/all-in-one/variables.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/all/variables.tf rename to infrastructure/quick-deploy/localhost/all-in-one/variables.tf diff --git a/infrastructure/quick-deploy/localhost/all/versions.tf b/infrastructure/quick-deploy/localhost/all-in-one/versions.tf similarity index 86% rename from infrastructure/quick-deploy/localhost/all/versions.tf rename to infrastructure/quick-deploy/localhost/all-in-one/versions.tf index 2753675a4..fedf46447 100644 --- a/infrastructure/quick-deploy/localhost/all/versions.tf +++ b/infrastructure/quick-deploy/localhost/all-in-one/versions.tf @@ -6,15 +6,15 @@ terraform { } local = { source = "hashicorp/local" - version = "~> 2.2.0" + version = "~> 2.4.0" } random = { source = "hashicorp/random" - version = "~> 3.4.3" + version = "~> 3.5.1" } kubernetes = { source = "hashicorp/kubernetes" - version = "~> 2.13.0" + version = "~> 2.21.1" } kubectl = { source = "gavinbunney/kubectl" diff --git a/infrastructure/quick-deploy/localhost/all/providers.tf b/infrastructure/quick-deploy/localhost/all/providers.tf deleted file mode 100644 index 27aa8239b..000000000 --- a/infrastructure/quick-deploy/localhost/all/providers.tf +++ /dev/null @@ -1,19 +0,0 @@ -# K8s configuration -data "external" "k8s_config_context" { - program = ["bash", "k8s_config.sh", var.k8s_config_path] - working_dir = ".${path.root}/../../utils/scripts" -} - -provider "kubernetes" { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) -} - -# package manager for kubernetes -provider "helm" { - helm_driver = "configmap" - kubernetes { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) - } -} diff --git a/infrastructure/quick-deploy/localhost/armonik/providers.tf b/infrastructure/quick-deploy/localhost/armonik/providers.tf deleted file mode 100644 index 27aa8239b..000000000 --- a/infrastructure/quick-deploy/localhost/armonik/providers.tf +++ /dev/null @@ -1,19 +0,0 @@ -# K8s configuration -data "external" "k8s_config_context" { - program = ["bash", "k8s_config.sh", var.k8s_config_path] - working_dir = ".${path.root}/../../utils/scripts" -} - -provider "kubernetes" { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) -} - -# package manager for kubernetes -provider "helm" { - helm_driver = "configmap" - kubernetes { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) - } -} diff --git a/infrastructure/quick-deploy/localhost/keda/providers.tf b/infrastructure/quick-deploy/localhost/keda/providers.tf deleted file mode 100644 index 882c7d3ce..000000000 --- a/infrastructure/quick-deploy/localhost/keda/providers.tf +++ /dev/null @@ -1,19 +0,0 @@ -# K8s configuration -data "external" "k8s_config_context" { - program = ["bash", "k8s_config.sh", var.k8s_config_path] - working_dir = ".${path.root}/../../utils/scripts" -} - -provider "kubernetes" { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) -} - -# package manager for kubernetes -provider "helm" { - helm_driver = "configmap" - kubernetes { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/localhost/metrics-server/providers.tf b/infrastructure/quick-deploy/localhost/metrics-server/providers.tf deleted file mode 100644 index 882c7d3ce..000000000 --- a/infrastructure/quick-deploy/localhost/metrics-server/providers.tf +++ /dev/null @@ -1,19 +0,0 @@ -# K8s configuration -data "external" "k8s_config_context" { - program = ["bash", "k8s_config.sh", var.k8s_config_path] - working_dir = ".${path.root}/../../utils/scripts" -} - -provider "kubernetes" { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) -} - -# package manager for kubernetes -provider "helm" { - helm_driver = "configmap" - kubernetes { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/localhost/monitoring/providers.tf b/infrastructure/quick-deploy/localhost/monitoring/providers.tf deleted file mode 100644 index 882c7d3ce..000000000 --- a/infrastructure/quick-deploy/localhost/monitoring/providers.tf +++ /dev/null @@ -1,19 +0,0 @@ -# K8s configuration -data "external" "k8s_config_context" { - program = ["bash", "k8s_config.sh", var.k8s_config_path] - working_dir = ".${path.root}/../../utils/scripts" -} - -provider "kubernetes" { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) -} - -# package manager for kubernetes -provider "helm" { - helm_driver = "configmap" - kubernetes { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/localhost/Makefile b/infrastructure/quick-deploy/localhost/multi-stages/Makefile similarity index 90% rename from infrastructure/quick-deploy/localhost/Makefile rename to infrastructure/quick-deploy/localhost/multi-stages/Makefile index c06345d0c..15fb80d98 100644 --- a/infrastructure/quick-deploy/localhost/Makefile +++ b/infrastructure/quick-deploy/localhost/multi-stages/Makefile @@ -10,7 +10,8 @@ export METRICS_SERVER=$(shell kubectl get deploy -A -l k8s-app=metrics-server -- CURRENT_DIR=$(shell pwd) GENERATED_DIR=$(CURRENT_DIR)/generated MODULES_DIR=$(GENERATED_DIR)/infra-modules -VERSIONS_FILE?=$(shell realpath ../../../versions.tfvars.json) +TERRAFORM_PLUGINS?=$(GENERATED_DIR)/terraform-plugins +VERSIONS_FILE?=$(shell realpath ../../../../versions.tfvars.json) #################################### # Kubernetes namespace # @@ -35,6 +36,7 @@ deploy-keda: $(MAKE) -C $(CURRENT_DIR)/keda deploy \ NAMESPACE=$(KEDA_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE);\ fi @@ -42,6 +44,7 @@ destroy-keda: $(MAKE) -C $(CURRENT_DIR)/keda destroy \ NAMESPACE=$(KEDA_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) clean-keda: @@ -56,6 +59,7 @@ deploy-metrics-server: $(MAKE) -C $(CURRENT_DIR)/metrics-server deploy \ NAMESPACE=$(METRICS_SERVER_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE);\ fi @@ -63,6 +67,7 @@ destroy-metrics-server: $(MAKE) -C $(CURRENT_DIR)/metrics-server destroy \ NAMESPACE=$(METRICS_SERVER_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) clean-metrics-server: @@ -79,6 +84,7 @@ deploy-storage: FILE_STORAGE_FILE=$(ARMONIK_FILE_STORAGE_FILE) \ FILE_SERVER_IP=$(ARMONIK_FILE_SERVER_IP) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) destroy-storage: @@ -88,6 +94,7 @@ destroy-storage: FILE_STORAGE_FILE=$(ARMONIK_FILE_STORAGE_FILE) \ FILE_SERVER_IP=$(ARMONIK_FILE_SERVER_IP) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) clean-storage: @@ -101,12 +108,14 @@ deploy-monitoring: $(MAKE) -C $(CURRENT_DIR)/monitoring deploy \ NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) destroy-monitoring: $(MAKE) -C $(CURRENT_DIR)/monitoring destroy \ NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) clean-monitoring: @@ -120,12 +129,14 @@ deploy-armonik: $(MAKE) -C $(CURRENT_DIR)/armonik deploy \ NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) destroy-armonik: $(MAKE) -C $(CURRENT_DIR)/armonik destroy \ NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ MODULES_DIR=$(MODULES_DIR) \ + TERRAFORM_PLUGINS=$(TERRAFORM_PLUGINS) \ VERSIONS_FILE=$(VERSIONS_FILE) clean-armonik: diff --git a/infrastructure/quick-deploy/localhost/armonik/Makefile b/infrastructure/quick-deploy/localhost/multi-stages/armonik/Makefile similarity index 95% rename from infrastructure/quick-deploy/localhost/armonik/Makefile rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/Makefile index 0d5741e58..06c017808 100644 --- a/infrastructure/quick-deploy/localhost/armonik/Makefile +++ b/infrastructure/quick-deploy/localhost/multi-stages/armonik/Makefile @@ -10,6 +10,7 @@ MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') export KUBE_CONFIG_PATH?=$(HOME)/.kube/config export TF_DATA_DIR?=$(GENERATED_DIR) +export TF_PLUGIN_CACHE_DIR?=$(TERRAFORM_PLUGINS) export NAMESPACE?=armonik .PHONY: apply destroy @@ -19,6 +20,7 @@ deploy: get-modules init apply output destroy: init delete init: + mkdir -p $(TF_PLUGIN_CACHE_DIR) mkdir -p $(GENERATED_DIR) terraform init -upgrade -reconfigure \ -backend-config="secret_suffix=armonik-$(BACKEND_SUFFIX)" \ diff --git a/infrastructure/quick-deploy/localhost/armonik/backend.tf b/infrastructure/quick-deploy/localhost/multi-stages/armonik/backend.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/armonik/backend.tf rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/backend.tf diff --git a/infrastructure/quick-deploy/localhost/armonik/locals.tf b/infrastructure/quick-deploy/localhost/multi-stages/armonik/locals.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/armonik/locals.tf rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/locals.tf diff --git a/infrastructure/quick-deploy/localhost/armonik/main.tf b/infrastructure/quick-deploy/localhost/multi-stages/armonik/main.tf similarity index 76% rename from infrastructure/quick-deploy/localhost/armonik/main.tf rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/main.tf index 840052853..0655de101 100644 --- a/infrastructure/quick-deploy/localhost/armonik/main.tf +++ b/infrastructure/quick-deploy/localhost/multi-stages/armonik/main.tf @@ -1,10 +1,7 @@ module "armonik" { - source = "../generated/infra-modules/armonik" - working_dir = "${path.root}/../../.." - namespace = var.namespace - logging_level = var.logging_level - storage_endpoint_url = var.storage_endpoint_url - monitoring = var.monitoring + source = "../generated/infra-modules/armonik" + namespace = var.namespace + logging_level = var.logging_level extra_conf = { compute = try(var.extra_conf.compute, {}) control = try(var.extra_conf.control, {}) diff --git a/infrastructure/quick-deploy/localhost/armonik/outputs.tf b/infrastructure/quick-deploy/localhost/multi-stages/armonik/outputs.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/armonik/outputs.tf rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/outputs.tf diff --git a/infrastructure/quick-deploy/localhost/armonik/parameters.tfvars b/infrastructure/quick-deploy/localhost/multi-stages/armonik/parameters.tfvars similarity index 100% rename from infrastructure/quick-deploy/localhost/armonik/parameters.tfvars rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/parameters.tfvars diff --git a/infrastructure/quick-deploy/localhost/multi-stages/armonik/providers.tf b/infrastructure/quick-deploy/localhost/multi-stages/armonik/providers.tf new file mode 100644 index 000000000..19329fcf3 --- /dev/null +++ b/infrastructure/quick-deploy/localhost/multi-stages/armonik/providers.tf @@ -0,0 +1,13 @@ +provider "kubernetes" { + config_path = var.k8s_config_path + config_context = var.k8s_config_context +} + +# package manager for kubernetes +provider "helm" { + helm_driver = "configmap" + kubernetes { + config_path = var.k8s_config_path + config_context = var.k8s_config_context + } +} diff --git a/infrastructure/quick-deploy/localhost/armonik/variables.tf b/infrastructure/quick-deploy/localhost/multi-stages/armonik/variables.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/armonik/variables.tf rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/variables.tf diff --git a/infrastructure/quick-deploy/localhost/armonik/versions.tf b/infrastructure/quick-deploy/localhost/multi-stages/armonik/versions.tf similarity index 91% rename from infrastructure/quick-deploy/localhost/armonik/versions.tf rename to infrastructure/quick-deploy/localhost/multi-stages/armonik/versions.tf index dce13114c..efd3fe55b 100644 --- a/infrastructure/quick-deploy/localhost/armonik/versions.tf +++ b/infrastructure/quick-deploy/localhost/multi-stages/armonik/versions.tf @@ -6,7 +6,7 @@ terraform { } kubernetes = { source = "hashicorp/kubernetes" - version = "~> 2.13.0" + version = "~> 2.21.1" } external = { source = "hashicorp/external" @@ -18,7 +18,7 @@ terraform { } random = { source = "hashicorp/random" - version = "~> 3.4.3" + version = "~> 3.5.1" } local = { source = "hashicorp/local" diff --git a/infrastructure/quick-deploy/localhost/envvars.sh b/infrastructure/quick-deploy/localhost/multi-stages/envvars.sh similarity index 100% rename from infrastructure/quick-deploy/localhost/envvars.sh rename to infrastructure/quick-deploy/localhost/multi-stages/envvars.sh diff --git a/infrastructure/quick-deploy/localhost/images/seq.png b/infrastructure/quick-deploy/localhost/multi-stages/images/seq.png similarity index 100% rename from infrastructure/quick-deploy/localhost/images/seq.png rename to infrastructure/quick-deploy/localhost/multi-stages/images/seq.png diff --git a/infrastructure/quick-deploy/localhost/images/seq_auth.png b/infrastructure/quick-deploy/localhost/multi-stages/images/seq_auth.png similarity index 100% rename from infrastructure/quick-deploy/localhost/images/seq_auth.png rename to infrastructure/quick-deploy/localhost/multi-stages/images/seq_auth.png diff --git a/infrastructure/quick-deploy/localhost/keda/Makefile b/infrastructure/quick-deploy/localhost/multi-stages/keda/Makefile similarity index 95% rename from infrastructure/quick-deploy/localhost/keda/Makefile rename to infrastructure/quick-deploy/localhost/multi-stages/keda/Makefile index 658a40168..964ea0e9d 100644 --- a/infrastructure/quick-deploy/localhost/keda/Makefile +++ b/infrastructure/quick-deploy/localhost/multi-stages/keda/Makefile @@ -10,6 +10,7 @@ MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') export KUBE_CONFIG_PATH?=$(HOME)/.kube/config export TF_DATA_DIR?=$(GENERATED_DIR) +export TF_PLUGIN_CACHE_DIR?=$(TERRAFORM_PLUGINS) export NAMESPACE?=default .PHONY: apply destroy @@ -19,6 +20,7 @@ deploy: get-modules init apply output destroy: init delete init: + mkdir -p $(TF_PLUGIN_CACHE_DIR) mkdir -p $(GENERATED_DIR) terraform init -upgrade -reconfigure \ -backend-config="secret_suffix=keda-$(BACKEND_SUFFIX)" \ diff --git a/infrastructure/quick-deploy/localhost/keda/backend.tf b/infrastructure/quick-deploy/localhost/multi-stages/keda/backend.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/keda/backend.tf rename to infrastructure/quick-deploy/localhost/multi-stages/keda/backend.tf diff --git a/infrastructure/quick-deploy/localhost/keda/locals.tf b/infrastructure/quick-deploy/localhost/multi-stages/keda/locals.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/keda/locals.tf rename to infrastructure/quick-deploy/localhost/multi-stages/keda/locals.tf diff --git a/infrastructure/quick-deploy/localhost/keda/main.tf b/infrastructure/quick-deploy/localhost/multi-stages/keda/main.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/keda/main.tf rename to infrastructure/quick-deploy/localhost/multi-stages/keda/main.tf diff --git a/infrastructure/quick-deploy/localhost/keda/outputs.tf b/infrastructure/quick-deploy/localhost/multi-stages/keda/outputs.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/keda/outputs.tf rename to infrastructure/quick-deploy/localhost/multi-stages/keda/outputs.tf diff --git a/infrastructure/quick-deploy/localhost/keda/parameters.tfvars b/infrastructure/quick-deploy/localhost/multi-stages/keda/parameters.tfvars similarity index 100% rename from infrastructure/quick-deploy/localhost/keda/parameters.tfvars rename to infrastructure/quick-deploy/localhost/multi-stages/keda/parameters.tfvars diff --git a/infrastructure/quick-deploy/localhost/multi-stages/keda/providers.tf b/infrastructure/quick-deploy/localhost/multi-stages/keda/providers.tf new file mode 100644 index 000000000..1fe752fa8 --- /dev/null +++ b/infrastructure/quick-deploy/localhost/multi-stages/keda/providers.tf @@ -0,0 +1,13 @@ +provider "kubernetes" { + config_path = var.k8s_config_path + config_context = var.k8s_config_context +} + +# package manager for kubernetes +provider "helm" { + helm_driver = "configmap" + kubernetes { + config_path = var.k8s_config_path + config_context = var.k8s_config_context + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/localhost/keda/variables.tf b/infrastructure/quick-deploy/localhost/multi-stages/keda/variables.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/keda/variables.tf rename to infrastructure/quick-deploy/localhost/multi-stages/keda/variables.tf diff --git a/infrastructure/quick-deploy/localhost/keda/versions.tf b/infrastructure/quick-deploy/localhost/multi-stages/keda/versions.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/keda/versions.tf rename to infrastructure/quick-deploy/localhost/multi-stages/keda/versions.tf diff --git a/infrastructure/quick-deploy/localhost/metrics-server/Makefile b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/Makefile similarity index 95% rename from infrastructure/quick-deploy/localhost/metrics-server/Makefile rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/Makefile index d434c1b9e..363e32958 100644 --- a/infrastructure/quick-deploy/localhost/metrics-server/Makefile +++ b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/Makefile @@ -10,6 +10,7 @@ MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') export KUBE_CONFIG_PATH?=$(HOME)/.kube/config export TF_DATA_DIR?=$(GENERATED_DIR) +export TF_PLUGIN_CACHE_DIR?=$(TERRAFORM_PLUGINS) export NAMESPACE?=kube-system .PHONY: apply destroy @@ -19,6 +20,7 @@ deploy: get-modules init apply output destroy: init delete init: + mkdir -p $(TF_PLUGIN_CACHE_DIR) mkdir -p $(GENERATED_DIR) terraform init -upgrade -reconfigure \ -backend-config="secret_suffix=metrics-server-$(BACKEND_SUFFIX)" \ diff --git a/infrastructure/quick-deploy/localhost/metrics-server/backend.tf b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/backend.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/metrics-server/backend.tf rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/backend.tf diff --git a/infrastructure/quick-deploy/localhost/metrics-server/locals.tf b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/locals.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/metrics-server/locals.tf rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/locals.tf diff --git a/infrastructure/quick-deploy/localhost/metrics-server/main.tf b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/main.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/metrics-server/main.tf rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/main.tf diff --git a/infrastructure/quick-deploy/localhost/metrics-server/outputs.tf b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/outputs.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/metrics-server/outputs.tf rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/outputs.tf diff --git a/infrastructure/quick-deploy/localhost/metrics-server/parameters.tfvars b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/parameters.tfvars similarity index 100% rename from infrastructure/quick-deploy/localhost/metrics-server/parameters.tfvars rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/parameters.tfvars diff --git a/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/providers.tf b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/providers.tf new file mode 100644 index 000000000..1fe752fa8 --- /dev/null +++ b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/providers.tf @@ -0,0 +1,13 @@ +provider "kubernetes" { + config_path = var.k8s_config_path + config_context = var.k8s_config_context +} + +# package manager for kubernetes +provider "helm" { + helm_driver = "configmap" + kubernetes { + config_path = var.k8s_config_path + config_context = var.k8s_config_context + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/localhost/metrics-server/variables.tf b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/variables.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/metrics-server/variables.tf rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/variables.tf diff --git a/infrastructure/quick-deploy/localhost/metrics-server/versions.tf b/infrastructure/quick-deploy/localhost/multi-stages/metrics-server/versions.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/metrics-server/versions.tf rename to infrastructure/quick-deploy/localhost/multi-stages/metrics-server/versions.tf diff --git a/infrastructure/quick-deploy/localhost/monitoring/Makefile b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/Makefile similarity index 95% rename from infrastructure/quick-deploy/localhost/monitoring/Makefile rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/Makefile index 847126b97..2550fea9a 100644 --- a/infrastructure/quick-deploy/localhost/monitoring/Makefile +++ b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/Makefile @@ -10,6 +10,7 @@ MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') export KUBE_CONFIG_PATH?=$(HOME)/.kube/config export TF_DATA_DIR?=$(GENERATED_DIR) +export TF_PLUGIN_CACHE_DIR?=$(TERRAFORM_PLUGINS) export NAMESPACE?=armonik .PHONY: apply destroy @@ -19,6 +20,7 @@ deploy: get-modules init apply output destroy: init delete init: + mkdir -p $(TF_PLUGIN_CACHE_DIR) mkdir -p $(GENERATED_DIR) terraform init -upgrade -reconfigure \ -backend-config="secret_suffix=monitoring-$(BACKEND_SUFFIX)" \ diff --git a/infrastructure/quick-deploy/localhost/monitoring/backend.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/backend.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/monitoring/backend.tf rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/backend.tf diff --git a/infrastructure/quick-deploy/localhost/monitoring/locals.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/locals.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/monitoring/locals.tf rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/locals.tf diff --git a/infrastructure/quick-deploy/localhost/monitoring/main.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/main.tf similarity index 81% rename from infrastructure/quick-deploy/localhost/monitoring/main.tf rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/main.tf index 57989b99b..e24440676 100644 --- a/infrastructure/quick-deploy/localhost/monitoring/main.tf +++ b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/main.tf @@ -16,7 +16,6 @@ module "seq" { tag = local.cli_seq_tag image_pull_secrets = local.cli_seq_image_pull_secrets } - working_dir = "${path.root}/../../.." authentication = var.authentication system_ram_target = local.seq_system_ram_target retention_in_days = local.retention_in_days @@ -33,23 +32,20 @@ module "node_exporter" { tag = local.node_exporter_tag image_pull_secrets = local.node_exporter_image_pull_secrets } - working_dir = "${path.root}/../../../.." } # Metrics exporter module "metrics_exporter" { - source = "../generated/infra-modules/monitoring/onpremise/exporters/metrics-exporter" - namespace = var.namespace - service_type = local.metrics_exporter_service_type - node_selector = local.metrics_exporter_node_selector - storage_endpoint_url = var.storage_endpoint_url + source = "../generated/infra-modules/monitoring/onpremise/exporters/metrics-exporter" + namespace = var.namespace + service_type = local.metrics_exporter_service_type + node_selector = local.metrics_exporter_node_selector docker_image = { image = local.metrics_exporter_image tag = local.metrics_exporter_tag image_pull_secrets = local.metrics_exporter_image_pull_secrets } - extra_conf = local.metrics_exporter_extra_conf - working_dir = "${path.root}/../../.." + extra_conf = local.metrics_exporter_extra_conf } # Partition metrics exporter @@ -59,7 +55,6 @@ module "metrics_exporter" { # service_type = local.partition_metrics_exporter_service_type # node_selector = local.partition_metrics_exporter_node_selector # logging_level = var.logging_level -# storage_endpoint_url = var.storage_endpoint_url # metrics_exporter_url = "${module.metrics_exporter.host}:${module.metrics_exporter.port}" # docker_image = { # image = local.partition_metrics_exporter_image @@ -67,25 +62,22 @@ module "metrics_exporter" { # image_pull_secrets = local.partition_metrics_exporter_image_pull_secrets # } # extra_conf = local.partition_metrics_exporter_extra_conf -# working_dir = "${path.root}/../../.." # depends_on = [module.metrics_exporter] #} # Prometheus module "prometheus" { - source = "../generated/infra-modules/monitoring/onpremise/prometheus" - namespace = var.namespace - service_type = local.prometheus_service_type - node_selector = local.prometheus_node_selector - metrics_exporter_url = "${module.metrics_exporter.host}:${module.metrics_exporter.port}" - partition_metrics_exporter_url = null + source = "../generated/infra-modules/monitoring/onpremise/prometheus" + namespace = var.namespace + service_type = local.prometheus_service_type + node_selector = local.prometheus_node_selector + metrics_exporter_url = "${module.metrics_exporter.host}:${module.metrics_exporter.port}" #"${module.partition_metrics_exporter.host}:${module.partition_metrics_exporter.port}" docker_image = { image = local.prometheus_image tag = local.prometheus_tag image_pull_secrets = local.prometheus_image_pull_secrets } - working_dir = "${path.root}/../../.." depends_on = [ module.metrics_exporter, #module.partition_metrics_exporter @@ -106,7 +98,6 @@ module "grafana" { tag = local.grafana_tag image_pull_secrets = local.grafana_image_pull_secrets } - working_dir = "${path.root}/../../.." authentication = var.authentication depends_on = [module.prometheus] } diff --git a/infrastructure/quick-deploy/localhost/monitoring/outputs.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/outputs.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/monitoring/outputs.tf rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/outputs.tf diff --git a/infrastructure/quick-deploy/localhost/monitoring/parameters.tfvars b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/parameters.tfvars similarity index 100% rename from infrastructure/quick-deploy/localhost/monitoring/parameters.tfvars rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/parameters.tfvars diff --git a/infrastructure/quick-deploy/localhost/multi-stages/monitoring/providers.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/providers.tf new file mode 100644 index 000000000..1fe752fa8 --- /dev/null +++ b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/providers.tf @@ -0,0 +1,13 @@ +provider "kubernetes" { + config_path = var.k8s_config_path + config_context = var.k8s_config_context +} + +# package manager for kubernetes +provider "helm" { + helm_driver = "configmap" + kubernetes { + config_path = var.k8s_config_path + config_context = var.k8s_config_context + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/localhost/monitoring/secrets.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/secrets.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/monitoring/secrets.tf rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/secrets.tf diff --git a/infrastructure/quick-deploy/localhost/monitoring/variables.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/variables.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/monitoring/variables.tf rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/variables.tf diff --git a/infrastructure/quick-deploy/localhost/monitoring/versions.tf b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/versions.tf similarity index 84% rename from infrastructure/quick-deploy/localhost/monitoring/versions.tf rename to infrastructure/quick-deploy/localhost/multi-stages/monitoring/versions.tf index b8d685fd3..52c2c3c7e 100644 --- a/infrastructure/quick-deploy/localhost/monitoring/versions.tf +++ b/infrastructure/quick-deploy/localhost/multi-stages/monitoring/versions.tf @@ -2,7 +2,7 @@ terraform { required_providers { kubernetes = { source = "hashicorp/kubernetes" - version = "~> 2.13.0" + version = "~> 2.21.1" } external = { source = "hashicorp/external" @@ -14,11 +14,11 @@ terraform { } random = { source = "hashicorp/random" - version = "~> 3.4.3" + version = "~> 3.5.1" } local = { source = "hashicorp/local" - version = "~> 2.1.0" + version = "~> 2.4.0" } tls = { source = "hashicorp/tls" diff --git a/infrastructure/quick-deploy/localhost/storage/Makefile b/infrastructure/quick-deploy/localhost/multi-stages/storage/Makefile similarity index 96% rename from infrastructure/quick-deploy/localhost/storage/Makefile rename to infrastructure/quick-deploy/localhost/multi-stages/storage/Makefile index 0d0240779..d30e8036c 100644 --- a/infrastructure/quick-deploy/localhost/storage/Makefile +++ b/infrastructure/quick-deploy/localhost/multi-stages/storage/Makefile @@ -10,6 +10,7 @@ MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') export KUBE_CONFIG_PATH?=$(HOME)/.kube/config export TF_DATA_DIR?=$(GENERATED_DIR) +export TF_PLUGIN_CACHE_DIR?=$(TERRAFORM_PLUGINS) export NAMESPACE?=armonik export SHARED_HOST_PATH?=$(HOME)/data export FILE_STORAGE_FILE?=HostPath @@ -22,6 +23,7 @@ deploy: get-modules init apply output destroy: init delete init: + mkdir -p $(TF_PLUGIN_CACHE_DIR) mkdir -p $(GENERATED_DIR) terraform init -upgrade -reconfigure \ -backend-config="secret_suffix=storage-$(BACKEND_SUFFIX)" \ diff --git a/infrastructure/quick-deploy/localhost/storage/backend.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/backend.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/storage/backend.tf rename to infrastructure/quick-deploy/localhost/multi-stages/storage/backend.tf diff --git a/infrastructure/quick-deploy/localhost/storage/locals.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/locals.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/storage/locals.tf rename to infrastructure/quick-deploy/localhost/multi-stages/storage/locals.tf diff --git a/infrastructure/quick-deploy/localhost/storage/main.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/main.tf similarity index 80% rename from infrastructure/quick-deploy/localhost/storage/main.tf rename to infrastructure/quick-deploy/localhost/multi-stages/storage/main.tf index f1d6b63e5..683423a2f 100644 --- a/infrastructure/quick-deploy/localhost/storage/main.tf +++ b/infrastructure/quick-deploy/localhost/multi-stages/storage/main.tf @@ -1,8 +1,7 @@ # ActiveMQ module "activemq" { - source = "../generated/infra-modules/storage/onpremise/activemq" - namespace = var.namespace - working_dir = "${path.root}/../../.." + source = "../generated/infra-modules/storage/onpremise/activemq" + namespace = var.namespace activemq = { image = local.activemq_image tag = local.activemq_tag @@ -13,9 +12,8 @@ module "activemq" { # MongoDB module "mongodb" { - source = "../generated/infra-modules/storage/onpremise/mongodb" - namespace = var.namespace - working_dir = "${path.root}/../../.." + source = "../generated/infra-modules/storage/onpremise/mongodb" + namespace = var.namespace mongodb = { image = local.mongodb_image tag = local.mongodb_tag @@ -28,10 +26,9 @@ module "mongodb" { # Redis module "redis" { - count = var.redis != null ? 1 : 0 - source = "../generated/infra-modules/storage/onpremise/redis" - namespace = var.namespace - working_dir = "${path.root}/../../.." + count = var.redis != null ? 1 : 0 + source = "../generated/infra-modules/storage/onpremise/redis" + namespace = var.namespace redis = { image = local.redis_image tag = local.redis_tag diff --git a/infrastructure/quick-deploy/localhost/storage/outputs.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/outputs.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/storage/outputs.tf rename to infrastructure/quick-deploy/localhost/multi-stages/storage/outputs.tf diff --git a/infrastructure/quick-deploy/localhost/storage/parameters.tfvars b/infrastructure/quick-deploy/localhost/multi-stages/storage/parameters.tfvars similarity index 100% rename from infrastructure/quick-deploy/localhost/storage/parameters.tfvars rename to infrastructure/quick-deploy/localhost/multi-stages/storage/parameters.tfvars diff --git a/infrastructure/quick-deploy/localhost/multi-stages/storage/providers.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/providers.tf new file mode 100644 index 000000000..be42449b2 --- /dev/null +++ b/infrastructure/quick-deploy/localhost/multi-stages/storage/providers.tf @@ -0,0 +1,4 @@ +provider "kubernetes" { + config_path = var.k8s_config_path + config_context = var.k8s_config_context +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/localhost/storage/secrets.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/secrets.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/storage/secrets.tf rename to infrastructure/quick-deploy/localhost/multi-stages/storage/secrets.tf diff --git a/infrastructure/quick-deploy/localhost/storage/variables.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/variables.tf similarity index 100% rename from infrastructure/quick-deploy/localhost/storage/variables.tf rename to infrastructure/quick-deploy/localhost/multi-stages/storage/variables.tf diff --git a/infrastructure/quick-deploy/localhost/storage/versions.tf b/infrastructure/quick-deploy/localhost/multi-stages/storage/versions.tf similarity index 88% rename from infrastructure/quick-deploy/localhost/storage/versions.tf rename to infrastructure/quick-deploy/localhost/multi-stages/storage/versions.tf index 91aafaa0a..a82be4359 100644 --- a/infrastructure/quick-deploy/localhost/storage/versions.tf +++ b/infrastructure/quick-deploy/localhost/multi-stages/storage/versions.tf @@ -2,7 +2,7 @@ terraform { required_providers { kubernetes = { source = "hashicorp/kubernetes" - version = "~> 2.13.0" + version = "~> 2.21.1" } kubectl = { source = "gavinbunney/kubectl" @@ -18,11 +18,11 @@ terraform { } random = { source = "hashicorp/random" - version = "~> 3.4.3" + version = "~> 3.5.1" } local = { source = "hashicorp/local" - version = "~> 2.2.2" + version = "~> 2.4.0" } tls = { source = "hashicorp/tls" diff --git a/infrastructure/quick-deploy/localhost/storage/providers.tf b/infrastructure/quick-deploy/localhost/storage/providers.tf deleted file mode 100644 index b5b71fc7b..000000000 --- a/infrastructure/quick-deploy/localhost/storage/providers.tf +++ /dev/null @@ -1,10 +0,0 @@ -# K8s configuration -data "external" "k8s_config_context" { - program = ["bash", "k8s_config.sh", var.k8s_config_path] - working_dir = ".${path.root}/../../utils/scripts" -} - -provider "kubernetes" { - config_path = var.k8s_config_path - config_context = lookup(tomap(data.external.k8s_config_context.result), "k8s_config_context", var.k8s_config_context) -} \ No newline at end of file diff --git a/versions.tfvars.json b/versions.tfvars.json index e092d7658..2666add59 100644 --- a/versions.tfvars.json +++ b/versions.tfvars.json @@ -1,7 +1,7 @@ { "armonik_versions": { "armonik": "2.14.0", - "infra": "0.0.2", + "infra": "1.0.0", "core": "0.14.3", "api": "3.10.0", "gui": "0.9.2",