Skip to content

Commit

Permalink
refactor: localhost deployments with new infra (#1181)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzianekhodja-aneo authored Aug 9, 2023
2 parents 761a588 + 1f8be7e commit 4e99b7e
Show file tree
Hide file tree
Showing 76 changed files with 178 additions and 220 deletions.
56 changes: 28 additions & 28 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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" \
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion armonik-versions.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" {
Expand All @@ -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" {
Expand All @@ -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" {
Expand Down Expand Up @@ -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
}

Expand Down
13 changes: 13 additions & 0 deletions infrastructure/quick-deploy/localhost/all-in-one/providers.tf
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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])
Expand All @@ -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])
Expand All @@ -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])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 4e99b7e

Please sign in to comment.