From 3c1ee49a4c6d702ee65fca1f364c679fd67f0def Mon Sep 17 00:00:00 2001 From: YKharouni Date: Fri, 30 Jun 2023 16:14:39 +0200 Subject: [PATCH 01/38] add benchmarking scripts --- test/README.md | 25 ++++ .../100_pods/redis/python_scripts/cleaner.py | 38 +++++ .../redis/python_scripts/merge_jsons.py | 25 ++++ .../100_pods/redis/python_scripts/wjson.py | 81 +++++++++++ test/bench/100_pods/redis/stats/1k.json | 13 ++ test/bench/100_pods/redis/stats/5k.json | 4 + test/bench/100_pods/redis/stats/test_env.json | 16 +++ .../100_pods/redis/test_scripts/bench_1k.sh | 17 +++ .../100_pods/redis/test_scripts/bench_5k.sh | 17 +++ .../100_pods/redis/test_scripts/results.json | 130 ++++++++++++++++++ .../bench/100_pods/redis/test_scripts/test.sh | 21 +++ .../100_pods/redis/python_scripts/cleaner.py | 43 ++++++ .../redis/python_scripts/merge_jsons.py | 28 ++++ .../100_pods/redis/python_scripts/wjson.py | 81 +++++++++++ .../100_pods/redis/stats/test_env.json | 16 +++ .../100_pods/redis/test_scripts/htcmock_5k.sh | 16 +++ .../100_pods/redis/test_scripts/test.sh | 21 +++ 17 files changed, 592 insertions(+) create mode 100644 test/README.md create mode 100755 test/bench/100_pods/redis/python_scripts/cleaner.py create mode 100755 test/bench/100_pods/redis/python_scripts/merge_jsons.py create mode 100755 test/bench/100_pods/redis/python_scripts/wjson.py create mode 100644 test/bench/100_pods/redis/stats/1k.json create mode 100644 test/bench/100_pods/redis/stats/5k.json create mode 100644 test/bench/100_pods/redis/stats/test_env.json create mode 100755 test/bench/100_pods/redis/test_scripts/bench_1k.sh create mode 100755 test/bench/100_pods/redis/test_scripts/bench_5k.sh create mode 100644 test/bench/100_pods/redis/test_scripts/results.json create mode 100755 test/bench/100_pods/redis/test_scripts/test.sh create mode 100755 test/htcmock/100_pods/redis/python_scripts/cleaner.py create mode 100755 test/htcmock/100_pods/redis/python_scripts/merge_jsons.py create mode 100755 test/htcmock/100_pods/redis/python_scripts/wjson.py create mode 100644 test/htcmock/100_pods/redis/stats/test_env.json create mode 100755 test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh create mode 100755 test/htcmock/100_pods/redis/test_scripts/test.sh diff --git a/test/README.md b/test/README.md new file mode 100644 index 000000000..300e5049e --- /dev/null +++ b/test/README.md @@ -0,0 +1,25 @@ +# HOW TO USE IT + +This document describe how to use the scripts for do the tests and get the results. + +## Bench + +### Run the tests + +* Scripts for each test +* Script to run all the tests cases and store the results in Json files + +### Clean the output + +cleaner.py will clean the json output files. +* Parameters : path to the json files we want to clean +merge_jsons.py : merges test_env.json is a json file which describes the test environment(third party components of ArmoniK) and we have to set it for each test with the parameters json file of the tested version of ArmoniK with the clean results of the test. + +### Analyse the results + +wjson will read the clean json files and calculate the results. + +* Parameters : List of clean json files + +### How to use it : +Run the script test.sh to run the tests, store the outputs, clean them and merge them with the environment and infrastructure description files. \ No newline at end of file diff --git a/test/bench/100_pods/redis/python_scripts/cleaner.py b/test/bench/100_pods/redis/python_scripts/cleaner.py new file mode 100755 index 000000000..d95e54880 --- /dev/null +++ b/test/bench/100_pods/redis/python_scripts/cleaner.py @@ -0,0 +1,38 @@ +#! /usr/bin/env python3 + +import json +import re + + +def clean_file(file): + lines = [] + keep_stats = [] + keep_tput = [] + keep_options = [] + + # read the output file with no needed data + with open(file, 'r') as f: + # keep only stats lines in the json file + lines = f.read().split("\n") + for line in lines: + if not line: continue + # print(line) + jline = json.loads(line) + if "stats" in jline: + keep_stats.append(jline["stats"]) + keep_options.append(jline["benchOptions"]) + if "sessionThroughput" in jline: + keep_tput.append(jline["sessionThroughput"]) + dic_json = [{"Test": "bench"} | stats | options | {"throughput": tput, "nb_pods": 100} for stats, tput, options in + zip(keep_stats, keep_tput, keep_options)] + + # write a clean json file with needed data + with open(file, 'w') as f: + json.dump(dic_json, f) + + +# clean the stats file +file = "../stats/1k.json" +clean_file(file) +file = "../stats/5k.json" +clean_file(file) diff --git a/test/bench/100_pods/redis/python_scripts/merge_jsons.py b/test/bench/100_pods/redis/python_scripts/merge_jsons.py new file mode 100755 index 000000000..1d60f71e5 --- /dev/null +++ b/test/bench/100_pods/redis/python_scripts/merge_jsons.py @@ -0,0 +1,25 @@ +#! /usr/bin/env python3 + +import json +import re +from jsonmerge import merge + +result = [] +with open("../../../../../versions.tfvars.json", "r") as versions: + result.append(json.load(versions)) +with open("../stats/test_env.json", "r") as test_env: + result.append(json.load(test_env)) +with open("../stats/1k.json", "r") as stats: + result.append(json.load(stats)) +# merged=merge(result[0],result[1]) +# print(merged) +# merged=merge(merged,result[2]) +# print(merged) + +with open("../stats/5k.json", "r") as stats: + result2 = json.load(stats) +# print(merged) +with open("results.json", "w") as r: + # json.dump(result,r) + dict_json = [merge(result[0], result[1]), result[2], result2] + json.dump(dict_json, r) diff --git a/test/bench/100_pods/redis/python_scripts/wjson.py b/test/bench/100_pods/redis/python_scripts/wjson.py new file mode 100755 index 000000000..28db694f9 --- /dev/null +++ b/test/bench/100_pods/redis/python_scripts/wjson.py @@ -0,0 +1,81 @@ +#! /usr/bin/env python3 + +import json +from pytimeparse import parse +import matplotlib.pyplot as plt +import numpy as np + + +# Class test_case +# An object store a lists of the stats of all the runs of the test case +# So we could calculate the mean and the median of each stat +class TestCase: + + def __init__(self, file): + self.nbtasks = [] + self.time = [] + self.exec_time = [] + self.sub_time = [] + self.retrv_time = [] + self.throughput = [] + self.d_parallel = [] + self.file = file + with open(file) as my_bench_file: + data = my_bench_file.read() + # case = TestCase() + runs = json.loads(data) + + for run in runs: + if (run["nb_pods"] == 100): + self.nbtasks.append(run["TotalTasks"]) + self.time.append(float(parse(run["ElapsedTime"]))) + self.exec_time.append(float(parse(run["TasksExecutionTime"]))) + self.sub_time.append(float(parse(run["SubmissionTime"]))) + self.retrv_time.append(float(parse(run["ResultRetrievingTime"]))) + self.throughput.append(float(run["throughput"])) + self.d_parallel.append(run["DegreeOfParallelism"]) + + +if __name__ == "__main__": + + files = ['../stats/1k.json', '../stats/5k.json'] + JsonFiles = [x for x in files if x.endswith(".json")] + + # dictionary to store the stats of each test case + cases = { + } + cases["1k"] = TestCase(JsonFiles[0]) + cases["5k"] = TestCase(JsonFiles[1]) + + # Dictionary to store the mean of each test case + mean = { + "time": {}, + "exec_time": {}, + "sub_time": {}, + "retrv_time": {}, + "throughput": {} + } + + # calculte the mean of each test case + for file in files: + filename = file.split(".")[0] + mean["time"][filename] = np.mean(cases[filename].time) + mean["exec_time"][filename] = np.mean(cases[filename].exec_time) + mean["sub_time"][filename] = np.mean(cases[filename].sub_time) + mean["retrv_time"][filename] = np.mean(cases[filename].retrv_time) + mean["throughput"][filename] = np.mean(cases[filename].throughput) + + # print the stats + for file in files: + filename = file.split(".")[0] + print('Degree of parallelism of retrieving time is : ' + str(cases[filename].d_parallel[0])) + print('mean total time for treatement of ' + filename + ' tasks on 100 pods is : ' + str( + mean["time"][filename]) + ' s') + print('mean time of the execution of ' + filename + ' tasks on 100 pods is : ' + str( + mean["exec_time"][filename]) + ' s') + print('mean time of the submission of ' + filename + ' tasks on 100 pods is : ' + str( + mean["sub_time"][filename]) + ' s') + print('mean time of the retrieving of ' + filename + ' tasks on 100 pods is : ' + str( + mean["retrv_time"][filename]) + ' s') + print('mean throughput for ' + filename + ' tasks on 100 pods is : ' + str( + mean["throughput"][filename]) + " tasks/s \n") diff --git a/test/bench/100_pods/redis/stats/1k.json b/test/bench/100_pods/redis/stats/1k.json new file mode 100644 index 000000000..8b0127594 --- /dev/null +++ b/test/bench/100_pods/redis/stats/1k.json @@ -0,0 +1,13 @@ +{"@t":"2023-05-29T13:43:36.7875164Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://acb117475dccc48d9aabdd823630b6cc-278842575.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","$type":"GrpcClient"},"SourceContext":"Bench Program"} +{"@t":"2023-05-29T13:43:36.8009679Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"} +{"@t":"2023-05-29T13:43:37.0411639Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":1,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:43:37.0955307Z","@mt":"Session Id : {sessionId}","sessionId":"28a7daaa-ee50-4a67-8c0e-d5dba8465113","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:43:55.3944829Z","@mt":"Results retrieved {number}","number":1000,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:43:55.4120208Z","@mt":"executions stats {@stats}","stats":{"ElapsedTime":"00:00:18.3504645","SubmissionTime":"00:00:02.3141442","TasksExecutionTime":"00:00:13.9157812","ResultRetrievingTime":"00:00:02.0692890","CountExecutionTime":"00:00:00.0160471","TotalTasks":1000,"ErrorTasks":0,"CompletedTasks":1000,"CancelledTasks":0,"$type":"ExecutionStats"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:04.8551870Z","@mt":"Ratio between time spent on a task and processing time {min}, {max}, {avg}","min":0.20689655172413793,"max":0.896551724137931,"avg":0.5509703841925119,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:04.8596413Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Creating","status2":"Submitted","min":0.055,"max":0.097,"avg":0.059849999999999966,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:04.8602965Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Processing","min":0.002,"max":0.093,"avg":0.005529999999999961,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:04.8608368Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Processing","status2":"Completed","min":0.007,"max":0.39,"avg":0.013090999999999877,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:04.8613373Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Completed","min":0.01,"max":0.483,"avg":0.018620999999999888,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:04.8632898Z","@mt":"Throughput for session {session} : {sessionThroughput} task/s (completed {nTasks}, total {total} tasks in {timespan})","session":"28a7daaa-ee50-4a67-8c0e-d5dba8465113","sessionThroughput":78.1983109164842,"nTasks":1000,"total":1000,"timespan":"00:00:12.7880000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:14.4133834Z","@mt":"Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})","session":"28a7daaa-ee50-4a67-8c0e-d5dba8465113","throughput":78.1983109164842,"nTasks":1000,"timespan":"00:00:12.7880000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} diff --git a/test/bench/100_pods/redis/stats/5k.json b/test/bench/100_pods/redis/stats/5k.json new file mode 100644 index 000000000..53ee3a180 --- /dev/null +++ b/test/bench/100_pods/redis/stats/5k.json @@ -0,0 +1,4 @@ +{"@t":"2023-05-29T13:44:15.7811985Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://acb117475dccc48d9aabdd823630b6cc-278842575.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","$type":"GrpcClient"},"SourceContext":"Bench Program"} +{"@t":"2023-05-29T13:44:15.8001499Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"} +{"@t":"2023-05-29T13:44:16.1216987Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":1,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} +{"@t":"2023-05-29T13:44:16.1612477Z","@mt":"Session Id : {sessionId}","sessionId":"0e4fc0f6-14e6-4335-ba35-639dc710a880","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} diff --git a/test/bench/100_pods/redis/stats/test_env.json b/test/bench/100_pods/redis/stats/test_env.json new file mode 100644 index 000000000..681e378d2 --- /dev/null +++ b/test/bench/100_pods/redis/stats/test_env.json @@ -0,0 +1,16 @@ +{ + "test_environnement" : { + "instance_type" : "c24.xlarge", + "Processor" : "Intel Xeon de 2e (Cascade Lake)", + "CPU_frequency" : "3.6 GHz - 3.9 GHz", + "nb_cpus" : "96", + "RAM" : "192", + "Network_bandwidth" : "25", + "EBS_bandwidth" : "19000", + "Kubernetes" : "AWS EKS 1.25", + "Object_object_type" : "AWS S3", + "Storage_queue_storage" : "Amazon MQ, broker : ActiveMQ 5.16.4", + "Storage_table_type" : "MongoDB 6.0.1", + "OS" : "Linux" + } +} \ No newline at end of file diff --git a/test/bench/100_pods/redis/test_scripts/bench_1k.sh b/test/bench/100_pods/redis/test_scripts/bench_1k.sh new file mode 100755 index 000000000..bc0e803e2 --- /dev/null +++ b/test/bench/100_pods/redis/test_scripts/bench_1k.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + +#run 1000 tasks on 100 pods +docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e BenchOptions__nTasks=1000 \ + -e BenchOptions__TaskDurationMs=1 \ + -e BenchOptions__PayloadSize=1 \ + -e BenchOptions__ResultSize=1 \ + -e BenchOptions__Partition=bench \ + -e BenchOptions__ShowEvents=false \ + -e BenchOptions__BatchSize=50 \ + -e BenchOptions__MaxRetries=5 \ + -e BenchOptions__DegreeOfParallelism=5 \ + dockerhubaneo/armonik_core_bench_test_client:0.11.4-jgbench.13.e5bd3b7c diff --git a/test/bench/100_pods/redis/test_scripts/bench_5k.sh b/test/bench/100_pods/redis/test_scripts/bench_5k.sh new file mode 100755 index 000000000..145ac3acd --- /dev/null +++ b/test/bench/100_pods/redis/test_scripts/bench_5k.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + +#run 5000 tasks on 100 pods +docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e BenchOptions__nTasks=5000 \ + -e BenchOptions__TaskDurationMs=1 \ + -e BenchOptions__PayloadSize=1 \ + -e BenchOptions__ResultSize=1 \ + -e BenchOptions__Partition=bench \ + -e BenchOptions__ShowEvents=false \ + -e BenchOptions__BatchSize=50 \ + -e BenchOptions__MaxRetries=5 \ + -e BenchOptions__DegreeOfParallelism=5 \ + dockerhubaneo/armonik_core_bench_test_client:0.11.4-jgbench.13.e5bd3b7c diff --git a/test/bench/100_pods/redis/test_scripts/results.json b/test/bench/100_pods/redis/test_scripts/results.json new file mode 100644 index 000000000..f95b5793d --- /dev/null +++ b/test/bench/100_pods/redis/test_scripts/results.json @@ -0,0 +1,130 @@ +[ + { + "armonik_versions": { + "infra": "2.12.2", + "core": "0.12.4", + "api": "3.6.0", + "gui": "0.9.0", + "extcsharp": "0.9.5", + "samples": "2.12.2" + }, + "armonik_images": { + "infra": [], + "core": [ + "dockerhubaneo/armonik_pollingagent", + "dockerhubaneo/armonik_control_metrics", + "dockerhubaneo/armonik_control_partition_metrics", + "dockerhubaneo/armonik_control", + "dockerhubaneo/armonik_core_stream_test_worker", + "dockerhubaneo/armonik_core_stream_test_client", + "dockerhubaneo/armonik_core_htcmock_test_worker", + "dockerhubaneo/armonik_core_htcmock_test_client", + "dockerhubaneo/armonik_core_bench_test_worker", + "dockerhubaneo/armonik_core_bench_test_client" + ], + "api": [], + "gui": [ + "dockerhubaneo/armonik_admin_app", + "dockerhubaneo/armonik_admin_api" + ], + "extcsharp": [ + "dockerhubaneo/armonik_worker_dll" + ], + "samples": [] + }, + "image_tags": { + "registry.k8s.io/autoscaling/cluster-autoscaler": "v1.23.0", + "registry.k8s.io/metrics-server/metrics-server": "v0.6.2", + "ghcr.io/kedacore/keda": "2.9.3", + "ghcr.io/kedacore/keda-metrics-apiserver": "2.9.3", + "public.ecr.aws/aws-ec2/aws-node-termination-handler": "v1.19.0", + "amazon/aws-efs-csi-driver": "v1.5.1", + "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe": "v2.9.0-eks-1-22-19", + "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar": "v2.7.0-eks-1-22-19", + "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner": "v3.4.0-eks-1-22-19", + "symptoma/activemq": "5.17.0", + "mongo": "6.0.1", + "redis": "7.0.8", + "minio/minio": "RELEASE.2023-02-10T18-48-39Z", + "datalust/seq": "2023.1", + "grafana/grafana": "9.3.6", + "prom/node-exporter": "v1.5.0", + "prom/prometheus": "v2.42.0", + "fluent/fluent-bit": "2.0.9", + "rtsp/mongosh": "1.7.1", + "nginx": "1.23.3", + "nginxinc/nginx-unprivileged": "1.23.3", + "datalust/seqcli": "2023.1" + }, + "test_environnement": { + "instance_type": "c24.xlarge", + "Processor": "Intel Xeon de 2e (Cascade Lake)", + "CPU_frequency": "3.6 GHz - 3.9 GHz", + "nb_cpus": "96", + "RAM": "192", + "Network_bandwidth": "25", + "EBS_bandwidth": "19000", + "Kubernetes": "AWS EKS 1.25", + "Object_object_type": "AWS S3", + "Storage_queue_storage": "Amazon MQ, broker : ActiveMQ 5.16.4", + "Storage_table_type": "MongoDB 6.0.1", + "OS": "Linux" + } + }, + [ + { + "Test": "bench", + "ElapsedTime": "00:00:18.3504645", + "SubmissionTime": "00:00:02.3141442", + "TasksExecutionTime": "00:00:13.9157812", + "ResultRetrievingTime": "00:00:02.0692890", + "CountExecutionTime": "00:00:00.0160471", + "TotalTasks": 1000, + "ErrorTasks": 0, + "CompletedTasks": 1000, + "CancelledTasks": 0, + "$type": "BenchOptions", + "NTasks": 1000, + "TaskDurationMs": 1, + "PayloadSize": 1, + "ResultSize": 1, + "BatchSize": 50, + "TaskRpcException": "", + "TaskError": "", + "Partition": "bench", + "ShowEvents": false, + "MaxRetries": 5, + "DegreeOfParallelism": 5, + "throughput": 78.1983109164842, + "nb_pods": 100 + } + ], + [ + { + "Test": "bench", + "ElapsedTime": "00:01:04.4384410", + "SubmissionTime": "00:00:10.5994994", + "TasksExecutionTime": "00:00:44.2651815", + "ResultRetrievingTime": "00:00:09.5377842", + "CountExecutionTime": "00:00:00.0217572", + "TotalTasks": 5000, + "ErrorTasks": 0, + "CompletedTasks": 5000, + "CancelledTasks": 0, + "$type": "BenchOptions", + "NTasks": 5000, + "TaskDurationMs": 1, + "PayloadSize": 1, + "ResultSize": 1, + "BatchSize": 50, + "TaskRpcException": "", + "TaskError": "", + "Partition": "bench", + "ShowEvents": false, + "MaxRetries": 5, + "DegreeOfParallelism": 5, + "throughput": 246.80388962930056, + "nb_pods": 100 + } + ] +] \ No newline at end of file diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh new file mode 100755 index 000000000..e246d8401 --- /dev/null +++ b/test/bench/100_pods/redis/test_scripts/test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +#lunch runs with the same nb pods +# warm up run +#./bench_10k.sh + +#clearmeasured runs +#for i in {1..3} +#do +# ./bench_10k.sh >> 10k.json +#done + +./bench_1k.sh >> ../stats/1k.json && ./bench_5k.sh >> ../stats/5k.json +#clean the output file +../python_scripts/cleaner.py + +#merge json files +../python_scripts/merge_jsons.py + +#print the test stats and plot graphs +#../python_scripts/wjson.py diff --git a/test/htcmock/100_pods/redis/python_scripts/cleaner.py b/test/htcmock/100_pods/redis/python_scripts/cleaner.py new file mode 100755 index 000000000..64c17029d --- /dev/null +++ b/test/htcmock/100_pods/redis/python_scripts/cleaner.py @@ -0,0 +1,43 @@ +#! /usr/bin/env python3 + +import json +import re + + +def clean_file(file): + lines = [] + keep_stats = [] + keep_config = [] + keep_tput = [] + + # read the output file with no needed data + with open(file, 'r') as f: + # keep only stats lines in the json file + lines = f.read().split("\n")[10:] + for line in lines: + if not line: continue + # print(line) + jline = json.loads(line) + if "configuration" in jline: + keep_config.append(jline) + if "time" in jline: + keep_stats.append(jline) + if "throughput" in jline: + keep_tput.append(jline) + dic_json = [{"Test": "htcmock"} | stats | {"configuration": conf, "throughput": tput, "nb_pods": 100} for + stats, conf, tput in zip(keep_stats, keep_config, keep_tput)] + print(keep_stats) + # write a clean json file with needed data + with open(file, 'w') as f: + json.dump(dic_json, f) + + +# clean the stats file +# file = "../stats/4_agg/1k.json" +# clean_file(file) +file = "../stats/4_agg/5k.json" +clean_file(file) +# file = "../stats/4_agg/10k.json" +# clean_file(file) +# file = "out.json" +# clean_file(file) diff --git a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py new file mode 100755 index 000000000..88fda209f --- /dev/null +++ b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py @@ -0,0 +1,28 @@ +#! /usr/bin/env python3 + +import json +import re +from jsonmerge import merge + +result = [] +with open("../../../../../versions.tfvars.json", "r") as versions: + result.append(json.load(versions)) +with open("../stats/test_env.json", "r") as test_env: + result.append(json.load(test_env)) +with open("../stats/4_agg/5k.json", "r") as stats: + result.append(json.load(stats)) +# merged=merge(result[0],result[1]) +# print(merged) +# merged=merge(merged,result[2]) +# print(merged) + +# with open("../stats/4_agg/5k.json","r") as stats: +# result2=json.load(stats) +# with open("../stats/4_agg/10k.json","r") as stats: +# result3=json.load(stats) +# print(merged) +with open("result_4agg_1h.json", "w") as r: + # json.dump(result,r) + # dict_json=[merge(result[0],result[1]),result[2],result2,result3] + dict_json = [merge(result[0], result[1]), result[2]] + json.dump(dict_json, r) diff --git a/test/htcmock/100_pods/redis/python_scripts/wjson.py b/test/htcmock/100_pods/redis/python_scripts/wjson.py new file mode 100755 index 000000000..28db694f9 --- /dev/null +++ b/test/htcmock/100_pods/redis/python_scripts/wjson.py @@ -0,0 +1,81 @@ +#! /usr/bin/env python3 + +import json +from pytimeparse import parse +import matplotlib.pyplot as plt +import numpy as np + + +# Class test_case +# An object store a lists of the stats of all the runs of the test case +# So we could calculate the mean and the median of each stat +class TestCase: + + def __init__(self, file): + self.nbtasks = [] + self.time = [] + self.exec_time = [] + self.sub_time = [] + self.retrv_time = [] + self.throughput = [] + self.d_parallel = [] + self.file = file + with open(file) as my_bench_file: + data = my_bench_file.read() + # case = TestCase() + runs = json.loads(data) + + for run in runs: + if (run["nb_pods"] == 100): + self.nbtasks.append(run["TotalTasks"]) + self.time.append(float(parse(run["ElapsedTime"]))) + self.exec_time.append(float(parse(run["TasksExecutionTime"]))) + self.sub_time.append(float(parse(run["SubmissionTime"]))) + self.retrv_time.append(float(parse(run["ResultRetrievingTime"]))) + self.throughput.append(float(run["throughput"])) + self.d_parallel.append(run["DegreeOfParallelism"]) + + +if __name__ == "__main__": + + files = ['../stats/1k.json', '../stats/5k.json'] + JsonFiles = [x for x in files if x.endswith(".json")] + + # dictionary to store the stats of each test case + cases = { + } + cases["1k"] = TestCase(JsonFiles[0]) + cases["5k"] = TestCase(JsonFiles[1]) + + # Dictionary to store the mean of each test case + mean = { + "time": {}, + "exec_time": {}, + "sub_time": {}, + "retrv_time": {}, + "throughput": {} + } + + # calculte the mean of each test case + for file in files: + filename = file.split(".")[0] + mean["time"][filename] = np.mean(cases[filename].time) + mean["exec_time"][filename] = np.mean(cases[filename].exec_time) + mean["sub_time"][filename] = np.mean(cases[filename].sub_time) + mean["retrv_time"][filename] = np.mean(cases[filename].retrv_time) + mean["throughput"][filename] = np.mean(cases[filename].throughput) + + # print the stats + for file in files: + filename = file.split(".")[0] + print('Degree of parallelism of retrieving time is : ' + str(cases[filename].d_parallel[0])) + print('mean total time for treatement of ' + filename + ' tasks on 100 pods is : ' + str( + mean["time"][filename]) + ' s') + print('mean time of the execution of ' + filename + ' tasks on 100 pods is : ' + str( + mean["exec_time"][filename]) + ' s') + print('mean time of the submission of ' + filename + ' tasks on 100 pods is : ' + str( + mean["sub_time"][filename]) + ' s') + print('mean time of the retrieving of ' + filename + ' tasks on 100 pods is : ' + str( + mean["retrv_time"][filename]) + ' s') + print('mean throughput for ' + filename + ' tasks on 100 pods is : ' + str( + mean["throughput"][filename]) + " tasks/s \n") diff --git a/test/htcmock/100_pods/redis/stats/test_env.json b/test/htcmock/100_pods/redis/stats/test_env.json new file mode 100644 index 000000000..26e6981a5 --- /dev/null +++ b/test/htcmock/100_pods/redis/stats/test_env.json @@ -0,0 +1,16 @@ +{ + "test_environnement" : { + "instance_type" : "c24.xlarge", + "Processor" : "Intel Xeon de 2e (Cascade Lake)", + "CPU_frequency" : "3.6 GHz - 3.9 GHz", + "nb_cpus" : "96", + "RAM" : "192", + "Network_bandwidth" : "25", + "EBS_bandwidth" : "19000", + "Kubernetes" : "AWS EKS 1.25", + "Object_object_type" : "AWS S3", + "Storage_queue_storage" : "Amazon MQ, broker : ActiveMQ 5.17.0", + "Storage_table_type" : "MongoDB 6.0.1", + "OS" : "Linux" + } +} \ No newline at end of file diff --git a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh new file mode 100755 index 000000000..cac18705b --- /dev/null +++ b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + + docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e HtcMock__NTasks=5000 \ + -e HtcMock__TotalCalculationTime=01:00:00.00 \ + -e HtcMock__DataSize=1 \ + -e HtcMock__MemorySize=1 \ + -e HtcMock__SubTasksLevels=4 \ + -e HtcMock__EnableUseLowMem=true \ + -e HtcMock__EnableSmallOutput=true \ + -e HtcMock__EnableFastCompute=true \ + -e HtcMock__Partition="htcmock" \ + dockerhubaneo/armonik_core_htcmock_test_client:0.13.1 \ No newline at end of file diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh new file mode 100755 index 000000000..776c0a247 --- /dev/null +++ b/test/htcmock/100_pods/redis/test_scripts/test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +#lunch runs with the same nb pods +# warm up run +#./bench_10k.sh + +#clearmeasured runs +#for i in {1..3} +#do +# ./bench_10k.sh >> 10k.json +#done + +./htcmock_5k.sh >> ../stats/4_agg/5k.json && +#clean the output file +../python_scripts/cleaner.py + +#merge json files +#../python_scripts/merge_jsons.py + +#print the test stats and plot graphs +#../python_scripts/wjson.py From a1b3c2037bfe9cd57b6e203456c7578bb945c873 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Fri, 30 Jun 2023 16:17:30 +0200 Subject: [PATCH 02/38] update bench and htcmock client version --- test/bench/100_pods/redis/test_scripts/bench_1k.sh | 2 +- test/bench/100_pods/redis/test_scripts/bench_5k.sh | 2 +- test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/bench/100_pods/redis/test_scripts/bench_1k.sh b/test/bench/100_pods/redis/test_scripts/bench_1k.sh index bc0e803e2..d5e870855 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_1k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_1k.sh @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:0.11.4-jgbench.13.e5bd3b7c + dockerhubaneo/armonik_core_bench_test_client:0.13.2 diff --git a/test/bench/100_pods/redis/test_scripts/bench_5k.sh b/test/bench/100_pods/redis/test_scripts/bench_5k.sh index 145ac3acd..88ef4ec4d 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_5k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_5k.sh @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:0.11.4-jgbench.13.e5bd3b7c + dockerhubaneo/armonik_core_bench_test_client:0.13.2 diff --git a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh index cac18705b..6d7721c70 100755 --- a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh +++ b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh @@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/ar -e HtcMock__EnableSmallOutput=true \ -e HtcMock__EnableFastCompute=true \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:0.13.1 \ No newline at end of file + dockerhubaneo/armonik_core_htcmock_test_client:0.13.2 \ No newline at end of file From 42fd442d56af8b0122526472955757b9ac56c738 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Fri, 30 Jun 2023 16:37:18 +0200 Subject: [PATCH 03/38] variablize core version --- test/bench/100_pods/redis/test_scripts/bench_1k.sh | 2 +- test/bench/100_pods/redis/test_scripts/bench_5k.sh | 2 +- test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh | 2 +- test/htcmock/100_pods/redis/test_scripts/test.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/bench/100_pods/redis/test_scripts/bench_1k.sh b/test/bench/100_pods/redis/test_scripts/bench_1k.sh index d5e870855..7cae27089 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_1k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_1k.sh @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:0.13.2 + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/test/bench/100_pods/redis/test_scripts/bench_5k.sh b/test/bench/100_pods/redis/test_scripts/bench_5k.sh index 88ef4ec4d..83036fa76 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_5k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_5k.sh @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:0.13.2 + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh index 6d7721c70..de778ea8c 100755 --- a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh +++ b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh @@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/ar -e HtcMock__EnableSmallOutput=true \ -e HtcMock__EnableFastCompute=true \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:0.13.2 \ No newline at end of file + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh index 776c0a247..4b360ca82 100755 --- a/test/htcmock/100_pods/redis/test_scripts/test.sh +++ b/test/htcmock/100_pods/redis/test_scripts/test.sh @@ -10,12 +10,12 @@ # ./bench_10k.sh >> 10k.json #done -./htcmock_5k.sh >> ../stats/4_agg/5k.json && +./htcmock_5k.sh >> ../stats/5k.json #clean the output file ../python_scripts/cleaner.py #merge json files -#../python_scripts/merge_jsons.py +../python_scripts/merge_jsons.py #print the test stats and plot graphs #../python_scripts/wjson.py From 5c9f2158f5db98c863167a7a0f04cb4437d80fb0 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Fri, 30 Jun 2023 16:42:56 +0200 Subject: [PATCH 04/38] edit doc --- test/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/README.md b/test/README.md index 300e5049e..1b5b5a714 100644 --- a/test/README.md +++ b/test/README.md @@ -1,6 +1,6 @@ # HOW TO USE IT -This document describe how to use the scripts for do the tests and get the results. +This document describe how to use the benchmarking scripts. ## Bench From c780fec27aa4e7284ce07f8213222058935cd92b Mon Sep 17 00:00:00 2001 From: YKharouni Date: Fri, 30 Jun 2023 16:44:43 +0200 Subject: [PATCH 05/38] remove stats files --- test/bench/100_pods/redis/stats/1k.json | 13 ------------- test/bench/100_pods/redis/stats/5k.json | 4 ---- 2 files changed, 17 deletions(-) delete mode 100644 test/bench/100_pods/redis/stats/1k.json delete mode 100644 test/bench/100_pods/redis/stats/5k.json diff --git a/test/bench/100_pods/redis/stats/1k.json b/test/bench/100_pods/redis/stats/1k.json deleted file mode 100644 index 8b0127594..000000000 --- a/test/bench/100_pods/redis/stats/1k.json +++ /dev/null @@ -1,13 +0,0 @@ -{"@t":"2023-05-29T13:43:36.7875164Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://acb117475dccc48d9aabdd823630b6cc-278842575.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","$type":"GrpcClient"},"SourceContext":"Bench Program"} -{"@t":"2023-05-29T13:43:36.8009679Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"} -{"@t":"2023-05-29T13:43:37.0411639Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":1,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:43:37.0955307Z","@mt":"Session Id : {sessionId}","sessionId":"28a7daaa-ee50-4a67-8c0e-d5dba8465113","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:43:55.3944829Z","@mt":"Results retrieved {number}","number":1000,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:43:55.4120208Z","@mt":"executions stats {@stats}","stats":{"ElapsedTime":"00:00:18.3504645","SubmissionTime":"00:00:02.3141442","TasksExecutionTime":"00:00:13.9157812","ResultRetrievingTime":"00:00:02.0692890","CountExecutionTime":"00:00:00.0160471","TotalTasks":1000,"ErrorTasks":0,"CompletedTasks":1000,"CancelledTasks":0,"$type":"ExecutionStats"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:04.8551870Z","@mt":"Ratio between time spent on a task and processing time {min}, {max}, {avg}","min":0.20689655172413793,"max":0.896551724137931,"avg":0.5509703841925119,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:04.8596413Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Creating","status2":"Submitted","min":0.055,"max":0.097,"avg":0.059849999999999966,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:04.8602965Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Processing","min":0.002,"max":0.093,"avg":0.005529999999999961,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:04.8608368Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Processing","status2":"Completed","min":0.007,"max":0.39,"avg":0.013090999999999877,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:04.8613373Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Completed","min":0.01,"max":0.483,"avg":0.018620999999999888,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:04.8632898Z","@mt":"Throughput for session {session} : {sessionThroughput} task/s (completed {nTasks}, total {total} tasks in {timespan})","session":"28a7daaa-ee50-4a67-8c0e-d5dba8465113","sessionThroughput":78.1983109164842,"nTasks":1000,"total":1000,"timespan":"00:00:12.7880000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:14.4133834Z","@mt":"Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})","session":"28a7daaa-ee50-4a67-8c0e-d5dba8465113","throughput":78.1983109164842,"nTasks":1000,"timespan":"00:00:12.7880000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} diff --git a/test/bench/100_pods/redis/stats/5k.json b/test/bench/100_pods/redis/stats/5k.json deleted file mode 100644 index 53ee3a180..000000000 --- a/test/bench/100_pods/redis/stats/5k.json +++ /dev/null @@ -1,4 +0,0 @@ -{"@t":"2023-05-29T13:44:15.7811985Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://acb117475dccc48d9aabdd823630b6cc-278842575.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","$type":"GrpcClient"},"SourceContext":"Bench Program"} -{"@t":"2023-05-29T13:44:15.8001499Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"} -{"@t":"2023-05-29T13:44:16.1216987Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":1,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-05-29T13:44:16.1612477Z","@mt":"Session Id : {sessionId}","sessionId":"0e4fc0f6-14e6-4335-ba35-639dc710a880","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} From 701be545542eb0c8a4804b85bdc0473bfc9a7628 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Fri, 30 Jun 2023 16:47:04 +0200 Subject: [PATCH 06/38] clean merge files --- .../100_pods/redis/python_scripts/merge_jsons.py | 6 ------ .../100_pods/redis/python_scripts/merge_jsons.py | 15 ++------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/test/bench/100_pods/redis/python_scripts/merge_jsons.py b/test/bench/100_pods/redis/python_scripts/merge_jsons.py index 1d60f71e5..665f35362 100755 --- a/test/bench/100_pods/redis/python_scripts/merge_jsons.py +++ b/test/bench/100_pods/redis/python_scripts/merge_jsons.py @@ -11,15 +11,9 @@ result.append(json.load(test_env)) with open("../stats/1k.json", "r") as stats: result.append(json.load(stats)) -# merged=merge(result[0],result[1]) -# print(merged) -# merged=merge(merged,result[2]) -# print(merged) - with open("../stats/5k.json", "r") as stats: result2 = json.load(stats) # print(merged) with open("results.json", "w") as r: - # json.dump(result,r) dict_json = [merge(result[0], result[1]), result[2], result2] json.dump(dict_json, r) diff --git a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py index 88fda209f..f040c62e8 100755 --- a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py +++ b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py @@ -9,20 +9,9 @@ result.append(json.load(versions)) with open("../stats/test_env.json", "r") as test_env: result.append(json.load(test_env)) -with open("../stats/4_agg/5k.json", "r") as stats: +with open("../stats/5k.json", "r") as stats: result.append(json.load(stats)) -# merged=merge(result[0],result[1]) -# print(merged) -# merged=merge(merged,result[2]) -# print(merged) - -# with open("../stats/4_agg/5k.json","r") as stats: -# result2=json.load(stats) -# with open("../stats/4_agg/10k.json","r") as stats: -# result3=json.load(stats) -# print(merged) with open("result_4agg_1h.json", "w") as r: - # json.dump(result,r) - # dict_json=[merge(result[0],result[1]),result[2],result2,result3] + dict_json = [merge(result[0], result[1]), result[2]] json.dump(dict_json, r) From 10415b2ae59c82e3adc95982f6ea4489ec6b531c Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 3 Jul 2023 16:16:41 +0200 Subject: [PATCH 07/38] add results examples --- test/README.md | 53 +++- .../100_pods/redis/test_scripts/results.json | 280 ++++++++++-------- .../bench/100_pods/redis/test_scripts/test.sh | 2 + .../100_pods/redis/python_scripts/cleaner.py | 11 +- .../redis/python_scripts/merge_jsons.py | 2 +- .../100_pods/redis/test_scripts/results.json | 126 ++++++++ .../100_pods/redis/test_scripts/test.sh | 2 + 7 files changed, 333 insertions(+), 143 deletions(-) create mode 100644 test/htcmock/100_pods/redis/test_scripts/results.json diff --git a/test/README.md b/test/README.md index 1b5b5a714..47efe6572 100644 --- a/test/README.md +++ b/test/README.md @@ -1,19 +1,23 @@ # HOW TO USE IT -This document describe how to use the benchmarking scripts. +This document describe how to use the benchmarking scripts. + ## Bench ### Run the tests -* Scripts for each test -* Script to run all the tests cases and store the results in Json files +* Scripts for each test where we set the parameters of the test to run. +* Script to run all the tests cases and store the results in Json files using python scripts. ### Clean the output -cleaner.py will clean the json output files. -* Parameters : path to the json files we want to clean -merge_jsons.py : merges test_env.json is a json file which describes the test environment(third party components of ArmoniK) and we have to set it for each test with the parameters json file of the tested version of ArmoniK with the clean results of the test. +* cleaner.py will clean the json output files. +Parameters : path to the json files we want to clean. + + +* merge_jsons.py : merges test_env.json which is a json file which describes the test environment(third party components of ArmoniK) and we have to set it for each test with the parameters json file of the tested version of ArmoniK with the clean results of the test. +* prerequisites: we have to install jsonmerge (pip install jsonmerge) ### Analyse the results @@ -22,4 +26,39 @@ wjson will read the clean json files and calculate the results. * Parameters : List of clean json files ### How to use it : -Run the script test.sh to run the tests, store the outputs, clean them and merge them with the environment and infrastructure description files. \ No newline at end of file +* Run the script test_scripts/test.sh to run the tests, store the outputs, clean them and merge them with the environment and infrastructure description files. + + + +#### Folder tree + +
+.  
+├── bench    
+|  └── 100_pods  
+|        └── redis  
+|            ├── python_scripts  
+|            |   ├── cleaner.py  
+|            |   ├── merge_jsons.py  
+|            |   └── wjson.py  
+|            ├── stats  
+|            |   └── test_env.json  
+|            └── test_scripts  
+|                ├── bench_1k.sh  
+|                ├── bench_5k.sh  
+|                └── test.sh  
+├── htcmock  
+|   └── 100_pods  
+|        └── redis  
+|            ├── python_scripts  
+|            |   ├── cleaner.py  
+|            |   ├── merge_jsons.py  
+|            |   └── wjson.py  
+|            ├── stats  
+|            |   └── test_env.json  
+|            └── test_scripts  
+|                ├── htcmock_5k.sh  
+|                └── test.sh  
+├── README.md  
+
+
diff --git a/test/bench/100_pods/redis/test_scripts/results.json b/test/bench/100_pods/redis/test_scripts/results.json index f95b5793d..0b1cdeaa7 100644 --- a/test/bench/100_pods/redis/test_scripts/results.json +++ b/test/bench/100_pods/redis/test_scripts/results.json @@ -1,130 +1,156 @@ [ - { - "armonik_versions": { - "infra": "2.12.2", - "core": "0.12.4", - "api": "3.6.0", - "gui": "0.9.0", - "extcsharp": "0.9.5", - "samples": "2.12.2" - }, - "armonik_images": { - "infra": [], - "core": [ - "dockerhubaneo/armonik_pollingagent", - "dockerhubaneo/armonik_control_metrics", - "dockerhubaneo/armonik_control_partition_metrics", - "dockerhubaneo/armonik_control", - "dockerhubaneo/armonik_core_stream_test_worker", - "dockerhubaneo/armonik_core_stream_test_client", - "dockerhubaneo/armonik_core_htcmock_test_worker", - "dockerhubaneo/armonik_core_htcmock_test_client", - "dockerhubaneo/armonik_core_bench_test_worker", - "dockerhubaneo/armonik_core_bench_test_client" - ], - "api": [], - "gui": [ - "dockerhubaneo/armonik_admin_app", - "dockerhubaneo/armonik_admin_api" - ], - "extcsharp": [ - "dockerhubaneo/armonik_worker_dll" - ], - "samples": [] - }, - "image_tags": { - "registry.k8s.io/autoscaling/cluster-autoscaler": "v1.23.0", - "registry.k8s.io/metrics-server/metrics-server": "v0.6.2", - "ghcr.io/kedacore/keda": "2.9.3", - "ghcr.io/kedacore/keda-metrics-apiserver": "2.9.3", - "public.ecr.aws/aws-ec2/aws-node-termination-handler": "v1.19.0", - "amazon/aws-efs-csi-driver": "v1.5.1", - "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe": "v2.9.0-eks-1-22-19", - "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar": "v2.7.0-eks-1-22-19", - "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner": "v3.4.0-eks-1-22-19", - "symptoma/activemq": "5.17.0", - "mongo": "6.0.1", - "redis": "7.0.8", - "minio/minio": "RELEASE.2023-02-10T18-48-39Z", - "datalust/seq": "2023.1", - "grafana/grafana": "9.3.6", - "prom/node-exporter": "v1.5.0", - "prom/prometheus": "v2.42.0", - "fluent/fluent-bit": "2.0.9", - "rtsp/mongosh": "1.7.1", - "nginx": "1.23.3", - "nginxinc/nginx-unprivileged": "1.23.3", - "datalust/seqcli": "2023.1" - }, - "test_environnement": { - "instance_type": "c24.xlarge", - "Processor": "Intel Xeon de 2e (Cascade Lake)", - "CPU_frequency": "3.6 GHz - 3.9 GHz", - "nb_cpus": "96", - "RAM": "192", - "Network_bandwidth": "25", - "EBS_bandwidth": "19000", - "Kubernetes": "AWS EKS 1.25", - "Object_object_type": "AWS S3", - "Storage_queue_storage": "Amazon MQ, broker : ActiveMQ 5.16.4", - "Storage_table_type": "MongoDB 6.0.1", - "OS": "Linux" - } + { + "armonik_versions": { + "armonik": "2.13.2", + "infra": "0.0.2", + "core": "0.13.2", + "api": "3.6.0", + "gui": "0.9.0", + "extcsharp": "0.11.1", + "samples": "2.13.2" + }, + "armonik_images": { + "armonik": [], + "infra": [ + "https://github.com/aneoconsulting/ArmoniK.Infra.git" + ], + "core": [ + "dockerhubaneo/armonik_pollingagent", + "dockerhubaneo/armonik_control_metrics", + "dockerhubaneo/armonik_control_partition_metrics", + "dockerhubaneo/armonik_control", + "dockerhubaneo/armonik_core_stream_test_worker", + "dockerhubaneo/armonik_core_stream_test_client", + "dockerhubaneo/armonik_core_htcmock_test_worker", + "dockerhubaneo/armonik_core_htcmock_test_client", + "dockerhubaneo/armonik_core_bench_test_worker", + "dockerhubaneo/armonik_core_bench_test_client" + ], + "api": [], + "gui": [ + "dockerhubaneo/armonik_admin_app", + "dockerhubaneo/armonik_admin_api" + ], + "extcsharp": [ + "dockerhubaneo/armonik_worker_dll" + ], + "samples": [] + }, + "image_tags": { + "registry.k8s.io/autoscaling/cluster-autoscaler": "v1.23.0", + "registry.k8s.io/metrics-server/metrics-server": "v0.6.2", + "ghcr.io/kedacore/keda": "2.9.3", + "ghcr.io/kedacore/keda-metrics-apiserver": "2.9.3", + "public.ecr.aws/aws-ec2/aws-node-termination-handler": "v1.19.0", + "amazon/aws-efs-csi-driver": "v1.5.1", + "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe": "v2.9.0-eks-1-22-19", + "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar": "v2.7.0-eks-1-22-19", + "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner": "v3.4.0-eks-1-22-19", + "symptoma/activemq": "5.17.0", + "mongo": "6.0.1", + "redis": "7.0.8", + "minio/minio": "RELEASE.2023-02-10T18-48-39Z", + "datalust/seq": "2023.1", + "grafana/grafana": "9.3.6", + "prom/node-exporter": "v1.5.0", + "prom/prometheus": "v2.42.0", + "fluent/fluent-bit": "2.0.9", + "rtsp/mongosh": "1.7.1", + "nginx": "1.23.3", + "nginxinc/nginx-unprivileged": "1.23.3", + "datalust/seqcli": "2023.1" }, - [ - { - "Test": "bench", - "ElapsedTime": "00:00:18.3504645", - "SubmissionTime": "00:00:02.3141442", - "TasksExecutionTime": "00:00:13.9157812", - "ResultRetrievingTime": "00:00:02.0692890", - "CountExecutionTime": "00:00:00.0160471", - "TotalTasks": 1000, - "ErrorTasks": 0, - "CompletedTasks": 1000, - "CancelledTasks": 0, - "$type": "BenchOptions", - "NTasks": 1000, - "TaskDurationMs": 1, - "PayloadSize": 1, - "ResultSize": 1, - "BatchSize": 50, - "TaskRpcException": "", - "TaskError": "", - "Partition": "bench", - "ShowEvents": false, - "MaxRetries": 5, - "DegreeOfParallelism": 5, - "throughput": 78.1983109164842, - "nb_pods": 100 - } - ], - [ - { - "Test": "bench", - "ElapsedTime": "00:01:04.4384410", - "SubmissionTime": "00:00:10.5994994", - "TasksExecutionTime": "00:00:44.2651815", - "ResultRetrievingTime": "00:00:09.5377842", - "CountExecutionTime": "00:00:00.0217572", - "TotalTasks": 5000, - "ErrorTasks": 0, - "CompletedTasks": 5000, - "CancelledTasks": 0, - "$type": "BenchOptions", - "NTasks": 5000, - "TaskDurationMs": 1, - "PayloadSize": 1, - "ResultSize": 1, - "BatchSize": 50, - "TaskRpcException": "", - "TaskError": "", - "Partition": "bench", - "ShowEvents": false, - "MaxRetries": 5, - "DegreeOfParallelism": 5, - "throughput": 246.80388962930056, - "nb_pods": 100 - } - ] + "helm_charts": { + "keda": { + "repository": "https://kedacore.github.io/charts", + "version": "2.9.4" + }, + "metrics_server": { + "repository": "https://kubernetes-sigs.github.io/metrics-server/", + "version": "3.8.3" + }, + "cluster_autoscaler": { + "repository": "https://kubernetes.github.io/autoscaler", + "version": "9.24.0" + }, + "termination_handler": { + "repository": "https://aws.github.io/eks-charts", + "version": "0.21.0" + }, + "efs_csi_driver": { + "repository": "https://kubernetes-sigs.github.io/aws-efs-csi-driver/", + "version": "2.3.0" + } + }, + "test_environnement": { + "instance_type": "c24.xlarge", + "Processor": "Intel Xeon de 2e (Cascade Lake)", + "CPU_frequency": "3.6 GHz - 3.9 GHz", + "nb_cpus": "96", + "RAM": "192", + "Network_bandwidth": "25", + "EBS_bandwidth": "19000", + "Kubernetes": "AWS EKS 1.25", + "Object_object_type": "AWS S3", + "Storage_queue_storage": "Amazon MQ, broker : ActiveMQ 5.16.4", + "Storage_table_type": "MongoDB 6.0.1", + "OS": "Linux" + } + }, + [ + { + "Test": "bench", + "ElapsedTime": "00:00:17.3338445", + "SubmissionTime": "00:00:02.2282835", + "TasksExecutionTime": "00:00:12.4735445", + "ResultRetrievingTime": "00:00:02.6031342", + "CountExecutionTime": "00:00:00.0250447", + "TotalTasks": 1000, + "ErrorTasks": 0, + "CompletedTasks": 1000, + "CancelledTasks": 0, + "$type": "BenchOptions", + "NTasks": 1000, + "TaskDurationMs": 1, + "PayloadSize": 1, + "ResultSize": 1, + "BatchSize": 50, + "TaskRpcException": "", + "TaskError": "", + "Partition": "bench", + "ShowEvents": false, + "MaxRetries": 5, + "DegreeOfParallelism": 5, + "throughput": 450.6534474988734, + "nb_pods": 100 + } + ], + [ + { + "Test": "bench", + "ElapsedTime": "00:01:30.3747670", + "SubmissionTime": "00:00:11.2812712", + "TasksExecutionTime": "00:01:06.3434008", + "ResultRetrievingTime": "00:00:12.7157179", + "CountExecutionTime": "00:00:00.0366380", + "TotalTasks": 5000, + "ErrorTasks": 0, + "CompletedTasks": 5000, + "CancelledTasks": 0, + "$type": "BenchOptions", + "NTasks": 5000, + "TaskDurationMs": 1, + "PayloadSize": 1, + "ResultSize": 1, + "BatchSize": 50, + "TaskRpcException": "", + "TaskError": "", + "Partition": "bench", + "ShowEvents": false, + "MaxRetries": 5, + "DegreeOfParallelism": 5, + "throughput": 442.3995752964077, + "nb_pods": 100 + } + ] ] \ No newline at end of file diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh index e246d8401..5a10b1554 100755 --- a/test/bench/100_pods/redis/test_scripts/test.sh +++ b/test/bench/100_pods/redis/test_scripts/test.sh @@ -19,3 +19,5 @@ #print the test stats and plot graphs #../python_scripts/wjson.py + +rm ../stats/1k.json ../stats/5k.json diff --git a/test/htcmock/100_pods/redis/python_scripts/cleaner.py b/test/htcmock/100_pods/redis/python_scripts/cleaner.py index 64c17029d..1ba63fed1 100755 --- a/test/htcmock/100_pods/redis/python_scripts/cleaner.py +++ b/test/htcmock/100_pods/redis/python_scripts/cleaner.py @@ -26,18 +26,13 @@ def clean_file(file): keep_tput.append(jline) dic_json = [{"Test": "htcmock"} | stats | {"configuration": conf, "throughput": tput, "nb_pods": 100} for stats, conf, tput in zip(keep_stats, keep_config, keep_tput)] - print(keep_stats) + # write a clean json file with needed data with open(file, 'w') as f: json.dump(dic_json, f) -# clean the stats file -# file = "../stats/4_agg/1k.json" + # clean_file(file) -file = "../stats/4_agg/5k.json" +file = "../stats/5k.json" clean_file(file) -# file = "../stats/4_agg/10k.json" -# clean_file(file) -# file = "out.json" -# clean_file(file) diff --git a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py index f040c62e8..8ebace6ab 100755 --- a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py +++ b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py @@ -11,7 +11,7 @@ result.append(json.load(test_env)) with open("../stats/5k.json", "r") as stats: result.append(json.load(stats)) -with open("result_4agg_1h.json", "w") as r: +with open("results.json", "w") as r: dict_json = [merge(result[0], result[1]), result[2]] json.dump(dict_json, r) diff --git a/test/htcmock/100_pods/redis/test_scripts/results.json b/test/htcmock/100_pods/redis/test_scripts/results.json new file mode 100644 index 000000000..2d43cd583 --- /dev/null +++ b/test/htcmock/100_pods/redis/test_scripts/results.json @@ -0,0 +1,126 @@ +[ + { + "armonik_versions": { + "armonik": "2.13.2", + "infra": "0.0.2", + "core": "0.13.2", + "api": "3.6.0", + "gui": "0.9.0", + "extcsharp": "0.11.1", + "samples": "2.13.2" + }, + "armonik_images": { + "armonik": [], + "infra": [ + "https://github.com/aneoconsulting/ArmoniK.Infra.git" + ], + "core": [ + "dockerhubaneo/armonik_pollingagent", + "dockerhubaneo/armonik_control_metrics", + "dockerhubaneo/armonik_control_partition_metrics", + "dockerhubaneo/armonik_control", + "dockerhubaneo/armonik_core_stream_test_worker", + "dockerhubaneo/armonik_core_stream_test_client", + "dockerhubaneo/armonik_core_htcmock_test_worker", + "dockerhubaneo/armonik_core_htcmock_test_client", + "dockerhubaneo/armonik_core_bench_test_worker", + "dockerhubaneo/armonik_core_bench_test_client" + ], + "api": [], + "gui": [ + "dockerhubaneo/armonik_admin_app", + "dockerhubaneo/armonik_admin_api" + ], + "extcsharp": [ + "dockerhubaneo/armonik_worker_dll" + ], + "samples": [] + }, + "image_tags": { + "registry.k8s.io/autoscaling/cluster-autoscaler": "v1.23.0", + "registry.k8s.io/metrics-server/metrics-server": "v0.6.2", + "ghcr.io/kedacore/keda": "2.9.3", + "ghcr.io/kedacore/keda-metrics-apiserver": "2.9.3", + "public.ecr.aws/aws-ec2/aws-node-termination-handler": "v1.19.0", + "amazon/aws-efs-csi-driver": "v1.5.1", + "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe": "v2.9.0-eks-1-22-19", + "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar": "v2.7.0-eks-1-22-19", + "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner": "v3.4.0-eks-1-22-19", + "symptoma/activemq": "5.17.0", + "mongo": "6.0.1", + "redis": "7.0.8", + "minio/minio": "RELEASE.2023-02-10T18-48-39Z", + "datalust/seq": "2023.1", + "grafana/grafana": "9.3.6", + "prom/node-exporter": "v1.5.0", + "prom/prometheus": "v2.42.0", + "fluent/fluent-bit": "2.0.9", + "rtsp/mongosh": "1.7.1", + "nginx": "1.23.3", + "nginxinc/nginx-unprivileged": "1.23.3", + "datalust/seqcli": "2023.1" + }, + "helm_charts": { + "keda": { + "repository": "https://kedacore.github.io/charts", + "version": "2.9.4" + }, + "metrics_server": { + "repository": "https://kubernetes-sigs.github.io/metrics-server/", + "version": "3.8.3" + }, + "cluster_autoscaler": { + "repository": "https://kubernetes.github.io/autoscaler", + "version": "9.24.0" + }, + "termination_handler": { + "repository": "https://aws.github.io/eks-charts", + "version": "0.21.0" + }, + "efs_csi_driver": { + "repository": "https://kubernetes-sigs.github.io/aws-efs-csi-driver/", + "version": "2.3.0" + } + }, + "test_environnement": { + "instance_type": "c24.xlarge", + "Processor": "Intel Xeon de 2e (Cascade Lake)", + "CPU_frequency": "3.6 GHz - 3.9 GHz", + "nb_cpus": "96", + "RAM": "192", + "Network_bandwidth": "25", + "EBS_bandwidth": "19000", + "Kubernetes": "AWS EKS 1.25", + "Object_object_type": "AWS S3", + "Storage_queue_storage": "Amazon MQ, broker : ActiveMQ 5.17.0", + "Storage_table_type": "MongoDB 6.0.1", + "OS": "Linux" + } + }, + [ + { + "Test": "htcmock", + "@t": "2023-07-03T14:06:40.8884583Z", + "@mt": "Client was executed in {time}s", + "@l": "Warning", + "time": 15.6904386, + "SourceContext": "Htc.Mock.Client", + "configuration": { + "@t": "2023-07-03T14:06:25.1939026Z", + "@mt": "Start new run with {configuration}", + "configuration": "{RunConfiguration: {TotalCalculationTime: 01:00:00,TotalNbSubTasks: 5000,Data: 1,Memory: 1,SubTasksLevels: 4,AvgDurationMs: 719.8560287942412,MinDurationMs: 239,MaxDurationMs: 21595}}", + "SourceContext": "Htc.Mock.Client" + }, + "throughput": { + "@t": "2023-07-03T14:11:52.8259331Z", + "@mt": "Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})", + "session": "5439ba2a-5b22-4263-88f9-42001d481faa", + "throughput": 731.8840579710145, + "nTasks": 6868, + "timespan": "00:00:09.3840000", + "SourceContext": "ArmoniK.Samples.HtcMock.Client.GridClient" + }, + "nb_pods": 100 + } + ] +] \ No newline at end of file diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh index 4b360ca82..4f46fc0a5 100755 --- a/test/htcmock/100_pods/redis/test_scripts/test.sh +++ b/test/htcmock/100_pods/redis/test_scripts/test.sh @@ -19,3 +19,5 @@ #print the test stats and plot graphs #../python_scripts/wjson.py + +rm ../stats/5k.json \ No newline at end of file From b7b39b81eb70c1e69bc972ef19350640b4b31f19 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Tue, 4 Jul 2023 10:15:28 +0200 Subject: [PATCH 08/38] keep cleaned stats files --- test/README.md | 55 ++++++++++--------- .../bench/100_pods/redis/test_scripts/test.sh | 1 - .../100_pods/redis/test_scripts/test.sh | 2 - 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/test/README.md b/test/README.md index 47efe6572..ef46c254f 100644 --- a/test/README.md +++ b/test/README.md @@ -3,33 +3,6 @@ This document describe how to use the benchmarking scripts. -## Bench - -### Run the tests - -* Scripts for each test where we set the parameters of the test to run. -* Script to run all the tests cases and store the results in Json files using python scripts. - -### Clean the output - -* cleaner.py will clean the json output files. -Parameters : path to the json files we want to clean. - - -* merge_jsons.py : merges test_env.json which is a json file which describes the test environment(third party components of ArmoniK) and we have to set it for each test with the parameters json file of the tested version of ArmoniK with the clean results of the test. -* prerequisites: we have to install jsonmerge (pip install jsonmerge) - -### Analyse the results - -wjson will read the clean json files and calculate the results. - -* Parameters : List of clean json files - -### How to use it : -* Run the script test_scripts/test.sh to run the tests, store the outputs, clean them and merge them with the environment and infrastructure description files. - - - #### Folder tree
@@ -62,3 +35,31 @@ wjson will read the clean json files and calculate the results.
 ├── README.md  
 
 
+ +## Bench and Htcmock + +### Run the tests + +* Scripts for each test where we set the parameters of the test to run. +* Script to run all the tests cases and store the results in Json files using python scripts. + +### Clean the output + +* cleaner.py will clean the json output files. +Parameters : path to the json files we want to clean. + + +* merge_jsons.py : merges test_env.json which is a json file which describes the test environment(third party components of ArmoniK) and we have to set it for each test with the parameters json file of the tested version of ArmoniK with the clean results of the test. +* prerequisites: we have to install jsonmerge (pip install jsonmerge) + +### Analyse the results + +wjson will read the clean json files and calculate the results. + +* Parameters : List of clean json files + +### How to use it : +* Run the script test_scripts/test.sh to run the tests, store the outputs, clean them and merge them with the environment and infrastructure description files. + + + diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh index 5a10b1554..183daeed7 100755 --- a/test/bench/100_pods/redis/test_scripts/test.sh +++ b/test/bench/100_pods/redis/test_scripts/test.sh @@ -20,4 +20,3 @@ #print the test stats and plot graphs #../python_scripts/wjson.py -rm ../stats/1k.json ../stats/5k.json diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh index 4f46fc0a5..4b360ca82 100755 --- a/test/htcmock/100_pods/redis/test_scripts/test.sh +++ b/test/htcmock/100_pods/redis/test_scripts/test.sh @@ -19,5 +19,3 @@ #print the test stats and plot graphs #../python_scripts/wjson.py - -rm ../stats/5k.json \ No newline at end of file From 608a0a7f671f006a0a4dc51b514c1cb2659bb1e0 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Tue, 4 Jul 2023 10:42:47 +0200 Subject: [PATCH 09/38] clean code --- test/README.md | 11 +++++------ test/bench/100_pods/redis/test_scripts/test.sh | 8 +------- test/htcmock/100_pods/redis/test_scripts/test.sh | 8 +------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/test/README.md b/test/README.md index ef46c254f..aca2a04e6 100644 --- a/test/README.md +++ b/test/README.md @@ -40,21 +40,21 @@ This document describe how to use the benchmarking scripts. ### Run the tests -* Scripts for each test where we set the parameters of the test to run. -* Script to run all the tests cases and store the results in Json files using python scripts. +* bench_1k.sh & bench_5k.sh : scripts for each test where we set the parameters of the test to run. +* test.sh : script to run all the tests cases and store the results in Json files. ### Clean the output -* cleaner.py will clean the json output files. +* cleaner.py : will clean the json output files. Parameters : path to the json files we want to clean. -* merge_jsons.py : merges test_env.json which is a json file which describes the test environment(third party components of ArmoniK) and we have to set it for each test with the parameters json file of the tested version of ArmoniK with the clean results of the test. +* merge_jsons.py : merges the cleaned results files with the parameters json file of the tested version of ArmoniK and est_env.json file (third party components of ArmoniK). * prerequisites: we have to install jsonmerge (pip install jsonmerge) ### Analyse the results -wjson will read the clean json files and calculate the results. +wjson.py : will read the clean stats files so we can manipulate the data. * Parameters : List of clean json files @@ -62,4 +62,3 @@ wjson will read the clean json files and calculate the results. * Run the script test_scripts/test.sh to run the tests, store the outputs, clean them and merge them with the environment and infrastructure description files. - diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh index 183daeed7..629dfbbe1 100755 --- a/test/bench/100_pods/redis/test_scripts/test.sh +++ b/test/bench/100_pods/redis/test_scripts/test.sh @@ -1,15 +1,9 @@ #!/bin/bash -#lunch runs with the same nb pods # warm up run -#./bench_10k.sh +./bench_10k.sh #clearmeasured runs -#for i in {1..3} -#do -# ./bench_10k.sh >> 10k.json -#done - ./bench_1k.sh >> ../stats/1k.json && ./bench_5k.sh >> ../stats/5k.json #clean the output file ../python_scripts/cleaner.py diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh index 4b360ca82..2c3a83024 100755 --- a/test/htcmock/100_pods/redis/test_scripts/test.sh +++ b/test/htcmock/100_pods/redis/test_scripts/test.sh @@ -1,15 +1,9 @@ #!/bin/bash -#lunch runs with the same nb pods # warm up run -#./bench_10k.sh +./bench_10k.sh #clearmeasured runs -#for i in {1..3} -#do -# ./bench_10k.sh >> 10k.json -#done - ./htcmock_5k.sh >> ../stats/5k.json #clean the output file ../python_scripts/cleaner.py From d1e6b47352a5a89e4d97184e9e99200c7eb24de6 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Tue, 4 Jul 2023 11:52:42 +0200 Subject: [PATCH 10/38] doc correction --- test/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/README.md b/test/README.md index aca2a04e6..fb280b756 100644 --- a/test/README.md +++ b/test/README.md @@ -1,6 +1,6 @@ # HOW TO USE IT -This document describe how to use the benchmarking scripts. +This document describes how to use the benchmarking scripts. #### Folder tree From 82740b1cc1ca0e144bf60b4b4cd9bd3fb81d0bd8 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Tue, 4 Jul 2023 16:48:08 +0200 Subject: [PATCH 11/38] update doc --- test/README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/README.md b/test/README.md index fb280b756..d895328e6 100644 --- a/test/README.md +++ b/test/README.md @@ -2,8 +2,8 @@ This document describes how to use the benchmarking scripts. - -#### Folder tree +Those tests are an example of benchmarking tests using bench and htcmock to measure the performances of ArmoniK. +We have to deploy ArmoniK on aws with two partitions (bench and htcmock) with 100 pods for each partition using redis as storage.
 .  
@@ -36,7 +36,8 @@ This document describes how to use the benchmarking scripts.
 
 
-## Bench and Htcmock + +# Bench & Htcmock ### Run the tests @@ -58,7 +59,14 @@ wjson.py : will read the clean stats files so we can manipulate the data. * Parameters : List of clean json files -### How to use it : -* Run the script test_scripts/test.sh to run the tests, store the outputs, clean them and merge them with the environment and infrastructure description files. +### How to run the tests : +#### Linux : +* Run the script test.sh in the directory /test/bench/100_pods/redis/test_scripts to run the tests of bench, store the outputs, clean them and merge them with the environment and infrastructure description files. +* Run the script test.sh in the directory /test/htcmock/100_pods/redis/test_scripts to run the tests of htcmock, store the outputs, clean them and merge them with the environment and infrastructure description files. +```console +user@user:~$ ./test.sh +``` +# Stresstest : +TODO: From 624378e28aa8a8a8cdae0f8dbf62e774d0f0fb0c Mon Sep 17 00:00:00 2001 From: YKharouni Date: Wed, 5 Jul 2023 11:25:57 +0200 Subject: [PATCH 12/38] add aws benchmarking deployment example --- .../quick-deploy/aws-benchmark/Makefile | 320 +++++++++++++ .../quick-deploy/aws-benchmark/README.md | 420 ++++++++++++++++++ .../aws-benchmark/armonik/Makefile | 73 +++ .../aws-benchmark/armonik/backend.tf | 10 + .../aws-benchmark/armonik/locals.tf | 0 .../aws-benchmark/armonik/main.tf | 32 ++ .../aws-benchmark/armonik/outputs.tf | 12 + .../aws-benchmark/armonik/parameters.tfvars | 374 ++++++++++++++++ .../aws-benchmark/armonik/providers.tf | 24 + .../aws-benchmark/armonik/variables.tf | 264 +++++++++++ .../aws-benchmark/armonik/versions.tf | 12 + .../aws-benchmark/backend/Makefile | 27 ++ .../backend/backend-resources.yaml | 127 ++++++ .../quick-deploy/aws-benchmark/ecr/Makefile | 68 +++ .../quick-deploy/aws-benchmark/ecr/backend.tf | 10 + .../quick-deploy/aws-benchmark/ecr/locals.tf | 24 + .../quick-deploy/aws-benchmark/ecr/main.tf | 16 + .../quick-deploy/aws-benchmark/ecr/outputs.tf | 4 + .../aws-benchmark/ecr/parameters.tfvars | 184 ++++++++ .../aws-benchmark/ecr/providers.tf | 4 + .../aws-benchmark/ecr/variables.tf | 36 ++ .../aws-benchmark/ecr/versions.tf | 16 + .../quick-deploy/aws-benchmark/eks/Makefile | 76 ++++ .../quick-deploy/aws-benchmark/eks/backend.tf | 10 + .../quick-deploy/aws-benchmark/eks/locals.tf | 43 ++ .../quick-deploy/aws-benchmark/eks/main.tf | 54 +++ .../quick-deploy/aws-benchmark/eks/outputs.tf | 19 + .../aws-benchmark/eks/parameters.tfvars | 296 ++++++++++++ .../aws-benchmark/eks/providers.tf | 33 ++ .../aws-benchmark/eks/variables.tf | 138 ++++++ .../aws-benchmark/eks/versions.tf | 28 ++ .../quick-deploy/aws-benchmark/envvars.sh | 9 + .../quick-deploy/aws-benchmark/keda/Makefile | 71 +++ .../aws-benchmark/keda/backend.tf | 10 + .../quick-deploy/aws-benchmark/keda/locals.tf | 14 + .../quick-deploy/aws-benchmark/keda/main.tf | 21 + .../aws-benchmark/keda/outputs.tf | 4 + .../aws-benchmark/keda/parameters.tfvars | 28 ++ .../aws-benchmark/keda/providers.tf | 19 + .../aws-benchmark/keda/variables.tf | 56 +++ .../aws-benchmark/keda/versions.tf | 0 .../aws-benchmark/metrics-server/Makefile | 71 +++ .../aws-benchmark/metrics-server/backend.tf | 10 + .../aws-benchmark/metrics-server/locals.tf | 17 + .../aws-benchmark/metrics-server/main.tf | 15 + .../aws-benchmark/metrics-server/outputs.tf | 4 + .../metrics-server/parameters.tfvars | 37 ++ .../aws-benchmark/metrics-server/providers.tf | 19 + .../aws-benchmark/metrics-server/variables.tf | 78 ++++ .../aws-benchmark/metrics-server/versions.tf | 0 .../aws-benchmark/monitoring/Makefile | 76 ++++ .../aws-benchmark/monitoring/backend.tf | 10 + .../aws-benchmark/monitoring/iam.tf | 61 +++ .../aws-benchmark/monitoring/locals.tf | 99 +++++ .../aws-benchmark/monitoring/main.tf | 164 +++++++ .../aws-benchmark/monitoring/outputs.tf | 52 +++ .../monitoring/parameters.tfvars | 136 ++++++ .../aws-benchmark/monitoring/providers.tf | 24 + .../aws-benchmark/monitoring/secrets.tf | 92 ++++ .../aws-benchmark/monitoring/variables.tf | 151 +++++++ .../aws-benchmark/monitoring/versions.tf | 16 + .../aws-benchmark/storage/Makefile | 79 ++++ .../aws-benchmark/storage/backend.tf | 10 + .../aws-benchmark/storage/locals.tf | 72 +++ .../aws-benchmark/storage/main.tf | 162 +++++++ .../aws-benchmark/storage/outputs.tf | 35 ++ .../aws-benchmark/storage/parameters.tfvars | 176 ++++++++ .../aws-benchmark/storage/providers.tf | 24 + .../storage/s3-iam-object-storage.tf | 68 +++ .../aws-benchmark/storage/s3-iam.tf | 57 +++ .../aws-benchmark/storage/secrets.tf | 99 +++++ .../aws-benchmark/storage/variables.tf | 230 ++++++++++ .../aws-benchmark/storage/versions.tf | 32 ++ .../quick-deploy/aws-benchmark/vpc/Makefile | 70 +++ .../quick-deploy/aws-benchmark/vpc/backend.tf | 10 + .../quick-deploy/aws-benchmark/vpc/locals.tf | 26 ++ .../quick-deploy/aws-benchmark/vpc/main.tf | 27 ++ .../quick-deploy/aws-benchmark/vpc/outputs.tf | 14 + .../aws-benchmark/vpc/parameters.tfvars | 60 +++ .../aws-benchmark/vpc/providers.tf | 4 + .../aws-benchmark/vpc/variables.tf | 64 +++ .../aws-benchmark/vpc/versions.tf | 16 + test/README.md | 2 +- .../redis/python_scripts/merge_jsons.py | 2 +- .../100_pods/redis/test_scripts/bench_1k.sh | 2 +- .../100_pods/redis/test_scripts/bench_5k.sh | 2 +- .../bench/100_pods/redis/test_scripts/test.sh | 2 +- .../redis/python_scripts/merge_jsons.py | 2 +- .../100_pods/redis/test_scripts/htcmock_5k.sh | 2 +- .../100_pods/redis/test_scripts/test.sh | 2 +- 90 files changed, 5461 insertions(+), 8 deletions(-) create mode 100644 infrastructure/quick-deploy/aws-benchmark/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/README.md create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/backend/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/envvars.sh create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/secrets.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/s3-iam-object-storage.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/Makefile create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/main.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf diff --git a/infrastructure/quick-deploy/aws-benchmark/Makefile b/infrastructure/quick-deploy/aws-benchmark/Makefile new file mode 100644 index 000000000..7b5245f8e --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/Makefile @@ -0,0 +1,320 @@ +export ARMONIK_SUFFIX?=main +export ARMONIK_REGION?=eu-west-3 +export ARMONIK_PROFILE?=default +export ARMONIK_BUCKET_NAME?=armonik-tfstate +export ARMONIK_KUBERNETES_NAMESPACE?=armonik +export KEDA_KUBERNETES_NAMESPACE?=default +export METRICS_SERVER_KUBERNETES_NAMESPACE?=kube-system +export TFSTATE_BUCKET_NAME=$(ARMONIK_BUCKET_NAME)-$(ARMONIK_SUFFIX) +export PUBLIC_VPC?=true +export PUBLIC_ACCESS_EKS?=true + +CURRENT_DIR=$(shell pwd) +VPC_PARAMETERS_FILE?=$(CURRENT_DIR)/vpc/generated/vpc-output.json +STORAGE_PARAMETERS_FILE?=$(CURRENT_DIR)/storage/generated/storage-output.json +MONITORING_PARAMETERS_FILE?=$(CURRENT_DIR)/monitoring/generated/monitoring-output.json +EKS_PARAMETERS_FILE?=$(CURRENT_DIR)/eks/generated/eks-output.json +KUBECONFIG?=$(CURRENT_DIR)/eks/generated/kubeconfig +GENERATED_DIR=$(CURRENT_DIR)/generated +MODULES_DIR=$(GENERATED_DIR)/infra-modules +VERSIONS_FILE?=$(shell realpath ../../../versions.tfvars.json) + +#################################### +# KSM and S3 buckets for TF states # +#################################### + +deploy-s3-of-backend: + $(MAKE) -C $(CURRENT_DIR)/backend deploy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + BUCKET_NAME=$(ARMONIK_BUCKET_NAME) \ + PROFILE=$(ARMONIK_PROFILE) + +destroy-s3-of-backend: + $(MAKE) -C $(CURRENT_DIR)/backend destroy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + BUCKET_NAME=$(ARMONIK_BUCKET_NAME) \ + PROFILE=$(ARMONIK_PROFILE) + +#################################### +# AWS VPC # +#################################### + +deploy-vpc: + $(MAKE) -C $(CURRENT_DIR)/vpc deploy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + PUBLIC_VPC=$(PUBLIC_VPC) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +destroy-vpc: + $(MAKE) -C $(CURRENT_DIR)/vpc destroy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + PUBLIC_VPC=$(PUBLIC_VPC) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-vpc: + $(MAKE) -C $(CURRENT_DIR)/vpc clean + +#################################### +# AWS ECR # +#################################### + +deploy-ecr: + $(MAKE) -C $(CURRENT_DIR)/ecr deploy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +destroy-ecr: + $(MAKE) -C $(CURRENT_DIR)/ecr destroy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-ecr: + $(MAKE) -C $(CURRENT_DIR)/ecr clean + +#################################### +# AWS EKS # +#################################### + +deploy-eks: + $(MAKE) -C $(CURRENT_DIR)/eks deploy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + PUBLIC_ACCESS_EKS=$(PUBLIC_ACCESS_EKS) \ + KUBECONFIG=$(KUBECONFIG) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +destroy-eks: + $(MAKE) -C $(CURRENT_DIR)/eks destroy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + PUBLIC_ACCESS_EKS=$(PUBLIC_ACCESS_EKS) \ + KUBECONFIG=$(KUBECONFIG) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-eks: + $(MAKE) -C $(CURRENT_DIR)/eks clean + +#################################### +# Kubernetes namespace # +#################################### + +create-namespace: + @KEDA=$(shell kubectl --kubeconfig $(KUBECONFIG) get deploy -A -l app=keda-operator --no-headers=true -o name) + @METRICS_SERVER=$(shell kubectl --kubeconfig $(KUBECONFIG) get deploy -A -l k8s-app=metrics-server --no-headers=true -o name) + @kubectl --kubeconfig $(KUBECONFIG) get namespace $(ARMONIK_KUBERNETES_NAMESPACE) > /dev/null 2>&1 && echo "namespace : '$(ARMONIK_KUBERNETES_NAMESPACE)' is already created." || kubectl --kubeconfig $(KUBECONFIG) create namespace $(ARMONIK_KUBERNETES_NAMESPACE) + @kubectl --kubeconfig $(KUBECONFIG) get namespace $(KEDA_KUBERNETES_NAMESPACE) > /dev/null 2>&1 && echo "namespace : '$(KEDA_KUBERNETES_NAMESPACE)' is already created." || kubectl --kubeconfig $(KUBECONFIG) create namespace $(KEDA_KUBERNETES_NAMESPACE) + @kubectl --kubeconfig $(KUBECONFIG) get namespace $(METRICS_SERVER_KUBERNETES_NAMESPACE) > /dev/null 2>&1 && echo "namespace : '$(METRICS_SERVER_KUBERNETES_NAMESPACE)' is already created." || kubectl --kubeconfig $(KUBECONFIG) create namespace $(METRICS_SERVER_KUBERNETES_NAMESPACE) + +delete-namespace: + kubectl --kubeconfig $(KUBECONFIG) delete namespace $(ARMONIK_KUBERNETES_NAMESPACE) || true + kubectl --kubeconfig $(KUBECONFIG) delete namespace $(KEDA_KUBERNETES_NAMESPACE) || true + kubectl --kubeconfig $(KUBECONFIG) delete namespace $(METRICS_SERVER_KUBERNETES_NAMESPACE) || true + +#################################### +# KEDA # +#################################### + +deploy-keda: + @if [ "${KEDA}" = "" ]; then\ + $(MAKE) -C $(CURRENT_DIR)/keda deploy \ + NAMESPACE=$(KEDA_KUBERNETES_NAMESPACE) \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE);\ + fi + +destroy-keda: + $(MAKE) -C $(CURRENT_DIR)/keda destroy \ + NAMESPACE=$(KEDA_KUBERNETES_NAMESPACE) \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-keda: + $(MAKE) -C $(CURRENT_DIR)/keda clean + +#################################### +# Metrics server # +#################################### + +deploy-metrics-server: + $(MAKE) -C $(CURRENT_DIR)/metrics-server deploy \ + NAMESPACE=$(METRICS_SERVER_KUBERNETES_NAMESPACE) \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +destroy-metrics-server: + $(MAKE) -C $(CURRENT_DIR)/metrics-server destroy \ + NAMESPACE=$(METRICS_SERVER_KUBERNETES_NAMESPACE) \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-metrics-server: + $(MAKE) -C $(CURRENT_DIR)/metrics-server clean + +#################################### +# AWS Storage # +#################################### + +deploy-storage: + $(MAKE) -C $(CURRENT_DIR)/storage deploy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ + VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ + EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +destroy-storage: + $(MAKE) -C $(CURRENT_DIR)/storage destroy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ + VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ + EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-storage: + $(MAKE) -C $(CURRENT_DIR)/storage clean + +#################################### +# Monitoring # +#################################### + +deploy-monitoring: + $(MAKE) -C $(CURRENT_DIR)/monitoring deploy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ + STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ + EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +destroy-monitoring: + $(MAKE) -C $(CURRENT_DIR)/monitoring destroy \ + SUFFIX=$(ARMONIK_SUFFIX) \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ + STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ + EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-monitoring: + $(MAKE) -C $(CURRENT_DIR)/monitoring clean + +#################################### +# ArmoniK # +#################################### + +deploy-armonik: + $(MAKE) -C $(CURRENT_DIR)/armonik deploy \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ + STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ + MONITORING_PARAMETERS_FILE=$(MONITORING_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +destroy-armonik: + $(MAKE) -C $(CURRENT_DIR)/armonik destroy \ + REGION=$(ARMONIK_REGION) \ + PROFILE=$(ARMONIK_PROFILE) \ + KUBECONFIG=$(KUBECONFIG) \ + NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ + STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ + MONITORING_PARAMETERS_FILE=$(MONITORING_PARAMETERS_FILE) \ + TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ + MODULES_DIR=$(MODULES_DIR) \ + VERSIONS_FILE=$(VERSIONS_FILE) + +clean-armonik: + $(MAKE) -C $(CURRENT_DIR)/armonik clean + +#################################### +# KUBECONFIG # +#################################### + +kubeconfig: + @echo "Execute the following commands:" + @echo "------------------------------" + @echo "export KUBECONFIG=$(shell cat $(EKS_PARAMETERS_FILE) | jq -r '.eks.kubeconfig_file')" + +#################################### +# Modules # +#################################### + +clean-modules: + @rm -rf $(GENERATED_DIR) + +#################################### +# All # +#################################### + +deploy-all: deploy-vpc deploy-ecr deploy-eks create-namespace deploy-keda deploy-metrics-server deploy-storage deploy-monitoring deploy-armonik kubeconfig + +destroy-all: destroy-armonik destroy-monitoring destroy-storage destroy-metrics-server destroy-keda delete-namespace destroy-eks destroy-ecr destroy-vpc + +clean-all: clean-armonik clean-monitoring clean-storage clean-metrics-server clean-keda clean-eks clean-ecr clean-vpc clean-modules diff --git a/infrastructure/quick-deploy/aws-benchmark/README.md b/infrastructure/quick-deploy/aws-benchmark/README.md new file mode 100644 index 000000000..e9e9d780d --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/README.md @@ -0,0 +1,420 @@ +# Table of contents + +- [Table of contents](#table-of-contents) +- [Introduction](#introduction) +- [Prerequisites](#prerequisites) + - [Software](#software) + - [AWS credentials](#aws-credentials) +- [Set environment variables](#set-environment-variables) +- [Prepare backend for Terraform](#preapre-backend-for-terraform) +- [Deploy infrastructure](#deploy-infrastructure) + - [AWS VPC](#aws-vpc) + - [AWS ECR](#aws-ecr) + - [AWS EKS](#aws-eks) + - [KEDA](#keda) + - [Metrics server](#metrics-server) + - [Storage](#storage) + - [Monitoring](#monitoring) +- [Deploy ArmoniK](#deploy-armonik) +- [Merge multiple kubeconfig](#merge-multiple-kubeconfig) +- [Clean-up](#clean-up) + +# Introduction + +Hereafter, You have instructions to deploy infrastructure for ArmoniK on AWS cloud. + +The infrastructure is composed of: + +* AWS VPC +* AWS ECR for docker images +* AWS EKS +* [KEDA](https://keda.sh/) +* Storage: + * AWS S3 buckets: + * to save safely `.tfsate` + * to upload `.dll` for worker pods + * AWS Elasticache (Redis engine) + * Amazon MQ (ActiveMQ broker engine) + * Onpremise MongoDB +* Monitoring: + * AWS CloudWatch + * Fluent-bit + * Grafana + * Keda + * Metrics exporter + * Metrics server + * Node exporter + * Partition metrics exporter + * Prometheus + * Seq server for structured log data of ArmoniK +* ArmoniK: + * Control plane + * Compute plane: + * polling agent + * workers + * Ingress + * Admin GUI + +# Prerequisites + +## Software + +The following software or tool should be installed upon your local Linux machine or VM from which you deploy the +infrastructure: + +* If You have Windows machine, You can install [WSL 2](../../docs/kubernetes/localhost/wsl2.md) +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) version 2 +* [Docker](https://docs.docker.com/engine/install/) +* [GNU make](https://www.gnu.org/software/make/) +* [JQ](https://stedolan.github.io/jq/download/) +* [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) v1.23.6 +* [Helm](https://helm.sh/docs/intro/install/) +* [Openssl](https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/) +* [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) version 1.0.9 and later + +## AWS credentials + +You must have credentials to be able to create AWS resources. You must create and provide +your [AWS programmatic access keys](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys) +in your environment as follows: + +```bash +mkdir -p ~/.aws +cat < +aws_secret_access_key = +EOF +``` + +You can check connectivity to AWS using the following command: + +```bash +aws sts get-caller-identity +``` + +the output of this command should be as follows: + +```bash +{ + "UserId": "", + "Account": "", + "Arn": "arn:aws:iam:::user/" +} +``` + +# Set environment variables + +From the **root** of the repository, position yourself in directory `infrastructure/quick-deploy/aws`. + +```bash +cd infrastructure/quick-deploy/aws +``` + +You need to set a list of environment variables [envvars.sh](envvars.sh) : + +```bash +source envvars.sh +``` + +**or:** + +```bash +export ARMONIK_PROFILE=default +export ARMONIK_REGION=eu-west-3 +export ARMONIK_SUFFIX=main +export ARMONIK_BUCKET_NAME=armonik-tfstate +export ARMONIK_KUBERNETES_NAMESPACE=armonik +export KEDA_KUBERNETES_NAMESPACE=default +export METRICS_SERVER_KUBERNETES_NAMESPACE=kube-system +export PUBLIC_VPC=true +export PUBLIC_ACCESS_EKS=true +``` + +where: + +- `ARMONIK_PROFILE`: defines your AWS profile which has credentials to deploy in AWS Cloud +- `ARMONIK_REGION`: presents the region where all resources will be created +- `ARMONIK_SUFFIX`: will be used as suffix to the name of all resources +- `ARMONIK_BUCKET_NAME`: is the name of S3 bucket in which `.tfsate` will be safely stored +- `ARMONIK_KUBERNETES_NAMESPACE`: is the namespace in Kubernetes for ArmoniK +- `KEDA_KUBERNETES_NAMESPACE`: is the namespace in Kubernetes for [KEDA](https://keda.sh/) +- `METRICS_SERVER_KUBERNETES_NAMESPACE`: is the namespace in Kubernetes for metrics server +- `PUBLIC_VPC`: is boolean defining whether the AWS VPC to be deployed should be public +- `PUBLIC_ACCESS_EKS`: is boolean defining whether the AWS EKS to be deployed should have a public access + +**Warning:** `ARMONIK_SUFFIX` must be *UNIQUE* to allow resources to have unique name in AWS + +# Prepare backend for Terraform + +You need to create a S3 bucket to save safely `.tfstate` files of Terraform. This bucket will be encrypted with an AWS +KMS key. + +Execute the following command to create the S3 bucket: + +```bash +make deploy-s3-of-backend +``` + +# Deploy infrastructure + +## AWS VPC + +You need to create an AWS Virtual Private Cloud (VPC) that provides an isolated virtual network environment. The +parameters of this VPC are in [vpc/parameters.tfvars](vpc/parameters.tfvars). + +Execute the following command to create the VPC: + +```bash +make deploy-vpc +``` + +The VPC deployment generates an output file `vpc/generated/vpc-output.json` which contains information needed for the +deployments of storage and Kubernetes. + +## AWS ECR + +You need to create an AWS Elastic Container Registry (ECR) and push the container images needed for Kubernetes and +ArmoniK [ecr/parameters.tfvars](ecr/parameters.tfvars). + +Execute the following command to create the ECR and push the list of container images: + +```bash +make deploy-ecr +``` + +The list of created ECR repositories are in `ecr/generated/ecr-output.json`. + +## AWS EKS + +You need to create an AWS Elastic Kubernetes Service (EKS). The parameters of EKS to be created are defined +in [eks/parameters.tfvars](eks/parameters.tfvars). + +Execute the following command to create the EKS: + +```bash +make deploy-eks +``` + +**or:** + +```bash +make deploy-eks VPC_PARAMETERS_FILE= +``` + +where: + +- `` is the **absolute** path to file `vpc/generated/vpc-output.json` containing the information + about the VPC previously created. + +The EKS deployment generates an output file `eks/generated/eks-output.json`. + +### Create Kubernetes namespace + +After the EKS deployment, You create a Kubernetes namespaces for ArmoniK with the name set in the environment +variable`ARMONIK_KUBERNETES_NAMESPACE`, for KEDA with the name set in the environment +variable`KEDA_KUBERNETES_NAMESPACE` and for Metrics server with the name set in the environment +variable`METRICS_SERVER_KUBERNETES_NAMESPACE`: + +```bash +make create-namespace +``` + +## KEDA + +The parameters of KEDA are defined in [keda/parameters.tfvars](keda/parameters.tfvars). + +Execute the following command to install KEDA: + +```bash +make deploy-keda +``` + +The Keda deployment generates an output file `keda/generated/keda-output.json`. + +**NOTE:** Please note that KEDA must be deployed only ONCE on the same Kubernetes cluster. + +## Metrics server + +The parameters of Metrics server are defined in [metrics-server/parameters.tfvars](metrics-server/parameters.tfvars). + +Execute the following command to install metrics server: + +```bash +make deploy-metrics-server +``` + +The metrics server deployment generates an output file `metrics-server/generated/metrics-server-output.json`. + +**NOTE:** Please note that metrics server must be deployed only ONCE on the same Kubernetes cluster. + +## Storage + +You need to create AWS storage for ArmoniK which are: + +* AWS Elasticache with Redis engine +* Amazon MQ with ActiveMQ broker engine +* Amazon S3 bucket to upload `.dll` for ArmoniK workers +* MongoDB as a Kubernetes service + +The parameters of each storage are defined in [storage/parameters.tfvars](storage/parameters.tfvars). + +Execute the following command to create the storage: + +```bash +make deploy-storage +``` + +**or:** + +```bash +make deploy-storage \ + VPC_PARAMETERS_FILE= \ + EKS_PARAMETERS_FILE= +``` + +where: + +- `` is the **absolute** path to file `vpc/generated/vpc-output.json` +- `` is the **absolute** path to file `eks/generated/eks-output.json` + +These files are input information for storage deployment containing the information about the VPC and EKS previously +created. + +The storage deployment generates an output file `storage/generated/storage-output.json` which contains information +needed for ArmoniK. + +## Monitoring + +You deploy the following resources for monitoring ArmoniK : + +* Seq to collect the ArmoniK application logs +* Grafana +* Prometheus + +The parameters of each monitoring resources are defined in [monitoring/parameters.tfvars](monitoring/parameters.tfvars). + +Execute the following command to create the monitoring tools: + +```bash +make deploy-monitoring +``` + +**or:** + +```bash +make deploy-monitoring \ + EKS_PARAMETERS_FILE= \ + STORAGE_PARAMETERS_FILE= +``` + +where: + +- `` is the **absolute** path to file `eks/generated/eks-output.json` containing the information + about the VPC previously created. +- `` is the **absolute** path to file `storage/generated/storage-output.json` containing the + information about the storage previously created. + +The monitoring deployment generates an output file `monitoring/generated/monitoring-output.json` that contains +information needed for ArmoniK. + +# Deploy ArmoniK + +After deploying the infrastructure, You can install ArmoniK in AWS EKS. The installation deploys: + +* ArmoniK control plane +* ArmoniK compute plane + +Execute the following command to deploy ArmoniK: + +```bash +make deploy-armonik +``` + +**or:** + +```bash +make deploy-armonik \ + STORAGE_PARAMETERS_FILE= \ + MONITORING_PARAMETERS_FILE= +``` + +where: + +- `` is the **absolute** path to file `storage/generated/storage-output.json` +- `` is the **absolute** path to file `monitoring/generated/monitoring-output.json` + +These files are input information for ArmoniK containing the information about storage and monitoring tools previously +created. + +The ArmoniK deployment generates an output file `armonik/generated/armonik-output.json` that contains the endpoint URL +of ArmoniK control plane. + +### All-in-one deploy + +All commands described above can be executed with one command. To deploy infrastructure and ArmoniK in all-in-one +command, You execute: + +```bash +make deploy-all +``` + +# Merge multiple kubeconfig + +When accessing multiple Kubernetes clusters, you will have many kubeconfig files. By default, kubectl only looks for a +file named config in the `$HOME/.kube` directory. + +So, to manage multiple Kubernetes clusters execute the following command: + +```bash +make kubeconfig +``` + +Export `KUBECONFIG` as displayed by the above command. + +# Clean-up + +To delete all resources created in AWS, You can execute the following all-in-one command: + +```bash +make destroy-all +``` + +**or:** execute the following commands in this order: + +```bash +make destroy-armonik +make destroy-monitoring +make destroy-storage +make destroy-metrics-server +make destroy-keda +make destroy-eks +make destroy-vpc +make destroy-ecr +``` + +To clean-up and delete all generated files, You execute: + +```bash +make clean-all +``` + +**or:** + +```bash +make clean-armonik +make clean-monitoring +make clean-storage +make clean-metrics-server +make clean-keda +make clean-eks +make clean-vpc +make clean-ecr +``` + +### [Return to the infrastructure main page](../../README.md) + +### [Return to the project main page](../../../README.md) + + + diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/Makefile b/infrastructure/quick-deploy/aws-benchmark/armonik/Makefile new file mode 100644 index 000000000..7af4435dc --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/Makefile @@ -0,0 +1,73 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +INGRESS_CERTIFICATES_DIR=$(GENERATED_DIR)/certificates/ingress +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=armonik-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/armonik-output.json +VERSIONS_FILE?=../../../../versions.tfvars.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export REGION?=eu-west-3 +export PROFILE?=default +export NAMESPACE?=armonik +export SUFFIX?=main +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) +export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"armonik\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json armonik >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf new file mode 100644 index 000000000..d03bb83bb --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "armonik-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "armonik" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/locals.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/locals.tf new file mode 100644 index 000000000..e69de29bb diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/main.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/main.tf new file mode 100644 index 000000000..840052853 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/main.tf @@ -0,0 +1,32 @@ +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 + extra_conf = { + compute = try(var.extra_conf.compute, {}) + control = try(var.extra_conf.control, {}) + core = try(var.extra_conf.core, {}) + log = try(var.extra_conf.log, {}) + polling = try(var.extra_conf.polling, {}) + worker = try(var.extra_conf.worker, {}) + } + compute_plane = { for k, v in var.compute_plane : k => merge({ + partition_data = { + priority = 1 + reserved_pods = 1 + max_pods = 100 + preemption_percentage = 50 + parent_partition_ids = [] + pod_configuration = null + } + }, v) } + control_plane = var.control_plane + admin_gui = var.admin_gui + admin_old_gui = var.admin_old_gui + ingress = var.ingress + job_partitions_in_database = var.job_partitions_in_database + authentication = var.authentication +} diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf new file mode 100644 index 000000000..3378a6629 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf @@ -0,0 +1,12 @@ +output "armonik" { + description = "ArmoniK endpoint URL" + value = { + control_plane_url = module.armonik.endpoint_urls.control_plane_url + grafana_url = module.armonik.endpoint_urls.grafana_url + seq_web_url = module.armonik.endpoint_urls.seq_web_url + admin_api_url = module.armonik.endpoint_urls.admin_api_url + admin_app_url = module.armonik.endpoint_urls.admin_app_url + admin_old_url = module.armonik.endpoint_urls.admin_old_url + } +} + diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars new file mode 100644 index 000000000..4db83836c --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars @@ -0,0 +1,374 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# Kubeconfig path +k8s_config_path = "~/.kube/config" + +# Kubeconfig context +k8s_config_context = "default" + +# Kubernetes namespace +namespace = "armonik" + +# Logging level +logging_level = "Information" + +# Job to insert partitions in the database +job_partitions_in_database = { + name = "job-partitions-in-database" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/mongosh" + tag = "1.7.1" + image_pull_policy = "IfNotPresent" + image_pull_secrets = "" + node_selector = { service = "control-plane" } + annotations = {} +} + +# Parameters of control plane +control_plane = { + name = "control-plane" + service_type = "ClusterIP" + replicas = 1 + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-control-plane" + tag = "0.13.2" + image_pull_policy = "IfNotPresent" + port = 5001 + limits = { + cpu = "1000m" + memory = "2048Mi" + } + requests = { + cpu = "200m" + memory = "500Mi" + } + image_pull_secrets = "" + node_selector = { service = "control-plane" } + annotations = {} + hpa = { + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 3 + max_replica_count = 3 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "cpu" + metric_type = "Utilization" + value = "80" + }, + { + type = "memory" + metric_type = "Utilization" + value = "80" + }, + ] + } + default_partition = "default" +} + +# Parameters of admin GUI +# Put to null if we not want deploy it +admin_gui = { + name = "admin-app" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-admin-app" + tag = "0.9.0" + port = 1080 + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + service_type = "ClusterIP" + replicas = 1 + image_pull_policy = "IfNotPresent" + image_pull_secrets = "" + node_selector = { service = "control-plane" } +} + +#Parameters of old admin GUI +admin_old_gui = { + api = { + name = "admin-api" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-admin-api-old" + tag = "0.8.0" + port = 3333 + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + } + old = { + name = "admin-old-gui" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-admin-app-old" + tag = "0.8.0" + port = 1080 + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + } + service_type = "ClusterIP" + replicas = 1 + image_pull_policy = "IfNotPresent" + image_pull_secrets = "" + node_selector = { service = "control-plane" } +} + +# Parameters of the compute plane +compute_plane = { + default = { + # number of replicas for each deployment of compute plane + replicas = 1 + termination_grace_period_seconds = 30 + image_pull_secrets = "" + node_selector = { service = "workers" } + annotations = {} + # ArmoniK polling agent + polling_agent = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" + tag = "0.13.2" + image_pull_policy = "IfNotPresent" + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "1000m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + name = "worker" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-worker" + tag = "0.11.1" + image_pull_policy = "IfNotPresent" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 1 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + #bench partition + bench = { + # number of replicas for each deployment of compute plane + replicas = 100 + termination_grace_period_seconds = 30 + image_pull_secrets = "" + node_selector = { service = "workers" } + annotations = {} + # ArmoniK polling agent + polling_agent = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" + tag = "0.13.2" + image_pull_policy = "IfNotPresent" + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "1000m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + name = "worker" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-bench" + tag = "0.13.2" + image_pull_policy = "IfNotPresent" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 100 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + #htcmock partition + htcmock = { + # number of replicas for each deployment of compute plane + replicas = 100 + termination_grace_period_seconds = 30 + image_pull_secrets = "" + node_selector = { service = "workers" } + annotations = {} + # ArmoniK polling agent + polling_agent = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" + tag = "0.13.2" + image_pull_policy = "IfNotPresent" + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "1000m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + name = "worker" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-htcmock" + tag = "0.13.2" + image_pull_policy = "IfNotPresent" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 100 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, +} + +# Deploy ingress +# PS: to not deploy ingress put: "ingress=null" +ingress = { + name = "ingress" + service_type = "LoadBalancer" + replicas = 1 + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/nginx" + tag = "1.23.3" + image_pull_policy = "IfNotPresent" + http_port = 5000 + grpc_port = 5001 + limits = null + requests = null + image_pull_secrets = "" + node_selector = { service = "control-plane" } + annotations = {} + tls = false + mtls = false + generate_client_cert = false + custom_client_ca_file = "" +} + +authentication = { + name = "job-authentication-in-database" + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/mongosh" + tag = "1.7.1" + image_pull_policy = "IfNotPresent" + image_pull_secrets = "" + node_selector = { service = "control-plane" } + authentication_datafile = "" + require_authentication = false + require_authorization = false +} + +extra_conf = { + core = { + Amqp__AllowHostMismatch = false + Amqp__MaxPriority = "10" + Amqp__MaxRetries = "5" + Amqp__QueueStorage__LockRefreshPeriodicity = "00:00:45" + Amqp__QueueStorage__PollPeriodicity = "00:00:10" + Amqp__QueueStorage__LockRefreshExtension = "00:02:00" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + MongoDB__TableStorage__PollingDelay = "00:00:01" + MongoDB__DataRetention = "10.00:00:00" + MongoDB__AllowInsecureTls = true + Redis__Timeout = 3000 + Redis__SslHost = "" + } + control = { + Submitter__MaxErrorAllowed = 50 + } +} + diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf new file mode 100644 index 000000000..6e2dbd516 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf @@ -0,0 +1,24 @@ +provider "aws" { + region = var.region + profile = var.profile +} + +# 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/aws-benchmark/armonik/variables.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/variables.tf new file mode 100644 index 000000000..ee09c9db3 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/variables.tf @@ -0,0 +1,264 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# Kubeconfig path +variable "k8s_config_path" { + description = "Path of the configuration file of K8s" + type = string + default = "~/.kube/config" +} + +# Kubeconfig context +variable "k8s_config_context" { + description = "Context of K8s" + type = string + default = "default" +} + +# Kubernetes namespace +variable "namespace" { + description = "Kubernetes namespace for ArmoniK" + type = string + default = "armonik" +} + +# Logging level +variable "logging_level" { + description = "Logging level in ArmoniK" + type = string + default = "Information" +} + +# List of needed storage +variable "storage_endpoint_url" { + description = "List of storage needed by ArmoniK" + type = any + default = {} +} + +# Monitoring +variable "monitoring" { + description = "Endpoint URL of monitoring" + type = any + default = {} +} + + +# Extra configuration +variable "extra_conf" { + description = "Add extra configuration in the configmaps" + #type = object({ + # compute = optional(map(string), {}) + # control = optional(map(string), {}) + # core = optional(map(string), {}) + # log = optional(map(string), {}) + # polling = optional(map(string), {}) + # worker = optional(map(string), {}) + #}) + type = any + default = {} +} + +# Job to insert partitions in the database +variable "job_partitions_in_database" { + description = "Job to insert partitions IDs in the database" + type = object({ + name = string + image = string + tag = string + image_pull_policy = string + image_pull_secrets = string + node_selector = any + annotations = any + }) +} + +# Parameters of control plane +variable "control_plane" { + description = "Parameters of the control plane" + type = object({ + name = string + service_type = string + replicas = number + image = string + tag = string + image_pull_policy = string + port = number + limits = object({ + cpu = string + memory = string + }) + requests = object({ + cpu = string + memory = string + }) + image_pull_secrets = string + node_selector = any + annotations = any + # KEDA scaler + hpa = any + default_partition = string + }) +} + +# Parameters of admin gui +variable "admin_gui" { + description = "Parameters of the admin GUI" + type = object({ + name = string + image = string + tag = string + port = number + limits = object({ + cpu = string + memory = string + }) + requests = object({ + cpu = string + memory = string + }) + service_type = string + replicas = number + image_pull_policy = string + image_pull_secrets = string + node_selector = any + }) + default = null +} + +variable "admin_old_gui" { + description = "Parameters of the old admin GUI" + type = object({ + api = object({ + name = string + image = string + tag = string + port = number + limits = object({ + cpu = string + memory = string + }) + requests = object({ + cpu = string + memory = string + }) + }) + old = object({ + name = string + image = string + tag = string + port = number + limits = object({ + cpu = string + memory = string + }) + requests = object({ + cpu = string + memory = string + }) + }) + service_type = string + replicas = number + image_pull_policy = string + image_pull_secrets = string + node_selector = any + }) + default = null +} + +# Parameters of the compute plane +variable "compute_plane" { + description = "Parameters of the compute plane" + type = map(object({ + replicas = number + termination_grace_period_seconds = number + image_pull_secrets = string + node_selector = any + annotations = any + polling_agent = object({ + image = string + tag = string + image_pull_policy = string + limits = object({ + cpu = string + memory = string + }) + requests = object({ + cpu = string + memory = string + }) + }) + worker = list(object({ + name = string + image = string + tag = string + image_pull_policy = string + limits = object({ + cpu = string + memory = string + }) + requests = object({ + cpu = string + memory = string + }) + })) + # KEDA scaler + hpa = any + })) +} + +variable "ingress" { + description = "Parameters of the ingress controller" + type = object({ + name = string + service_type = string + replicas = number + image = string + tag = string + image_pull_policy = string + http_port = number + grpc_port = number + limits = object({ + cpu = string + memory = string + }) + requests = object({ + cpu = string + memory = string + }) + image_pull_secrets = string + node_selector = any + annotations = any + tls = bool + mtls = bool + generate_client_cert = bool + custom_client_ca_file = string + }) +} + +# Authentication behavior +variable "authentication" { + description = "Authentication behavior" + type = object({ + name = string + image = string + tag = string + image_pull_policy = string + image_pull_secrets = string + node_selector = any + authentication_datafile = string + require_authentication = bool + require_authorization = bool + }) +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf new file mode 100644 index 000000000..4aa87e608 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf @@ -0,0 +1,12 @@ +terraform { + required_providers { + kubernetes = { + source = "hashicorp/kubernetes" + version = "~> 2.7.1" + } + tls = { + source = "hashicorp/tls" + version = "~> 4.0.4" + } + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/backend/Makefile b/infrastructure/quick-deploy/aws-benchmark/backend/Makefile new file mode 100644 index 000000000..68a8241e8 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/backend/Makefile @@ -0,0 +1,27 @@ +export SUFFIX?=main +export REGION?=eu-west-3 +export BUCKET_NAME?=armonik-tfstate +export PROFILE?=default +export TFSTATE_BUCKET_NAME=$(BUCKET_NAME)-$(SUFFIX) +BACKEND?=generated +YAML_SRC:=backend-resources.yaml + +all: deploy + +deploy: $(YAML_SRC) + @mkdir -p $(BACKEND) + aws --profile $(PROFILE) cloudformation create-stack --stack-name $(SUFFIX) --region $(REGION) --template-body file://$(YAML_SRC) --parameters ParameterKey=Tag,ParameterValue=$(SUFFIX) ParameterKey=BucketName,ParameterValue=$(BUCKET_NAME) + @echo "Waiting for cloud formation successful deployment" + @aws --profile $(PROFILE) cloudformation wait stack-create-complete --stack-name $(SUFFIX) --region $(REGION) + @aws --profile $(PROFILE) cloudformation describe-stacks --stack-name $(SUFFIX) --region $(REGION) --query 'Stacks[0]' > $(BACKEND)/output.json + +destroy: + aws --profile $(PROFILE) --region $(REGION) s3api delete-objects \ + --bucket "${TFSTATE_BUCKET_NAME}" \ + --delete "`aws s3api list-object-versions \ + --bucket "${TFSTATE_BUCKET_NAME}" \ + --output=json \ + --query='{Objects: Versions[].{Key:Key,VersionId:VersionId}}'`" + aws --profile $(PROFILE) cloudformation delete-stack --stack-name $(SUFFIX) --region $(REGION) + @aws --profile $(PROFILE) cloudformation wait stack-delete-complete --stack-name $(shell aws cloudformation describe-stacks --region $(REGION) --stack-name $(SUFFIX) --query 'Stacks[0].StackId' --output text) --region $(REGION) + diff --git a/infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml b/infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml new file mode 100644 index 000000000..9435da37a --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml @@ -0,0 +1,127 @@ +--- + +AWSTemplateFormatVersion: '2010-09-09' +Description: 'Security: KMS customer managed CMK for AWS services and S3 buckets for Terraform' +Metadata: + 'AWS::CloudFormation::Interface': + ParameterGroups: + - Label: + default: 'Tag needs to follow S3 naming rules.' + Parameters: + - Tag + - Label: + default: 'Name of S3 bucket' + Parameters: + - BucketName +Parameters: + Tag: + Description: 'Recommended to suffix the different required buckets' + Type: String + Default: '' + BucketName: + Description: 'Recommended to name S3 bucket' + Type: String + Default: '' +Resources: + Key: + DeletionPolicy: Delete + UpdateReplacePolicy: Retain + Type: 'AWS::KMS::Key' + Properties: + KeySpec: SYMMETRIC_DEFAULT + KeyUsage: ENCRYPT_DECRYPT + KeyPolicy: + Version: '2012-10-17' + Statement: + - Effect: Allow + Principal: + AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:root' + Action: 'kms:*' + Resource: '*' + - Effect: Allow + Principal: + AWS: !Sub '${AWS::AccountId}' + Action: + - kms:Encrypt* + - kms:Decrypt* + - kms:ReEncrypt* + - kms:GenerateDataKey* + - kms:Describe* + Resource: '*' + Condition: + StringEquals: + kms:ViaService: + - !Sub 'ec2.${AWS::Region}.amazonaws.com' + - !Sub 's3.${AWS::Region}.amazonaws.com' + - !Sub 'dynamodb.${AWS::Region}.amazonaws.com' + - !Sub 'ecr.${AWS::Region}.amazonaws.com' + - !Sub 'eks.${AWS::Region}.amazonaws.com' + - !Sub 'elasticache.${AWS::Region}.amazonaws.com' + - !Sub 'mq.${AWS::Region}.amazonaws.com' + - Effect: Allow + Principal: + Service: !Sub 'logs.${AWS::Region}.amazonaws.com' + Action: + - kms:Encrypt* + - kms:Decrypt* + - kms:ReEncrypt* + - kms:GenerateDataKey* + - kms:Describe* + Resource: '*' + Condition: + ArnEquals: + kms:EncryptionContext:aws:logs:arn: !Sub 'arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*:*' + - Effect: Allow + Principal: + AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling' + Action: + - kms:Encrypt* + - kms:Decrypt* + - kms:ReEncrypt* + - kms:GenerateDataKey* + - kms:Describe* + Resource: '*' + - Effect: Allow + Principal: + AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling' + Action: + - kms:CreateGrant + Resource: '*' + Condition: + Bool: + kms:GrantIsForAWSResource: true + KeyAlias: + DeletionPolicy: Delete + UpdateReplacePolicy: Retain + Type: 'AWS::KMS::Alias' + Properties: + AliasName: !Sub + - 'alias/armonik-kms-${Tag}-${RANDOM}' + - RANDOM: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] + TargetKeyId: !Ref Key + ArmoniKTfstate: + Type: 'AWS::S3::Bucket' + Properties: + BucketName: !Sub + - '${BucketName}-${Tag}' + - RANDOM: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] + VersioningConfiguration: + Status: Enabled + BucketEncryption: + ServerSideEncryptionConfiguration: + - ServerSideEncryptionByDefault: + SSEAlgorithm: 'aws:kms' + KMSMasterKeyID: !GetAtt 'Key.Arn' + DeletionPolicy: Delete +Outputs: + StackName: + Description: 'Stack name.' + Value: !Sub '${AWS::StackName}' + KeyArn: + Description: 'Key ARN.' + Value: !GetAtt 'Key.Arn' + Export: + Name: !Sub '${AWS::StackName}-KeyArn' + ArmoniKTfstateBucketId: + Description: 'S3 bucket name for .tfstates of ArmoniK' + Value: !Ref ArmoniKTfstate \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/Makefile b/infrastructure/quick-deploy/aws-benchmark/ecr/Makefile new file mode 100644 index 000000000..e95bf2329 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/Makefile @@ -0,0 +1,68 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=ecr-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/ecr-output.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export SUFFIX?=main +export REGION?=eu-west-3 +export PROFILE?=default +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -parallelism 1 \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"ecr_repositories\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json ecr_repositories >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf new file mode 100644 index 000000000..9af078478 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "ecr-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "ecr" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf new file mode 100644 index 000000000..e4db5499e --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf @@ -0,0 +1,24 @@ +# Current account +data "aws_caller_identity" "current" {} + +resource "random_string" "random_resources" { + length = 5 + special = false + upper = false + numeric = true +} + +resource "time_static" "creation_date" {} + +locals { + random_string = random_string.random_resources.result + suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string + kms_name = "armonik-kms-ecr-${local.suffix}-${local.random_string}" + repositories = [for element in var.ecr.repositories : merge(element, { name = "${local.suffix}/${element.name}" })] + tags = merge({ + "application" = "armonik" + "deployment version" = local.suffix + "created by" = data.aws_caller_identity.current.arn + "creation date" = time_static.creation_date.rfc3339 + }, var.tags) +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/main.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/main.tf new file mode 100644 index 000000000..0e1d5aece --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/main.tf @@ -0,0 +1,16 @@ +# AWS KMS +module "kms" { + count = (var.ecr.kms_key_id == "" ? 1 : 0) + source = "../generated/infra-modules/utils/aws/kms" + name = local.kms_name + tags = local.tags +} + +# AWS ECR +module "ecr" { + source = "../generated/infra-modules/container-registry/aws/ecr" + profile = var.profile + tags = local.tags + kms_key_id = (var.ecr.kms_key_id != "" ? var.ecr.kms_key_id : module.kms.0.arn) + repositories = var.ecr.repositories +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf new file mode 100644 index 000000000..98d1b3b5e --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf @@ -0,0 +1,4 @@ +# ECR images +output "ecr_repositories" { + value = module.ecr.repositories +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars new file mode 100644 index 000000000..18ec009d0 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars @@ -0,0 +1,184 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# SUFFIX +suffix = "main" + +# Tags +tags = { + "name" = "" + "env" = "" + "entity" = "" + "bu" = "" + "owner" = "" + "application code" = "" + "project code" = "" + "cost center" = "" + "Support Contact" = "" + "origin" = "terraform" + "unit of measure" = "" + "epic" = "" + "functional block" = "" + "hostname" = "" + "interruptible" = "" + "tostop" = "" + "tostart" = "" + "branch" = "" + "gridserver" = "" + "it division" = "" + "Confidentiality" = "" + "csp" = "aws" + "grafanaserver" = "" + "Terraform" = "true" + "DST_Update" = "" +} + +# List of ECR repositories to create +ecr = { + kms_key_id = "" + repositories = [ + { + name = "mongodb" + image = "mongo" + tag = "6.0.1" + }, + { + name = "armonik-control-plane" + image = "dockerhubaneo/armonik_control" + tag = "0.13.2" + }, + { + name = "armonik-polling-agent" + image = "dockerhubaneo/armonik_pollingagent" + tag = "0.13.2" + }, + { + name = "armonik-worker" + image = "dockerhubaneo/armonik_worker_dll" + tag = "0.11.1" + }, + { + name = "armonik-bench" + image = "dockerhubaneo/armonik_core_bench_test_worker" + tag = "0.13.2" + }, + { + name = "armonik-htcmock" + image = "dockerhubaneo/armonik_core_htcmock_test_worker" + tag = "0.13.2" + }, + { + name = "metrics-exporter" + image = "dockerhubaneo/armonik_control_metrics" + tag = "0.13.2" + }, + { + name = "partition-metrics-exporter" + image = "dockerhubaneo/armonik_control_partition_metrics" + tag = "0.13.2" + }, + { + name = "armonik-admin-app" + image = "dockerhubaneo/armonik_admin_app" + tag = "0.9.0" + }, + { + name = "armonik-admin-app-old" + image = "dockerhubaneo/armonik_admin_app" + tag = "0.8.0" + }, + { + name = "armonik-admin-api-old" + image = "dockerhubaneo/armonik_admin_api" + tag = "0.8.0" + }, + { + name = "mongosh" + image = "rtsp/mongosh" + tag = "1.7.1" + }, + { + name = "seq" + image = "datalust/seq" + tag = "2023.1" + }, + { + name = "seqcli" + image = "datalust/seqcli" + tag = "2023.1" + }, + { + name = "grafana" + image = "grafana/grafana" + tag = "9.3.6" + }, + { + name = "prometheus" + image = "prom/prometheus" + tag = "v2.42.0" + }, + { + name = "cluster-autoscaler" + image = "registry.k8s.io/autoscaling/cluster-autoscaler" + tag = "v1.23.0" + }, + { + name = "aws-node-termination-handler" + image = "public.ecr.aws/aws-ec2/aws-node-termination-handler" + tag = "v1.19.0" + }, + { + name = "metrics-server" + image = "registry.k8s.io/metrics-server/metrics-server" + tag = "v0.6.2" + }, + { + name = "fluent-bit" + image = "fluent/fluent-bit" + tag = "2.0.9" + }, + { + name = "node-exporter" + image = "prom/node-exporter" + tag = "v1.5.0" + }, + { + name = "nginx" + image = "nginxinc/nginx-unprivileged" + tag = "1.23.3" + }, + { + name = "keda" + image = "ghcr.io/kedacore/keda" + tag = "2.9.3" + }, + { + name = "keda-metrics-apiserver" + image = "ghcr.io/kedacore/keda-metrics-apiserver" + tag = "2.9.3" + }, + { + name = "aws-efs-csi-driver" + image = "amazon/aws-efs-csi-driver" + tag = "v1.5.1" + }, + { + name = "livenessprobe" + image = "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe" + tag = "v2.9.0-eks-1-22-19" + }, + { + name = "node-driver-registrar" + image = "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar" + tag = "v2.7.0-eks-1-22-19" + }, + { + name = "external-provisioner" + image = "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner" + tag = "v3.4.0-eks-1-22-19" + } + ] +} diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf new file mode 100644 index 000000000..c0fc95d9d --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf @@ -0,0 +1,4 @@ +provider "aws" { + region = var.region + profile = var.profile +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf new file mode 100644 index 000000000..9c4ce86d7 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf @@ -0,0 +1,36 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# SUFFIX +variable "suffix" { + description = "To suffix the AWS resources" + type = string + default = "" +} + +# AWS TAGs +variable "tags" { + description = "Tags for AWS resources" + type = any + default = {} +} + +# List of ECR repositories to create +variable "ecr" { + description = "List of ECR repositories to create" + type = object({ + kms_key_id = string + repositories = list(any) + }) +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf new file mode 100644 index 000000000..191bee1ad --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.47" + } + random = { + source = "hashicorp/random" + version = "~> 3.4.3" + } + null = { + source = "hashicorp/null" + version = "~> 3.1.0" + } + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/Makefile b/infrastructure/quick-deploy/aws-benchmark/eks/Makefile new file mode 100644 index 000000000..a4495bca8 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/Makefile @@ -0,0 +1,76 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=eks-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/eks-output.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export SUFFIX?=main +export REGION?=eu-west-3 +export PROFILE?=default +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) +export VPC_PARAMETERS_FILE?=$(CURRENT_DIR)/../vpc/generated/vpc-output.json +export PUBLIC_ACCESS_EKS?=true +export KUBECONFIG?=$(GENERATED_DIR)/kubeconfig + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var-file $(VPC_PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'enable_public_eks_access=$(PUBLIC_ACCESS_EKS)' \ + -var 'kubeconfig_file=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"eks\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json eks >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var-file $(VPC_PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'enable_public_eks_access=$(PUBLIC_ACCESS_EKS)' \ + -var 'kubeconfig_file=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/backend.tf b/infrastructure/quick-deploy/aws-benchmark/eks/backend.tf new file mode 100644 index 000000000..0a1689de7 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "eks-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "eks" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/locals.tf b/infrastructure/quick-deploy/aws-benchmark/eks/locals.tf new file mode 100644 index 000000000..94d5b63e4 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/locals.tf @@ -0,0 +1,43 @@ +# Current account +data "aws_caller_identity" "current" {} + +resource "random_string" "random_resources" { + length = 5 + special = false + upper = false + numeric = true +} + +locals { + random_string = random_string.random_resources.result + suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string + cluster_name = try(var.vpc.eks_cluster_name, "armonik-eks-${local.suffix}") + kms_name = "armonik-kms-eks-${local.suffix}-${local.random_string}" + cluster_endpoint_public_access = var.enable_public_eks_access + vpc = { + id = try(var.vpc.id, "") + private_subnet_ids = try(var.vpc.private_subnet_ids, []) + pods_subnet_ids = try(var.vpc.pods_subnet_ids, []) + } + tags = merge({ + "application" = "armonik" + "deployment version" = local.suffix + "created by" = data.aws_caller_identity.current.arn + "creation date" = null_resource.timestamp.triggers["creation_date"] + }, var.tags) +} + +# this external provider is used to get date during the plan step. +data "external" "static_timestamp" { + program = ["date", "+{ \"creation_date\": \"%Y/%m/%d %T\" }"] +} + +# this resource is just used to prevent change of the creation_date during successive 'terraform apply' +resource "null_resource" "timestamp" { + triggers = { + creation_date = data.external.static_timestamp.result.creation_date + } + lifecycle { + ignore_changes = [triggers] + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/main.tf b/infrastructure/quick-deploy/aws-benchmark/eks/main.tf new file mode 100644 index 000000000..e7cd52412 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/main.tf @@ -0,0 +1,54 @@ +# AWS KMS +module "kms" { + count = (var.eks.encryption_keys.cluster_log_kms_key_id != "" && var.eks.encryption_keys.cluster_encryption_config != "" && var.eks.encryption_keys.ebs_kms_key_id != "" ? 0 : 1) + source = "../generated/infra-modules/utils/aws/kms" + name = local.kms_name + tags = local.tags +} + +# AWS EKS +module "eks" { + source = "../generated/infra-modules/kubernetes/aws/eks" + profile = var.profile + tags = local.tags + name = local.cluster_name + node_selector = var.node_selector + kubeconfig_file = abspath(var.kubeconfig_file) + vpc = { + id = local.vpc.id + private_subnet_ids = local.vpc.private_subnet_ids + pods_subnet_ids = local.vpc.pods_subnet_ids + } + eks = { + region = var.region + cluster_version = var.eks.cluster_version + cluster_endpoint_private_access = var.eks.cluster_endpoint_private_access + cluster_endpoint_private_access_cidrs = var.eks.cluster_endpoint_private_access_cidrs + cluster_endpoint_private_access_sg = var.eks.cluster_endpoint_private_access_sg + cluster_endpoint_public_access = local.cluster_endpoint_public_access + cluster_endpoint_public_access_cidrs = var.eks.cluster_endpoint_public_access_cidrs + cluster_log_retention_in_days = var.eks.cluster_log_retention_in_days + docker_images = { + cluster_autoscaler = { + image = var.eks.docker_images.cluster_autoscaler.image + tag = var.eks.docker_images.cluster_autoscaler.tag + } + instance_refresh = { + image = var.eks.docker_images.instance_refresh.image + tag = var.eks.docker_images.instance_refresh.tag + } + } + instance_refresh = var.eks.instance_refresh + cluster_autoscaler = var.eks.cluster_autoscaler + encryption_keys = { + cluster_log_kms_key_id = (var.eks.encryption_keys.cluster_log_kms_key_id != "" ? var.eks.encryption_keys.cluster_log_kms_key_id : module.kms.0.arn) + cluster_encryption_config = (var.eks.encryption_keys.cluster_encryption_config != "" ? var.eks.encryption_keys.cluster_encryption_config : module.kms.0.arn) + ebs_kms_key_id = (var.eks.encryption_keys.ebs_kms_key_id != "" ? var.eks.encryption_keys.ebs_kms_key_id : module.kms.0.arn) + } + map_roles = var.eks.map_roles + map_users = var.eks.map_users + } + eks_managed_node_groups = var.eks_managed_node_groups + self_managed_node_groups = var.self_managed_node_groups + fargate_profiles = var.fargate_profiles +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf new file mode 100644 index 000000000..46c16189a --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf @@ -0,0 +1,19 @@ +# EKS +output "eks" { + description = "EKS parameters" + value = { + cluster_name = module.eks.cluster_name + cluster_id = module.eks.cluster_id + eks_managed_worker_iam_role_names = module.eks.eks_managed_worker_iam_role_names + self_managed_worker_iam_role_names = module.eks.self_managed_worker_iam_role_names + fargate_profiles_worker_iam_role_names = module.eks.fargate_profiles_worker_iam_role_names + worker_iam_role_names = module.eks.worker_iam_role_names + issuer = module.eks.issuer + kubeconfig_file = module.eks.kubeconfig_file + } +} + +output "kubeconfig" { + description = "Use multiple Kubernetes cluster with KUBECONFIG environment variable" + value = "export KUBECONFIG=${module.eks.kubeconfig_file}" +} diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars new file mode 100644 index 000000000..14b0da346 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars @@ -0,0 +1,296 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# SUFFIX +suffix = "main" + +# Tags +tags = { + "name" = "" + "env" = "" + "entity" = "" + "bu" = "" + "owner" = "" + "application code" = "" + "project code" = "" + "cost center" = "" + "Support Contact" = "" + "origin" = "terraform" + "unit of measure" = "" + "epic" = "" + "functional block" = "" + "hostname" = "" + "interruptible" = "" + "tostop" = "" + "tostart" = "" + "branch" = "" + "gridserver" = "" + "it division" = "" + "Confidentiality" = "" + "csp" = "aws" + "grafanaserver" = "" + "Terraform" = "true" + "DST_Update" = "" +} + +# Node selector +node_selector = { service = "monitoring" } + +# AWS EKS +eks = { + name = "armonik-eks" + cluster_version = "1.25" + cluster_endpoint_private_access = true # vpc.enable_private_subnet + cluster_endpoint_private_access_cidrs = [] + cluster_endpoint_private_access_sg = [] + cluster_endpoint_public_access = false + cluster_endpoint_public_access_cidrs = ["0.0.0.0/0"] + cluster_log_retention_in_days = 30 + docker_images = { + cluster_autoscaler = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/cluster-autoscaler" + tag = "v1.23.0" + } + instance_refresh = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/aws-node-termination-handler" + tag = "v1.19.0" + } + } + cluster_autoscaler = { + expander = "least-waste" # random, most-pods, least-waste, price, priority + scale_down_enabled = true + min_replica_count = 0 + scale_down_utilization_threshold = 0.5 + scale_down_non_empty_candidates_count = 30 + max_node_provision_time = "15m0s" + scan_interval = "10s" + scale_down_delay_after_add = "2m" + scale_down_delay_after_delete = "0s" + scale_down_delay_after_failure = "3m" + scale_down_unneeded_time = "2m" + skip_nodes_with_system_pods = true + version = "9.24.0" + repository = "https://kubernetes.github.io/autoscaler" + namespace = "kube-system" + } + instance_refresh = { + namespace = "kube-system" + repository = "https://aws.github.io/eks-charts" + version = "0.21.0" + } + encryption_keys = { + cluster_log_kms_key_id = "" + cluster_encryption_config = "" + ebs_kms_key_id = "" + } + map_roles = [] + map_users = [] +} + +# List of EKS managed node groups +eks_managed_node_groups = { + # Default node group for workers of ArmoniK + workers = { + name = "workers" + launch_template_description = "Node group for ArmoniK Compute-plane pods" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "SPOT" + min_size = 0 + desired_size = 0 + max_size = 1000 + labels = { + service = "workers" + "node.kubernetes.io/lifecycle" = "spot" + } + taints = { + dedicated = { + key = "service" + value = "workers" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for metrics: Metrics exporter and Prometheus + metrics = { + name = "metrics" + launch_template_description = "Node group for metrics: Metrics exporter and Prometheus" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 5 + labels = { + service = "metrics" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "metrics" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for ArmoniK control-plane: control-plane and Ingress + control_plane = { + name = "control-plane" + launch_template_description = "Node group for ArmoniK Control-plane and Ingress" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 10 + labels = { + service = "control-plane" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "control-plane" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for monitoring: metrics server, keda, seq, grafana, cluster-autoscaler, coreDNS, termination handler + monitoring = { + name = "monitoring" + launch_template_description = "Node group for monitoring" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 5 + labels = { + service = "monitoring" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "monitoring" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for data-plane + # state_database, inner_storage, task_queue + state_database = { + name = "mongodb" + launch_template_description = "Node group for MongoDB" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + use_custom_launch_template = true + block_device_mappings = { + xvda = { + device_name = "/dev/xvda" + ebs = { + volume_size = 75 + volume_type = "gp3" + iops = 3000 + throughput = 150 + encrypted = null + kms_key_id = null + delete_on_termination = true + } + } + } + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 10 + labels = { + service = "state-database" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "state-database" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } +} + +# List of self managed node groups +self_managed_node_groups = { + others = { + name = "others" + launch_template_description = "Node group for others" + instance_type = "c5.24xlarge" + min_size = 0 + desired_size = 0 + max_size = 5 + force_delete = true + force_delete_warm_pool = true + instance_market_options = { + market_type = "spot" + } + bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'" + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + others_mixed = { + name = "others-mixed" + launch_template_description = "Mixed On demand and SPOT instances for other pods" + min_size = 0 + desired_size = 0 + max_size = 5 + use_mixed_instances_policy = true + mixed_instances_policy = { + on_demand_allocation_strategy = "lowest-price" + on_demand_base_capacity = 0 + on_demand_percentage_above_base_capacity = 20 # 20% On-Demand Instances, 80% Spot Instances + spot_allocation_strategy = "price-capacity-optimized" + spot_instance_pools = null + spot_max_price = null + } + override = [ + { + instance_type = "c5.4xlarge" + weighted_capacity = "1" + }, + { + instance_type = "c5.2xlarge" + weighted_capacity = "2" + }, + ] + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } +} + +# List of fargate profiles +fargate_profiles = {} diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/providers.tf b/infrastructure/quick-deploy/aws-benchmark/eks/providers.tf new file mode 100644 index 000000000..80b2f1732 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/providers.tf @@ -0,0 +1,33 @@ +provider "aws" { + region = var.region + profile = var.profile +} + +provider "kubernetes" { + host = module.eks.cluster_endpoint + cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) + + exec { + api_version = "client.authentication.k8s.io/v1beta1" + command = "aws" + # This requires the awscli to be installed locally where Terraform is executed + args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] + } +} + +# package manager for kubernetes +provider "helm" { + helm_driver = "configmap" + kubernetes { + host = module.eks.cluster_endpoint + cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) + insecure = false + + exec { + api_version = "client.authentication.k8s.io/v1beta1" + command = "aws" + # This requires the awscli to be installed locally where Terraform is executed + args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] + } + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/variables.tf b/infrastructure/quick-deploy/aws-benchmark/eks/variables.tf new file mode 100644 index 000000000..5b034ecc1 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/variables.tf @@ -0,0 +1,138 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# SUFFIX +variable "suffix" { + description = "To suffix the AWS resources" + type = string + default = "" +} + +# AWS TAGs +variable "tags" { + description = "Tags for AWS resources" + type = any + default = {} +} + +# Node selector +variable "node_selector" { + description = "Node selector for Seq" + type = any + default = {} +} + +# VPC infos +variable "vpc" { + description = "AWS VPC info" + type = any + default = {} +} + +# Kubeconfig file path +variable "kubeconfig_file" { + description = "Kubeconfig file path" + type = string + default = "generated/kubeconfig" +} + +# AWS EKS +variable "eks" { + description = "Parameters of AWS EKS" + type = object({ + name = string + cluster_version = string + cluster_endpoint_private_access = bool # vpc.enable_private_subnet + cluster_endpoint_private_access_cidrs = list(string) + cluster_endpoint_private_access_sg = list(string) + cluster_endpoint_public_access = bool + cluster_endpoint_public_access_cidrs = list(string) + cluster_log_retention_in_days = number + docker_images = object({ + cluster_autoscaler = object({ + image = string + tag = string + }) + instance_refresh = object({ + image = string + tag = string + }) + }) + cluster_autoscaler = object({ + expander = string + scale_down_enabled = bool + min_replica_count = number + scale_down_utilization_threshold = number + scale_down_non_empty_candidates_count = number + max_node_provision_time = string + scan_interval = string + scale_down_delay_after_add = string + scale_down_delay_after_delete = string + scale_down_delay_after_failure = string + scale_down_unneeded_time = string + skip_nodes_with_system_pods = bool + version = optional(string, "9.24.0") + repository = optional(string, "https://kubernetes.github.io/autoscaler") + namespace = optional(string, "kube-system") + }) + instance_refresh = object({ + namespace = optional(string, "kube-system") + repository = optional(string, "https://aws.github.io/eks-charts") + version = optional(string, "0.21.0") + }) + encryption_keys = object({ + cluster_log_kms_key_id = string + cluster_encryption_config = string + ebs_kms_key_id = string + }) + map_roles = list(object({ + rolearn = string + username = string + groups = list(string) + })) + map_users = list(object({ + userarn = string + username = string + groups = list(string) + })) + }) +} + +# Enable EKS public access +variable "enable_public_eks_access" { + description = "Enable EKS public access" + type = bool + default = true +} + +# List of EKS managed node groups +variable "eks_managed_node_groups" { + description = "List of EKS managed node groups" + type = any + default = null +} + +# List of self managed node groups +variable "self_managed_node_groups" { + description = "List of self managed node groups" + type = any + default = null +} + +# List of fargate profiles +variable "fargate_profiles" { + description = "List of fargate profiles" + type = any + default = null +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/versions.tf b/infrastructure/quick-deploy/aws-benchmark/eks/versions.tf new file mode 100644 index 000000000..9fb8e702b --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/eks/versions.tf @@ -0,0 +1,28 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.47" + } + kubernetes = { + source = "hashicorp/kubernetes" + version = "~> 2.13.0" + } + cloudinit = { + source = "hashicorp/cloudinit" + version = "~> 2.2.0" + } + helm = { + source = "hashicorp/helm" + version = "~> 2.7.0" + } + random = { + source = "hashicorp/random" + version = "~> 3.4.3" + } + local = { + source = "hashicorp/local" + version = "~> 2.2.0" + } + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/envvars.sh b/infrastructure/quick-deploy/aws-benchmark/envvars.sh new file mode 100644 index 000000000..d7eb33a9f --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/envvars.sh @@ -0,0 +1,9 @@ +export ARMONIK_PROFILE="default" +export ARMONIK_REGION="eu-west-3" +export ARMONIK_SUFFIX="main" +export ARMONIK_BUCKET_NAME="armonik-tfstate" +export ARMONIK_KUBERNETES_NAMESPACE="armonik" +export KEDA_KUBERNETES_NAMESPACE="default" +export METRICS_SERVER_KUBERNETES_NAMESPACE="kube-system" +export PUBLIC_VPC="true" +export PUBLIC_ACCESS_EKS="true" diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/Makefile b/infrastructure/quick-deploy/aws-benchmark/keda/Makefile new file mode 100644 index 000000000..a4020e871 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/Makefile @@ -0,0 +1,71 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=keda-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/keda-output.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export REGION?=eu-west-3 +export PROFILE?=default +export NAMESPACE?=default +export SUFFIX?=main +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) +export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"keda\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json keda >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/backend.tf b/infrastructure/quick-deploy/aws-benchmark/keda/backend.tf new file mode 100644 index 000000000..80fb20ec4 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "keda-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "armonik" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/locals.tf b/infrastructure/quick-deploy/aws-benchmark/keda/locals.tf new file mode 100644 index 000000000..5ac3a23d0 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/locals.tf @@ -0,0 +1,14 @@ +locals { + # Keda + keda_namespace = try(var.namespace, "default") + keda_keda_image = try(var.keda.docker_image.keda.image, "ghcr.io/kedacore/keda") + keda_keda_tag = try(var.keda.docker_image.keda.tag, "2.6.1") + keda_metricsApiServer_image = try(var.keda.docker_image.metricsApiServer.image, "ghcr.io/kedacore/keda-metrics-apiserver") + keda_metricsApiServer_tag = try(var.keda.docker_image.metricsApiServer.tag, "2.6.1") + keda_image_pull_secrets = try(var.keda.image_pull_secrets, "") + keda_node_selector = try(var.keda.node_selector, {}) + keda_metrics_server_dns_policy = try(var.keda.metrics_server_dns_policy, "ClusterFirst") + keda_metrics_server_use_host_network = try(var.keda.metrics_server_use_host_network, false) + keda_chart_repository = try(coalesce(var.keda.helm_chart_repository), "https://kedacore.github.io/charts") + keda_chart_version = try(coalesce(var.keda.helm_chart_version), "2.9.4") +} diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/main.tf b/infrastructure/quick-deploy/aws-benchmark/keda/main.tf new file mode 100644 index 000000000..6e4191ff5 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/main.tf @@ -0,0 +1,21 @@ +# Keda +module "keda" { + source = "../generated/infra-modules/monitoring/onpremise/keda" + namespace = local.keda_namespace + docker_image = { + keda = { + image = local.keda_keda_image + tag = local.keda_keda_tag + } + metricsApiServer = { + image = local.keda_metricsApiServer_image + tag = local.keda_metricsApiServer_tag + } + } + image_pull_secrets = local.keda_image_pull_secrets + node_selector = local.keda_node_selector + helm_chart_repository = local.keda_chart_repository + helm_chart_version = local.keda_chart_version + metrics_server_dns_policy = local.keda_metrics_server_dns_policy + metrics_server_use_host_network = local.keda_metrics_server_use_host_network +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf new file mode 100644 index 000000000..7be92c32d --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf @@ -0,0 +1,4 @@ +output "keda" { + description = "Keda" + value = module.keda +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars new file mode 100644 index 000000000..f594ef242 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars @@ -0,0 +1,28 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# Kubernetes namespace +namespace = "default" + +# Keda infos +keda = { + docker_image = { + keda = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/keda" + tag = "2.9.3" + } + metricsApiServer = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/keda-metrics-apiserver" + tag = "2.9.3" + } + } + image_pull_secrets = "" + node_selector = { service = "monitoring" } + metrics_server_dns_policy = "ClusterFirst" + metrics_server_use_host_network = false + helm_chart_repository = "https://kedacore.github.io/charts" + helm_chart_version = "2.9.4" +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/providers.tf b/infrastructure/quick-deploy/aws-benchmark/keda/providers.tf new file mode 100644 index 000000000..882c7d3ce --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/providers.tf @@ -0,0 +1,19 @@ +# 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/aws-benchmark/keda/variables.tf b/infrastructure/quick-deploy/aws-benchmark/keda/variables.tf new file mode 100644 index 000000000..262d023e1 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/keda/variables.tf @@ -0,0 +1,56 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# Kubeconfig path +variable "k8s_config_path" { + description = "Path of the configuration file of K8s" + type = string + default = "~/.kube/config" +} + +# Kubeconfig context +variable "k8s_config_context" { + description = "Context of K8s" + type = string + default = "default" +} + +# Kubernetes namespace +variable "namespace" { + description = "Kubernetes namespace for Keda" + type = string +} + +# Keda infos +variable "keda" { + description = "Keda infos" + type = object({ + docker_image = object({ + keda = object({ + image = string + tag = string + }) + metricsApiServer = object({ + image = string + tag = string + }) + }) + image_pull_secrets = string + node_selector = any + metrics_server_dns_policy = string + metrics_server_use_host_network = bool + helm_chart_repository = string + helm_chart_version = string + }) +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/versions.tf b/infrastructure/quick-deploy/aws-benchmark/keda/versions.tf new file mode 100644 index 000000000..e69de29bb diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile b/infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile new file mode 100644 index 000000000..17e3fdb47 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile @@ -0,0 +1,71 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=metrics-server-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/metrics-server-output.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export REGION?=eu-west-3 +export PROFILE?=default +export NAMESPACE?=kube-system +export SUFFIX?=main +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) +export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"metrics_server\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json metrics_server >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf new file mode 100644 index 000000000..12d373aa9 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "metrics-server-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "armonik" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf new file mode 100644 index 000000000..b1c1d547b --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf @@ -0,0 +1,17 @@ +locals { + # metrics server + namespace = try(var.namespace, "kube-system") + image = try(var.docker_image.image, "k8s.gcr.io/metrics-server/metrics-server") + tag = try(var.docker_image.tag, "v0.6.1") + image_pull_secrets = try(var.image_pull_secrets, "") + node_selector = try(var.node_selector, {}) + default_args = try(var.args, []) == [] ? [ + "--cert-dir=/tmp", + "--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname", + "--kubelet-use-node-status-port", + "--metric-resolution=15s" + ] : var.args + host_network = try(var.host_network, false) + helm_chart_repository = try(coalesce(var.helm_chart_repository), "https://kubernetes-sigs.github.io/metrics-server/") + helm_chart_version = try(coalesce(var.helm_chart_version), "3.8.3") +} diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf new file mode 100644 index 000000000..fa4545378 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf @@ -0,0 +1,15 @@ +# Metrics server +module "metrics_server" { + source = "../generated/infra-modules/monitoring/onpremise/metrics-server" + namespace = local.namespace + docker_image = { + image = local.image + tag = local.tag + } + image_pull_secrets = local.image_pull_secrets + node_selector = local.node_selector + default_args = local.default_args + host_network = local.host_network + helm_chart_repository = local.helm_chart_repository + helm_chart_version = local.helm_chart_version +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf new file mode 100644 index 000000000..16a0e31b1 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf @@ -0,0 +1,4 @@ +output "metrics_server" { + description = "metrics server" + value = module.metrics_server +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars new file mode 100644 index 000000000..e64f80770 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars @@ -0,0 +1,37 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# Kubernetes namespace +namespace = "kube-system" + +# metrics server info +docker_image = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/metrics-server" + tag = "v0.6.2" +} + +# Image pull secret +image_pull_secrets = "" + +# node selector +node_selector = { service = "monitoring" } + +# args +args = [ + "--cert-dir=/tmp", + "--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname", + "--kubelet-use-node-status-port", + "--metric-resolution=15s" +] + +# Host network +host_network = false + +# Repository of helm chart +helm_chart_repository = "https://kubernetes-sigs.github.io/metrics-server/" + +# Version of helm chart +helm_chart_version = "3.8.3" \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/providers.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/providers.tf new file mode 100644 index 000000000..882c7d3ce --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/providers.tf @@ -0,0 +1,19 @@ +# 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/aws-benchmark/metrics-server/variables.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/variables.tf new file mode 100644 index 000000000..693504453 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/metrics-server/variables.tf @@ -0,0 +1,78 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# Kubeconfig path +variable "k8s_config_path" { + description = "Path of the configuration file of K8s" + type = string + default = "~/.kube/config" +} + +# Kubeconfig context +variable "k8s_config_context" { + description = "Context of K8s" + type = string + default = "default" +} + +# Kubernetes namespace +variable "namespace" { + description = "Kubernetes namespace for metrics server" + type = string +} + +# Docker image +variable "docker_image" { + description = "Docker image for metrics server" + type = object({ + image = string + tag = string + }) +} + +# image pull secrets +variable "image_pull_secrets" { + description = "image_pull_secrets for metrics server" + type = string +} + +# Node selector +variable "node_selector" { + description = "Node selector for metrics server" + type = any +} + +# Args +variable "args" { + description = "Arguments for metrics server" + type = list(string) +} + +# Host network +variable "host_network" { + description = "Host network for metrics server" + type = bool +} + +# Repository of helm chart +variable "helm_chart_repository" { + description = "Path to helm chart repository for metrics server" + type = string +} + +# Version of helm chart +variable "helm_chart_version" { + description = "Version of chart helm for metrics server" + type = string +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/versions.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/versions.tf new file mode 100644 index 000000000..e69de29bb diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile b/infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile new file mode 100644 index 000000000..f21efd37b --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile @@ -0,0 +1,76 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=monitoring-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/monitoring-output.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export SUFFIX?=main +export REGION?=eu-west-3 +export PROFILE?=default +export NAMESPACE?=armonik +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) +export EKS_PARAMETERS_FILE?=$(CURRENT_DIR)/../eks/generated/eks-output.json +export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var-file $(EKS_PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"monitoring\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json monitoring >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var-file $(EKS_PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf new file mode 100644 index 000000000..3228617a4 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "monitoring-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "monitoring" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf new file mode 100644 index 000000000..c7e3d7201 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf @@ -0,0 +1,61 @@ +# Send logs in cloudwatch +data "aws_iam_policy_document" "send_logs_from_fluent_bit_to_cloudwatch_document" { + count = (local.cloudwatch_enabled ? 1 : 0) + statement { + sid = "SendLogsFromFluentBitToCloudWatch" + actions = [ + "logs:CreateLogStream", + "logs:CreateLogGroup", + "logs:PutLogEvents", + ] + effect = "Allow" + resources = [ + "arn:aws:logs:${var.region}:${data.aws_caller_identity.current.account_id}:log-group:${local.cloudwatch_log_group_name}:*" + ] + } +} + +resource "aws_iam_policy" "send_logs_from_fluent_bit_to_cloudwatch_policy" { + count = (local.cloudwatch_enabled ? 1 : 0) + name_prefix = "send-logs-from-fluent-bit-to-cloudwatch-${var.eks.cluster_name}" + description = "Policy for allowing send logs from fluent-bit ${var.eks.cluster_name} to cloudwatch" + policy = data.aws_iam_policy_document.send_logs_from_fluent_bit_to_cloudwatch_document.0.json + tags = local.tags +} + +resource "aws_iam_policy_attachment" "send_logs_from_fluent_bit_to_cloudwatch_attachment" { + count = (local.cloudwatch_enabled ? 1 : 0) + name = "send-logs-from-fluent-bit-to-cloudwatch-${var.eks.cluster_name}" + policy_arn = aws_iam_policy.send_logs_from_fluent_bit_to_cloudwatch_policy.0.arn + roles = var.eks.worker_iam_role_names +} + +# Write objects in S3 +data "aws_iam_policy_document" "write_object" { + count = (local.s3_enabled ? 1 : 0) + statement { + sid = "WriteFromS3" + actions = [ + "s3:PutObject" + ] + effect = "Allow" + resources = [ + "${var.monitoring.s3.arn}/*" + ] + } +} + +resource "aws_iam_policy" "write_object" { + count = (local.s3_enabled ? 1 : 0) + name_prefix = "s3-logs-write-${var.eks.cluster_name}" + description = "Policy for allowing read object in S3 logs ${var.eks.cluster_name}" + policy = data.aws_iam_policy_document.write_object[0].json + tags = local.tags +} + +resource "aws_iam_policy_attachment" "write_object" { + count = (local.s3_enabled ? 1 : 0) + name = "s3-logs-write-${var.eks.cluster_name}" + policy_arn = aws_iam_policy.write_object[0].arn + roles = var.eks.worker_iam_role_names +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf new file mode 100644 index 000000000..dfd5812ca --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf @@ -0,0 +1,99 @@ +data "aws_caller_identity" "current" {} + +resource "random_string" "random_resources" { + length = 5 + special = false + upper = false + numeric = true +} + +resource "time_static" "creation_date" {} + +locals { + random_string = random_string.random_resources.result + suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string + kms_name = "armonik-kms-monitoring-${local.suffix}-${local.random_string}" + cloudwatch_log_group_name = "/aws/containerinsights/${var.eks.cluster_name}/application" + tags = merge(var.tags, { + "application" = "armonik" + "deployment version" = local.suffix + "created by" = data.aws_caller_identity.current.arn + "creation date" = time_static.creation_date.rfc3339 + }) + + # Seq + seq_enabled = tobool(try(var.monitoring.seq.enabled, false)) + seq_image = try(var.monitoring.seq.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/seq") + seq_tag = try(var.monitoring.seq.tag, "2021.4") + seq_port = try(var.monitoring.seq.port, 8080) + seq_image_pull_secrets = try(var.monitoring.seq.image_pull_secrets, "") + seq_service_type = try(var.monitoring.seq.service_type, "LoadBalancer") + seq_node_selector = try(var.monitoring.seq.node_selector, {}) + seq_system_ram_target = try(var.monitoring.seq.system_ram_target, 0.2) + cli_seq_image = try(var.monitoring.seq.cli_image, "datalust/seqcli") + cli_seq_tag = try(var.monitoring.seq.cli_tag, "2021.4") + cli_seq_image_pull_secrets = try(var.monitoring.seq.cli_image_pull_secrets, "") + retention_in_days = try(var.monitoring.seq.retention_in_days, "2d") + + # Grafana + grafana_enabled = tobool(try(var.monitoring.grafana.enabled, false)) + grafana_image = try(var.monitoring.grafana.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/grafana") + grafana_tag = try(var.monitoring.grafana.tag, "latest") + grafana_port = try(var.monitoring.grafana.port, 3000) + grafana_image_pull_secrets = try(var.monitoring.grafana.image_pull_secrets, "") + grafana_service_type = try(var.monitoring.grafana.service_type, "LoadBalancer") + grafana_node_selector = try(var.monitoring.grafana.node_selector, {}) + + # node exporter + node_exporter_enabled = tobool(try(var.monitoring.node_exporter.enabled, false)) + node_exporter_image = try(var.monitoring.node_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/node-exporter") + node_exporter_tag = try(var.monitoring.node_exporter.tag, "latest") + node_exporter_image_pull_secrets = try(var.monitoring.node_exporter.image_pull_secrets, "") + node_exporter_node_selector = try(var.monitoring.node_exporter.node_selector, {}) + + # Prometheus + prometheus_image = try(var.monitoring.prometheus.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/prometheus") + prometheus_tag = try(var.monitoring.prometheus.tag, "latest") + prometheus_image_pull_secrets = try(var.monitoring.prometheus.image_pull_secrets, "") + prometheus_service_type = try(var.monitoring.prometheus.service_type, "ClusterIP") + prometheus_node_exporter_image = try(var.monitoring.prometheus.node_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/node-exporter") + prometheus_node_exporter_tag = try(var.monitoring.prometheus.node_exporter.tag, "latest") + prometheus_node_selector = try(var.monitoring.prometheus.node_selector, {}) + + # Metrics exporter + metrics_exporter_image = try(var.monitoring.metrics_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/metrics-exporter") + metrics_exporter_tag = try(var.monitoring.metrics_exporter.tag, "0.11.1") + metrics_exporter_image_pull_secrets = try(var.monitoring.metrics_exporter.image_pull_secrets, "") + metrics_exporter_service_type = try(var.monitoring.metrics_exporter.service_type, "ClusterIP") + metrics_exporter_node_selector = try(var.monitoring.metrics_exporter.node_selector, {}) + metrics_exporter_extra_conf = try(var.monitoring.metrics_exporter.extra_conf, {}) + + # Partition metrics exporter + partition_metrics_exporter_image = try(var.monitoring.partition_metrics_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/partition-metrics-exporter") + partition_metrics_exporter_tag = try(var.monitoring.partition_metrics_exporter.tag, "0.11.1") + partition_metrics_exporter_image_pull_secrets = try(var.monitoring.partition_metrics_exporter.image_pull_secrets, "") + partition_metrics_exporter_service_type = try(var.monitoring.partition_metrics_exporter.service_type, "ClusterIP") + partition_metrics_exporter_node_selector = try(var.monitoring.partition_metrics_exporter.node_selector, {}) + partition_metrics_exporter_extra_conf = try(var.monitoring.partition_metrics_exporter.extra_conf, {}) + + # CloudWatch + cloudwatch_enabled = tobool(try(var.monitoring.cloudwatch.enabled, false)) + cloudwatch_kms_key_id = try(var.monitoring.cloudwatch.kms_key_id, "") + cloudwatch_retention_in_days = tonumber(try(var.monitoring.cloudwatch.retention_in_days, 30)) + + # Fluent-bit + fluent_bit_image = try(var.monitoring.fluent_bit.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/fluent-bit") + fluent_bit_tag = try(var.monitoring.fluent_bit.tag, "1.3.11") + fluent_bit_image_pull_secrets = try(var.monitoring.fluent_bit.image_pull_secrets, "") + fluent_bit_is_daemonset = tobool(try(var.monitoring.fluent_bit.is_daemonset, false)) + fluent_bit_http_port = tonumber(try(var.monitoring.fluent_bit.http_port, 0)) + fluent_bit_read_from_head = tobool(try(var.monitoring.fluent_bit.read_from_head, true)) + fluent_bit_node_selector = try(var.monitoring.fluent_bit.node_selector, {}) + fluent_bit_parser = try(var.monitoring.fluent_bit.parser, "cri") + + # S3 for logs + s3_enabled = tobool(try(var.monitoring.s3.enabled, false)) + s3_name = try(var.monitoring.s3.name, "armonik-logs") + s3_region = try(var.monitoring.s3.region, "eu-west-3") + s3_prefix = try(var.monitoring.s3.prefix, "main") +} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf new file mode 100644 index 000000000..0810e6048 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf @@ -0,0 +1,164 @@ +# AWS KMS +module "kms" { + count = (local.cloudwatch_kms_key_id == "" && local.cloudwatch_enabled ? 1 : 0) + source = "../generated/infra-modules/utils/aws/kms" + name = local.kms_name + tags = local.tags +} + +# Seq +module "seq" { + count = (local.seq_enabled ? 1 : 0) + source = "../generated/infra-modules/monitoring/onpremise/seq" + namespace = var.namespace + service_type = local.seq_service_type + port = local.seq_port + node_selector = local.seq_node_selector + docker_image = { + image = local.seq_image + tag = local.seq_tag + image_pull_secrets = local.seq_image_pull_secrets + } + docker_image_cron = { + image = local.cli_seq_image + 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 +} + +# node exporter +module "node_exporter" { + count = (local.node_exporter_enabled ? 1 : 0) + source = "../generated/infra-modules/monitoring/onpremise/exporters/node-exporter" + namespace = var.namespace + node_selector = local.node_exporter_node_selector + docker_image = { + image = local.node_exporter_image + 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 + 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}/../../.." +} + +# Partition metrics exporter +#module "partition_metrics_exporter" { +# source = "../generated/infra-modules/monitoring/onpremise/exporters/partition-metrics-exporter" +# namespace = var.namespace +# service_type = local.partition_metrics_exporter_service_type +# node_selector = local.partition_metrics_exporter_node_selector +# 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 +# tag = local.partition_metrics_exporter_tag +# 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 + #"${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 + ] +} + +# Grafana +module "grafana" { + count = (local.grafana_enabled ? 1 : 0) + source = "../generated/infra-modules/monitoring/onpremise/grafana" + namespace = var.namespace + service_type = local.grafana_service_type + port = local.grafana_port + node_selector = local.grafana_node_selector + prometheus_url = module.prometheus.url + docker_image = { + image = local.grafana_image + tag = local.grafana_tag + image_pull_secrets = local.grafana_image_pull_secrets + } + working_dir = "${path.root}/../../.." + authentication = var.authentication + depends_on = [module.prometheus] +} + +# CloudWatch +module "cloudwatch" { + count = (local.cloudwatch_enabled ? 1 : 0) + source = "../generated/infra-modules/monitoring/aws/cloudwatch-log-group" + name = local.cloudwatch_log_group_name + kms_key_id = (local.cloudwatch_kms_key_id != "" ? local.cloudwatch_kms_key_id : module.kms.0.arn) + retention_in_days = local.cloudwatch_retention_in_days + tags = local.tags +} + +# Fluent-bit +module "fluent_bit" { + source = "../generated/infra-modules/monitoring/onpremise/fluent-bit" + namespace = var.namespace + node_selector = local.fluent_bit_node_selector + fluent_bit = { + container_name = "fluent-bit" + image = local.fluent_bit_image + tag = local.fluent_bit_tag + image_pull_secrets = local.fluent_bit_image_pull_secrets + is_daemonset = local.fluent_bit_is_daemonset + parser = local.fluent_bit_parser + http_server = (local.fluent_bit_http_port == 0 ? "Off" : "On") + http_port = (local.fluent_bit_http_port == 0 ? "" : tostring(local.fluent_bit_http_port)) + read_from_head = (local.fluent_bit_read_from_head ? "On" : "Off") + read_from_tail = (local.fluent_bit_read_from_head ? "Off" : "On") + } + seq = (local.seq_enabled ? { + host = module.seq.0.host + port = module.seq.0.port + enabled = true + } : {}) + cloudwatch = (local.cloudwatch_enabled ? { + name = module.cloudwatch.0.name + region = var.region + enabled = true + } : {}) + s3 = (local.s3_enabled ? { + name = local.s3_name + region = local.s3_region + prefix = local.s3_prefix + enabled = true + } : {}) +} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf new file mode 100644 index 000000000..eedd4e195 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf @@ -0,0 +1,52 @@ +output "monitoring" { + description = "Monitoring endpoint URLs" + value = { + seq = (local.seq_enabled ? { + host = module.seq.0.host + port = module.seq.0.port + url = module.seq.0.url + web_url = module.seq.0.web_url + enabled = true + } : {}) + grafana = (local.grafana_enabled ? { + host = module.grafana.0.host + port = module.grafana.0.port + url = module.grafana.0.url + enabled = true + } : {}) + prometheus = { + host = module.prometheus.host + port = module.prometheus.port + url = module.prometheus.url + } + metrics_exporter = { + name = module.metrics_exporter.name + host = module.metrics_exporter.host + port = module.metrics_exporter.port + url = module.metrics_exporter.url + namespace = module.metrics_exporter.namespace + } + partition_metrics_exporter = { + name = null #module.partition_metrics_exporter.name + host = null #module.partition_metrics_exporter.host + port = null #module.partition_metrics_exporter.port + url = null #module.partition_metrics_exporter.url + namespace = null #module.partition_metrics_exporter.namespace + } + cloudwatch = (local.cloudwatch_enabled ? { + name = module.cloudwatch.0.name + region = var.region + enabled = true + } : {}) + fluent_bit = { + container_name = module.fluent_bit.container_name + image = module.fluent_bit.image + tag = module.fluent_bit.tag + is_daemonset = module.fluent_bit.is_daemonset + configmaps = { + envvars = module.fluent_bit.configmaps.envvars + config = module.fluent_bit.configmaps.config + } + } + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars new file mode 100644 index 000000000..d9df15657 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars @@ -0,0 +1,136 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# Kubeconfig path +k8s_config_path = "~/.kube/config" + +# Kubeconfig context +k8s_config_context = "default" + +# Kubernetes namespace +namespace = "armonik" + +# SUFFIX +suffix = "main" + +tags = { + "name" = "" + "env" = "" + "entity" = "" + "bu" = "" + "owner" = "" + "application code" = "" + "project code" = "" + "cost center" = "" + "Support Contact" = "" + "origin" = "terraform" + "unit of measure" = "" + "epic" = "" + "functional block" = "" + "hostname" = "" + "interruptible" = "" + "tostop" = "" + "tostart" = "" + "branch" = "" + "gridserver" = "" + "it division" = "" + "Confidentiality" = "" + "csp" = "aws" + "grafanaserver" = "" + "Terraform" = "true" + "DST_Update" = "" +} + +# Monitoring infos +monitoring = { + seq = { + enabled = true + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/seq" + tag = "2023.1" + port = 8080 + image_pull_secrets = "" + service_type = "ClusterIP" + node_selector = { service = "monitoring" } + system_ram_target = 0.2 + cli_image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/seqcli" + cli_tag = "2023.1" + cli_image_pull_secrets = "" + retention_in_days = "2d" + } + grafana = { + enabled = true + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/grafana" + tag = "9.3.6" + port = 3000 + image_pull_secrets = "" + service_type = "ClusterIP" + node_selector = { service = "monitoring" } + } + node_exporter = { + enabled = true + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/node-exporter" + tag = "v1.5.0" + image_pull_secrets = "" + node_selector = {} + } + prometheus = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/prometheus" + tag = "v2.42.0" + image_pull_secrets = "" + service_type = "ClusterIP" + node_selector = { service = "metrics" } + } + metrics_exporter = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/metrics-exporter" + tag = "0.13.2" + image_pull_secrets = "" + service_type = "ClusterIP" + node_selector = { service = "metrics" } + extra_conf = { + MongoDB__AllowInsecureTls = true + Serilog__MinimumLevel = "Information" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + } + } + partition_metrics_exporter = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/partition-metrics-exporter" + tag = "0.13.2" + image_pull_secrets = "" + service_type = "ClusterIP" + node_selector = { service = "metrics" } + extra_conf = { + MongoDB__AllowInsecureTls = true + Serilog__MinimumLevel = "Information" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + } + } + cloudwatch = { + enabled = true + kms_key_id = "" + retention_in_days = 30 + } + s3 = { + enabled = true + name = "armonik-logs" + region = "eu-west-3" + prefix = "main" + arn = "arn:aws:s3:::armonik-logs" + } + fluent_bit = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/fluent-bit" + tag = "2.0.9" + image_pull_secrets = "" + is_daemonset = true + http_port = 2020 # 0 or 2020 + read_from_head = true + node_selector = {} + parser = "cri" + } +} + +authentication = false diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf new file mode 100644 index 000000000..6e2dbd516 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf @@ -0,0 +1,24 @@ +provider "aws" { + region = var.region + profile = var.profile +} + +# 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/aws-benchmark/monitoring/secrets.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/secrets.tf new file mode 100644 index 000000000..24eb17dda --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/secrets.tf @@ -0,0 +1,92 @@ +resource "kubernetes_secret" "metrics_exporter" { + metadata { + name = "metrics-exporter" + namespace = var.namespace + } + data = { + name = module.metrics_exporter.name + host = module.metrics_exporter.host + port = module.metrics_exporter.port + url = module.metrics_exporter.url + namespace = module.metrics_exporter.namespace + } +} + +resource "kubernetes_secret" "partition_metrics_exporter" { + metadata { + name = "partition-metrics-exporter" + namespace = var.namespace + } + data = { + name = null #module.partition_metrics_exporter.name + host = null #module.partition_metrics_exporter.host + port = null #module.partition_metrics_exporter.port + url = null #module.partition_metrics_exporter.url + namespace = null #module.partition_metrics_exporter.namespace + } +} + +resource "kubernetes_secret" "fluent_bit" { + metadata { + name = "fluent-bit" + namespace = var.namespace + } + data = { + is_daemonset = module.fluent_bit.is_daemonset + name = module.fluent_bit.container_name + image = module.fluent_bit.image + tag = module.fluent_bit.tag + envvars = module.fluent_bit.configmaps.envvars + config = module.fluent_bit.configmaps.config + } +} + +resource "kubernetes_secret" "prometheus" { + metadata { + name = "prometheus" + namespace = var.namespace + } + data = { + host = module.prometheus.host + port = module.prometheus.port + url = module.prometheus.url + } +} + +resource "kubernetes_secret" "seq" { + metadata { + name = "seq" + namespace = var.namespace + } + data = local.seq_enabled ? { + host = module.seq.0.host + port = module.seq.0.port + url = module.seq.0.url + web_url = module.seq.0.web_url + enabled = true + } : { + host = null + port = null + url = null + web_url = null + enabled = false + } +} + +resource "kubernetes_secret" "grafana" { + metadata { + name = "grafana" + namespace = var.namespace + } + data = local.grafana_enabled ? { + host = module.grafana.0.host + port = module.grafana.0.port + url = module.grafana.0.url + enabled = true + } : { + host = null + port = null + url = null + enabled = false + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf new file mode 100644 index 000000000..9765ae3b9 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf @@ -0,0 +1,151 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# Kubeconfig path +variable "k8s_config_path" { + description = "Path of the configuration file of K8s" + type = string + default = "~/.kube/config" +} + +# Kubeconfig context +variable "k8s_config_context" { + description = "Context of K8s" + type = string + default = "default" +} + +# SUFFIX +variable "suffix" { + description = "To suffix the AWS resources" + type = string + default = "" +} + +# AWS TAGs +variable "tags" { + description = "Tags for AWS resources" + type = any + default = {} +} + +# Kubernetes namespace +variable "namespace" { + description = "Kubernetes namespace for ArmoniK" + type = string + default = "armonik" +} + +# EKS info +variable "eks" { + description = "EKS info" + type = any + default = {} +} + +# List of needed storage +variable "storage_endpoint_url" { + description = "List of storage needed by ArmoniK" + type = any + default = {} +} + +# Monitoring infos +variable "monitoring" { + description = "Monitoring infos" + type = object({ + seq = object({ + enabled = bool + image = string + tag = string + port = number + image_pull_secrets = string + service_type = string + node_selector = any + system_ram_target = number + cli_image = string + cli_tag = string + cli_image_pull_secrets = string + retention_in_days = string + }) + grafana = object({ + enabled = bool + image = string + tag = string + port = number + image_pull_secrets = string + service_type = string + node_selector = any + }) + node_exporter = object({ + enabled = bool + image = string + tag = string + image_pull_secrets = string + node_selector = any + }) + prometheus = object({ + image = string + tag = string + image_pull_secrets = string + service_type = string + node_selector = any + }) + metrics_exporter = object({ + image = string + tag = string + image_pull_secrets = string + service_type = string + node_selector = any + extra_conf = map(string) + }) + partition_metrics_exporter = object({ + image = string + tag = string + image_pull_secrets = string + service_type = string + node_selector = any + extra_conf = map(string) + }) + cloudwatch = object({ + enabled = bool + kms_key_id = string + retention_in_days = number + }) + s3 = object({ + enabled = bool + name = string + region = string + arn = string + prefix = string + }) + fluent_bit = object({ + image = string + tag = string + image_pull_secrets = string + is_daemonset = bool + http_port = number + read_from_head = string + node_selector = any + parser = string + }) + }) +} + +# Enable authentication of seq and grafana +variable "authentication" { + description = "Enable authentication form in seq and grafana" + type = bool + default = false +} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf new file mode 100644 index 000000000..234dc9186 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + external = { + source = "hashicorp/external" + version = "~> 2.2.0" + } + kubernetes = { + source = "hashicorp/kubernetes" + version = "~> 2.13.0" + } + local = { + source = "hashicorp/local" + version = "~> 2.1.0" + } + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/Makefile b/infrastructure/quick-deploy/aws-benchmark/storage/Makefile new file mode 100644 index 000000000..5cde02f55 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/Makefile @@ -0,0 +1,79 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=storage-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/storage-output.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export SUFFIX?=main +export REGION?=eu-west-3 +export PROFILE?=default +export NAMESPACE?=armonik +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) +export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig +export VPC_PARAMETERS_FILE?=$(CURRENT_DIR)/../vpc/generated/vpc-output.json +export EKS_PARAMETERS_FILE?=$(CURRENT_DIR)/../eks/generated/eks-output.json + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var-file $(VPC_PARAMETERS_FILE) \ + -var-file $(EKS_PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"storage_endpoint_url\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json storage_endpoint_url >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var-file $(VPC_PARAMETERS_FILE) \ + -var-file $(EKS_PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'namespace=$(NAMESPACE)' \ + -var 'k8s_config_path=$(KUBECONFIG)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/backend.tf b/infrastructure/quick-deploy/aws-benchmark/storage/backend.tf new file mode 100644 index 000000000..a6c983004 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "storage-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "storage" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/locals.tf b/infrastructure/quick-deploy/aws-benchmark/storage/locals.tf new file mode 100644 index 000000000..ef7c1a9eb --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/locals.tf @@ -0,0 +1,72 @@ +# Current account +data "aws_caller_identity" "current" {} + +# Random alphanumeric +resource "random_string" "random_resources" { + length = 5 + special = false + upper = false + numeric = true +} + +resource "time_static" "creation_date" {} + +locals { + random_string = random_string.random_resources.result + suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string + iam_s3_decrypt_object_policy_name = "s3-encrypt-decrypt-${var.eks.cluster_name}" + iam_s3_read_object_policy_name = "s3-read-${var.eks.cluster_name}" + iam_s3_decrypt_s3_storage_object_policy_name = "s3-storage-object-encrypt-decrypt-${var.eks.cluster_name}" + kms_name = "armonik-kms-storage-${local.suffix}-${local.random_string}" + s3_fs_name = "${var.s3_fs.name}-${local.suffix}" + s3_os_name = var.s3_os != null ? "${var.s3_os.name}-${local.suffix}" : "" + elasticache_name = var.elasticache != null ? "${var.elasticache.name}-${local.suffix}" : "" + mq_name = "${var.mq.name}-${local.suffix}" + efs_name = "${var.pv_efs.efs.name}-${local.suffix}" + efs_csi_name = "efs-csi-driver-${local.suffix}" + persistent_volume = (try(var.mongodb.persistent_volume.storage_provisioner, "") == "efs.csi.aws.com" ? { + storage_provisioner = var.mongodb.persistent_volume.storage_provisioner + resources = var.mongodb.persistent_volume.resources + parameters = merge(var.mongodb.persistent_volume.parameters, { + provisioningMode = "efs-ap" + fileSystemId = module.efs_persistent_volume.0.efs_id + directoryPerms = "755" + gidRangeStart = "999" # optional + gidRangeEnd = "2000" # optional + basePath = "/mongodb" # optional + }) + } : null) + + tags = merge(var.tags, { + "application" = "armonik" + "deployment version" = local.suffix + "created by" = data.aws_caller_identity.current.arn + "creation date" = time_static.creation_date.rfc3339 + }) + s3_fs_kms_key_id = (var.s3_fs.kms_key_id != "" ? var.s3_fs.kms_key_id : module.kms.0.arn) + s3_os_kms_key_id = (can(coalesce(var.s3_os.kms_key_id)) ? var.s3_os.kms_key_id : module.kms.0.arn) + vpc = { + id = try(var.vpc.id, "") + cidr_block_private = var.vpc.cidr_block_private + cidr_blocks = concat([try(var.vpc.cidr_block, "")], try(var.vpc.pod_cidr_block_private, [])) + subnet_ids = try(var.vpc.private_subnet_ids, []) + } + + # Deployed storage + deployed_object_storages = concat( + length(module.elasticache) > 0 ? ["Redis"] : [], + length(module.s3_os) > 0 ? ["S3"] : [], + ) + deployed_table_storages = ["MongoDB"] + deployed_queue_storages = ["Amqp"] + + # Storage adapters + object_storage_adapter = try(coalesce( + length(module.elasticache) > 0 ? "Redis" : null, + length(module.s3_os) > 0 ? "S3" : null, + ), "") + table_storage_adapter = "MongoDB" + queue_storage_adapter = "Amqp" + adapter_class_name = module.mq.engine_type == "ActiveMQ" ? "ArmoniK.Core.Adapters.Amqp.QueueBuilder" : "ArmoniK.Core.Adapters.RabbitMQ.QueueBuilder" + adapter_absolute_path = module.mq.engine_type == "ActiveMQ" ? "/adapters/queue/amqp/ArmoniK.Core.Adapters.Amqp.dll" : "/adapters/queue/rabbit/ArmoniK.Core.Adapters.RabbitMQ.dll" +} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/main.tf b/infrastructure/quick-deploy/aws-benchmark/storage/main.tf new file mode 100644 index 000000000..ca9259774 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/main.tf @@ -0,0 +1,162 @@ +# AWS KMS +module "kms" { + count = (can(coalesce(var.s3_fs.kms_key_id)) && can(coalesce(var.elasticache.encryption_keys.kms_key_id)) && can(coalesce(var.elasticache.encryption_keys.log_kms_key_id)) && can(coalesce(var.s3_os.kms_key_id)) && can(coalesce(var.mq.kms_key_id)) ? 0 : 1) + source = "../generated/infra-modules/utils/aws/kms" + name = local.kms_name + tags = local.tags +} + +# AWS S3 as shared storage +module "s3_fs" { + source = "../generated/infra-modules/storage/aws/s3" + tags = local.tags + name = local.s3_fs_name + s3 = { + policy = var.s3_fs.policy + attach_policy = var.s3_fs.attach_policy + attach_deny_insecure_transport_policy = var.s3_fs.attach_deny_insecure_transport_policy + attach_require_latest_tls_policy = var.s3_fs.attach_require_latest_tls_policy + attach_public_policy = var.s3_fs.attach_public_policy + block_public_acls = var.s3_fs.attach_public_policy + block_public_policy = var.s3_fs.block_public_acls + ignore_public_acls = var.s3_fs.block_public_policy + restrict_public_buckets = var.s3_fs.restrict_public_buckets + kms_key_id = local.s3_fs_kms_key_id + sse_algorithm = (var.s3_fs.kms_key_id != "" ? var.s3_fs.sse_algorithm : "aws:kms") + ownership = var.s3_fs.ownership + versioning = var.s3_fs.versioning + } +} + +# AWS Elasticache +module "elasticache" { + count = var.elasticache != null ? 1 : 0 + source = "../generated/infra-modules/storage/aws/elasticache" + tags = local.tags + name = local.elasticache_name + vpc = local.vpc + elasticache = { + engine = var.elasticache.engine + engine_version = var.elasticache.engine_version + node_type = var.elasticache.node_type + apply_immediately = var.elasticache.apply_immediately + multi_az_enabled = var.elasticache.multi_az_enabled + automatic_failover_enabled = var.elasticache.automatic_failover_enabled + num_cache_clusters = var.elasticache.num_cache_clusters + preferred_cache_cluster_azs = var.elasticache.preferred_cache_cluster_azs + data_tiering_enabled = var.elasticache.data_tiering_enabled + log_retention_in_days = var.elasticache.log_retention_in_days + cloudwatch_log_groups = var.elasticache.cloudwatch_log_groups + encryption_keys = { + kms_key_id = (var.elasticache.encryption_keys.kms_key_id != "" ? var.elasticache.encryption_keys.kms_key_id : module.kms.0.arn) + log_kms_key_id = (var.elasticache.encryption_keys.log_kms_key_id != "" ? var.elasticache.encryption_keys.log_kms_key_id : module.kms.0.arn) + } + } +} + +# AWS S3 as objects storage +module "s3_os" { + count = var.s3_os != null ? 1 : 0 + source = "../generated/infra-modules/storage/aws/s3" + tags = local.tags + name = local.s3_os_name + s3 = { + policy = var.s3_os.policy + attach_policy = var.s3_os.attach_policy + attach_deny_insecure_transport_policy = var.s3_os.attach_deny_insecure_transport_policy + attach_require_latest_tls_policy = var.s3_os.attach_require_latest_tls_policy + attach_public_policy = var.s3_os.attach_public_policy + block_public_acls = var.s3_os.attach_public_policy + block_public_policy = var.s3_os.block_public_acls + ignore_public_acls = var.s3_os.block_public_policy + restrict_public_buckets = var.s3_os.restrict_public_buckets + kms_key_id = local.s3_os_kms_key_id + sse_algorithm = (var.s3_os.kms_key_id != "" ? var.s3_os.sse_algorithm : "aws:kms") + ownership = var.s3_os.ownership + versioning = var.s3_os.versioning + } +} + +# Amazon MQ +module "mq" { + source = "../generated/infra-modules/storage/aws/mq" + tags = local.tags + name = local.mq_name + namespace = var.namespace + vpc = local.vpc + user = { + password = var.mq_credentials.password + username = var.mq_credentials.username + } + mq = { + engine_type = var.mq.engine_type + engine_version = var.mq.engine_version + host_instance_type = var.mq.host_instance_type + apply_immediately = var.mq.apply_immediately + deployment_mode = var.mq.deployment_mode + storage_type = var.mq.storage_type + authentication_strategy = var.mq.authentication_strategy + publicly_accessible = var.mq.publicly_accessible + kms_key_id = (var.mq.kms_key_id != "" ? var.mq.kms_key_id : module.kms.0.arn) + } +} + +# MongoDB +module "mongodb" { + source = "../generated/infra-modules/storage/onpremise/mongodb" + namespace = var.namespace + working_dir = "${path.root}/../../.." + mongodb = { + image = var.mongodb.image + tag = var.mongodb.tag + node_selector = var.mongodb.node_selector + image_pull_secrets = var.mongodb.image_pull_secrets + replicas_number = var.mongodb.replicas_number + } + persistent_volume = local.persistent_volume + depends_on = [module.efs_persistent_volume] +} + +# AWS EFS as persistent volume +module "efs_persistent_volume" { + count = (try(var.mongodb.persistent_volume.storage_provisioner, "") == "efs.csi.aws.com" ? 1 : 0) + source = "../generated/infra-modules/persistent-volume/aws/efs" + eks_issuer = var.eks.issuer + vpc = local.vpc + efs = { + name = local.efs_name + kms_key_id = (var.pv_efs.efs.kms_key_id != "" && var.pv_efs.efs.kms_key_id != null ? var.pv_efs.efs.kms_key_id : module.kms.0.arn) + performance_mode = var.pv_efs.efs.performance_mode + throughput_mode = var.pv_efs.efs.throughput_mode + provisioned_throughput_in_mibps = var.pv_efs.efs.provisioned_throughput_in_mibps + transition_to_ia = var.pv_efs.efs.transition_to_ia + access_point = var.pv_efs.efs.access_point + } + csi_driver = { + name = local.efs_csi_name + namespace = var.pv_efs.csi_driver.namespace + image_pull_secrets = var.pv_efs.csi_driver.image_pull_secrets + node_selector = var.pv_efs.csi_driver.node_selector + repository = var.pv_efs.csi_driver.repository + version = var.pv_efs.csi_driver.version + docker_images = { + efs_csi = { + image = var.pv_efs.csi_driver.docker_images.efs_csi.image + tag = var.pv_efs.csi_driver.docker_images.efs_csi.tag + } + livenessprobe = { + image = var.pv_efs.csi_driver.docker_images.livenessprobe.image + tag = var.pv_efs.csi_driver.docker_images.livenessprobe.tag + } + node_driver_registrar = { + image = var.pv_efs.csi_driver.docker_images.node_driver_registrar.image + tag = var.pv_efs.csi_driver.docker_images.node_driver_registrar.tag + } + external_provisioner = { + image = var.pv_efs.csi_driver.docker_images.external_provisioner.image + tag = var.pv_efs.csi_driver.docker_images.external_provisioner.tag + } + } + } + tags = local.tags +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf new file mode 100644 index 000000000..22e108b1e --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf @@ -0,0 +1,35 @@ +# Storage +output "storage_endpoint_url" { + description = "Storage endpoints URLs" + value = { + object_storage_adapter = local.object_storage_adapter + table_storage_adapter = local.table_storage_adapter + queue_storage_adapter = local.queue_storage_adapter + deployed_object_storages = local.deployed_object_storages + deployed_table_storages = local.deployed_table_storages + deployed_queue_storages = local.deployed_queue_storages + activemq = { + url = module.mq.activemq_endpoint_url.url + web_url = module.mq.web_url + } + redis = length(module.elasticache) > 0 ? { + url = module.elasticache[0].redis_endpoint_url.url + } : null + s3 = length(module.s3_os) > 0 ? { + url = "https://s3.${var.region}.amazonaws.com" + bucket_name = module.s3_os[0].s3_bucket_name + must_force_path_style = false + kms_key_id = module.s3_os[0].kms_key_id + } : null + mongodb = { + url = module.mongodb.url + number_of_replicas = var.mongodb.replicas_number + } + shared = { + service_url = "https://s3.${var.region}.amazonaws.com" + kms_key_id = module.s3_fs.kms_key_id + name = module.s3_fs.s3_bucket_name + file_storage_type = "S3" + } + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars new file mode 100644 index 000000000..b1c4434ef --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars @@ -0,0 +1,176 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# SUFFIX +suffix = "main" + +# AWS TAGs +tags = { + "name" = "" + "env" = "" + "entity" = "" + "bu" = "" + "owner" = "" + "application code" = "" + "project code" = "" + "cost center" = "" + "Support Contact" = "" + "origin" = "terraform" + "unit of measure" = "" + "epic" = "" + "functional block" = "" + "hostname" = "" + "interruptible" = "" + "tostop" = "" + "tostart" = "" + "branch" = "" + "gridserver" = "" + "it division" = "" + "Confidentiality" = "" + "csp" = "aws" + "grafanaserver" = "" + "Terraform" = "true" + "DST_Update" = "" +} + +# Kubernetes namespace +namespace = "armonik" + +# S3 as shared storage +s3_fs = { + name = "armonik-s3fs" + policy = "" + attach_policy = false + attach_deny_insecure_transport_policy = true + attach_require_latest_tls_policy = true + attach_public_policy = false + block_public_acls = true + block_public_policy = true + ignore_public_acls = true + restrict_public_buckets = true + kms_key_id = "" + sse_algorithm = "" + ownership = "BucketOwnerPreferred" + versioning = "Disabled" +} + +# Object storage +# Uncomment either the `Elasticache` or the `S3` parameter +# AWS Elasticache +elasticache = { + name = "armonik-elasticache" + engine = "redis" + engine_version = "6.x" + node_type = "cache.r4.large" + apply_immediately = true + multi_az_enabled = false + automatic_failover_enabled = true + num_cache_clusters = 2 + preferred_cache_cluster_azs = [] + # The order of the availability zones in the list is considered. The first item in the list will be the primary node + data_tiering_enabled = false # This parameter must be set to true when using r6gd nodes. + log_retention_in_days = 30 + # Name of CloudWatch log groups for slow-log and engine-log to be created + cloudwatch_log_groups = { + slow_log = "" + engine_log = "" + } + encryption_keys = { + kms_key_id = "" + log_kms_key_id = "" + } +} +/* +# S3 as shared storage +s3_os = { + name = "armonik-s3os" + policy = "" + attach_policy = false + attach_deny_insecure_transport_policy = true + attach_require_latest_tls_policy = true + attach_public_policy = false + block_public_acls = true + block_public_policy = true + ignore_public_acls = true + restrict_public_buckets = true + kms_key_id = "" + sse_algorithm = "" + ownership = "BucketOwnerPreferred" + versioning = "Disabled" +} +*/ + +# MQ parameters +mq = { + name = "armonik-mq" + engine_type = "ActiveMQ" + engine_version = "5.16.4" + host_instance_type = "mq.m5.xlarge" + apply_immediately = true + deployment_mode = "SINGLE_INSTANCE" # "SINGLE_INSTANCE" | "ACTIVE_STANDBY_MULTI_AZ" + storage_type = "ebs" # "ebs" | "efs" + kms_key_id = "" + authentication_strategy = "simple" # "ldap" + publicly_accessible = false +} + +# MQ Credentials +mq_credentials = { + password = "" + username = "" +} + +# Parameters for MongoDB +mongodb = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/mongodb" + tag = "6.0.1" + node_selector = { service = "state-database" } + image_pull_secrets = "" + persistent_volume = null + replicas_number = 2 + # example: {storage_provisioner="efs.csi.aws.com",parameters=null,resources={limits=null,requests={storage="5Gi"}}} +} + +# AWS EFS as Persistent volume +pv_efs = { + # AWS Elastic Filesystem Service + efs = { + name = "armonik-efs" + kms_key_id = "" + performance_mode = "generalPurpose" # "generalPurpose" or "maxIO" + throughput_mode = "bursting" # "bursting" or "provisioned" + provisioned_throughput_in_mibps = null + transition_to_ia = "AFTER_7_DAYS" + # "AFTER_7_DAYS", "AFTER_14_DAYS", "AFTER_30_DAYS", "AFTER_60_DAYS", or "AFTER_90_DAYS" + access_point = null #["mongo"] + } + # EFS Container Storage Interface (CSI) Driver + csi_driver = { + namespace = "kube-system" + image_pull_secrets = "" + node_selector = { service = "state-database" } + repository = "https://kubernetes-sigs.github.io/aws-efs-csi-driver/" + version = "2.3.0" + docker_images = { + efs_csi = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/aws-efs-csi-driver" + tag = "v1.5.1" + } + livenessprobe = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/livenessprobe" + tag = "v2.9.0-eks-1-22-19" + } + node_driver_registrar = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/node-driver-registrar" + tag = "v2.7.0-eks-1-22-19" + } + external_provisioner = { + image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/external-provisioner" + tag = "v3.4.0-eks-1-22-19" + } + } + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/providers.tf b/infrastructure/quick-deploy/aws-benchmark/storage/providers.tf new file mode 100644 index 000000000..1fe5e2c4a --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/providers.tf @@ -0,0 +1,24 @@ +provider "aws" { + region = var.region + profile = var.profile +} + +# 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/aws-benchmark/storage/s3-iam-object-storage.tf b/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam-object-storage.tf new file mode 100644 index 000000000..ae5ca842e --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam-object-storage.tf @@ -0,0 +1,68 @@ +# Decrypt objects in S3 +data "aws_iam_policy_document" "decrypt_s3_storage_object" { + count = length(module.s3_os) > 0 ? 1 : 0 + statement { + sid = "KMSAccess" + actions = [ + "kms:Encrypt", + "kms:Decrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*", + "kms:DescribeKey" + ] + effect = "Allow" + resources = [ + local.s3_os_kms_key_id + ] + } +} + +resource "aws_iam_policy" "decrypt_s3_storage_object" { + count = length(module.s3_os) > 0 ? 1 : 0 + name_prefix = local.iam_s3_decrypt_s3_storage_object_policy_name + description = "Policy for alowing decryption of encrypted object in S3 ${var.eks.cluster_name}" + policy = data.aws_iam_policy_document.decrypt_s3_storage_object[0].json + tags = local.tags +} + +resource "aws_iam_policy_attachment" "decrypt_s3_storage_object" { + count = length(module.s3_os) > 0 ? 1 : 0 + name = "s3-encrypt-decrypt" + policy_arn = aws_iam_policy.decrypt_s3_storage_object[0].arn + roles = var.eks.worker_iam_role_names +} + +# Read objects in S3 +data "aws_iam_policy_document" "fullaccess_s3_storage_object" { + count = length(module.s3_os) > 0 ? 1 : 0 + statement { + sid = "FullAccessFromS3" + actions = [ + "s3:PutObject", + "s3:GetObject", + "s3:ListBucket", + "s3:DeleteObject", + "s3:PutObjectAcl", + "s3:PutObjectTagging", + ] + effect = "Allow" + resources = [ + "${module.s3_os[0].arn}/*" + ] + } +} + +resource "aws_iam_policy" "fullaccess_s3_storage_object" { + count = length(module.s3_os) > 0 ? 1 : 0 + name_prefix = "s3-fullAccess-${var.eks.cluster_name}" + description = "Policy for allowing read/write/delete object in S3 ${var.eks.cluster_name}" + policy = data.aws_iam_policy_document.fullaccess_s3_storage_object[0].json + tags = local.tags +} + +resource "aws_iam_policy_attachment" "fullaccess_s3_storage_object_attachment" { + count = length(module.s3_os) > 0 ? 1 : 0 + name = "s3-fullAccess-${var.eks.cluster_name}" + policy_arn = aws_iam_policy.fullaccess_s3_storage_object[0].arn + roles = var.eks.worker_iam_role_names +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf b/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf new file mode 100644 index 000000000..5af11a4a5 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf @@ -0,0 +1,57 @@ +# Decrypt objects in S3 +data "aws_iam_policy_document" "decrypt_object" { + statement { + sid = "KMSAccess" + actions = [ + "kms:Encrypt", + "kms:Decrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*", + "kms:DescribeKey" + ] + effect = "Allow" + resources = [ + local.s3_fs_kms_key_id + ] + } +} + +resource "aws_iam_policy" "decrypt_object" { + name_prefix = local.iam_s3_decrypt_object_policy_name + description = "Policy for alowing decryption of encrypted object in S3 ${var.eks.cluster_name}" + policy = data.aws_iam_policy_document.decrypt_object.json + tags = local.tags +} + +resource "aws_iam_policy_attachment" "decrypt_object" { + name = local.iam_s3_decrypt_object_policy_name + policy_arn = aws_iam_policy.decrypt_object.arn + roles = var.eks.worker_iam_role_names +} + +# Read objects in S3 +data "aws_iam_policy_document" "read_object" { + statement { + sid = "ReadFromS3" + actions = [ + "s3:GetObject" + ] + effect = "Allow" + resources = [ + "${module.s3_fs.arn}/*" + ] + } +} + +resource "aws_iam_policy" "read_object" { + name_prefix = "s3-read-${var.eks.cluster_name}" + description = "Policy for allowing read object in S3 ${var.eks.cluster_name}" + policy = data.aws_iam_policy_document.read_object.json + tags = local.tags +} + +resource "aws_iam_policy_attachment" "read_object_attachment" { + name = "s3-read-${var.eks.cluster_name}" + policy_arn = aws_iam_policy.read_object.arn + roles = var.eks.worker_iam_role_names +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf b/infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf new file mode 100644 index 000000000..7e3c99370 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf @@ -0,0 +1,99 @@ +# Secrets +resource "kubernetes_secret" "elasticache" { + count = length(module.elasticache) > 0 ? 1 : 0 + metadata { + name = "redis" + namespace = var.namespace + } + data = { + "chain.pem" = "" + username = "" + password = "" + host = module.elasticache[0].redis_endpoint_url.host + port = module.elasticache[0].redis_endpoint_url.port + url = module.elasticache[0].redis_endpoint_url.url + } +} + +resource "kubernetes_secret" "mq" { + metadata { + name = "activemq" + namespace = var.namespace + } + data = { + "chain.pem" = "" + username = module.mq.user.username + password = module.mq.user.password + host = module.mq.activemq_endpoint_url.host + port = module.mq.activemq_endpoint_url.port + url = module.mq.activemq_endpoint_url.url + web-url = module.mq.web_url + } +} + +resource "kubernetes_secret" "shared_storage" { + metadata { + name = "shared-storage" + namespace = var.namespace + } + data = { + service_url = "https://s3.${var.region}.amazonaws.com" + kms_key_id = module.s3_fs.kms_key_id + name = module.s3_fs.s3_bucket_name + access_key_id = "" + secret_access_key = "" + file_storage_type = "S3" + must_force_path_style = false + } +} + +resource "kubernetes_secret" "s3" { + count = length(module.s3_os) > 0 ? 1 : 0 + metadata { + name = "s3" + namespace = var.namespace + } + data = { + username = "" + password = "" + url = "https://s3.${var.region}.amazonaws.com" + bucket_name = module.s3_os[0].s3_bucket_name + kms_key_id = module.s3_os[0].kms_key_id + must_force_path_style = false + } +} + +resource "kubernetes_secret" "deployed_object_storage" { + metadata { + name = "deployed-object-storage" + namespace = var.namespace + } + data = { + list = join(",", local.deployed_object_storages) + adapter = local.object_storage_adapter + } +} + +resource "kubernetes_secret" "deployed_table_storage" { + metadata { + name = "deployed-table-storage" + namespace = var.namespace + } + data = { + list = join(",", local.deployed_table_storages) + adapter = local.table_storage_adapter + } +} + +resource "kubernetes_secret" "deployed_queue_storage" { + metadata { + name = "deployed-queue-storage" + namespace = var.namespace + } + data = { + list = join(",", local.deployed_queue_storages) + adapter = local.queue_storage_adapter + adapter_class_name = local.adapter_class_name + adapter_absolute_path = local.adapter_absolute_path + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/variables.tf b/infrastructure/quick-deploy/aws-benchmark/storage/variables.tf new file mode 100644 index 000000000..7f66c17bc --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/variables.tf @@ -0,0 +1,230 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# SUFFIX +variable "suffix" { + description = "To suffix the AWS resources" + type = string + default = "" +} + +# AWS TAGs +variable "tags" { + description = "Tags for AWS resources" + type = any + default = {} +} + +# EKS infos +variable "eks" { + description = "EKS cluster infos" + type = any + default = {} +} + +# Kubeconfig path +variable "k8s_config_path" { + description = "Path of the configuration file of K8s" + type = string + default = "~/.kube/config" +} + +# Kubeconfig context +variable "k8s_config_context" { + description = "Context of K8s" + type = string + default = "default" +} + +# Kubernetes namespace +variable "namespace" { + description = "Kubernetes namespace for ArmoniK" + type = string + default = "armonik" +} + +# VPC infos +variable "vpc" { + description = "AWS VPC info" + type = any +} + +# S3 as shared storage +variable "s3_fs" { + description = "AWS S3 bucket as shared storage" + type = object({ + name = string + policy = string + attach_policy = bool + attach_deny_insecure_transport_policy = bool + attach_require_latest_tls_policy = bool + attach_public_policy = bool + block_public_acls = bool + block_public_policy = bool + ignore_public_acls = bool + restrict_public_buckets = bool + kms_key_id = string + sse_algorithm = string + ownership = string + versioning = string + }) +} + +# AWS Elasticache +variable "elasticache" { + description = "Parameters of Elasticache" + type = object({ + name = string + engine = string + engine_version = string + node_type = string + apply_immediately = bool + multi_az_enabled = bool + automatic_failover_enabled = bool + num_cache_clusters = number + preferred_cache_cluster_azs = list(string) + data_tiering_enabled = bool + log_retention_in_days = number + cloudwatch_log_groups = object({ + slow_log = string + engine_log = string + }) + encryption_keys = object({ + kms_key_id = string + log_kms_key_id = string + }) + }) + default = null +} + +# MQ parameters +variable "mq" { + description = "MQ Service parameters" + type = object({ + name = string + engine_type = string + engine_version = string + host_instance_type = string + apply_immediately = bool + deployment_mode = string + storage_type = string + kms_key_id = string + authentication_strategy = string + publicly_accessible = bool + }) +} + +# MQ Credentials +variable "mq_credentials" { + description = "Amazon MQ credentials" + type = object({ + password = string + username = string + }) + default = { + password = "" + username = "" + } +} + +# Parameters for MongoDB +variable "mongodb" { + description = "Parameters of MongoDB" + type = object({ + image = string + tag = string + node_selector = any + image_pull_secrets = string + replicas_number = number + persistent_volume = object({ + storage_provisioner = string + parameters = map(string) + #Resources for PVC + resources = object({ + limits = object({ + storage = string + }) + requests = object({ + storage = string + }) + }) + }) + }) +} + +# AWS EFS as Persistent volume +variable "pv_efs" { + description = "AWS EFS as Persistent volume" + type = object({ + # AWS Elastic Filesystem Service + efs = object({ + name = string + kms_key_id = string + performance_mode = string # "generalPurpose" or "maxIO" + throughput_mode = string # "bursting" or "provisioned" + provisioned_throughput_in_mibps = number + transition_to_ia = string + # "AFTER_7_DAYS", "AFTER_14_DAYS", "AFTER_30_DAYS", "AFTER_60_DAYS", or "AFTER_90_DAYS" + access_point = list(string) + }) + # EFS Container Storage Interface (CSI) Driver + csi_driver = object({ + namespace = string + image_pull_secrets = string + node_selector = any + repository = optional(string, "https://kubernetes-sigs.github.io/aws-efs-csi-driver/") + version = optional(string, "2.3.0") + docker_images = object({ + efs_csi = object({ + image = string + tag = string + }) + livenessprobe = object({ + image = string + tag = string + }) + node_driver_registrar = object({ + image = string + tag = string + }) + external_provisioner = object({ + image = string + tag = string + }) + }) + }) + }) +} + +# S3 as object storage +variable "s3_os" { + description = "AWS S3 bucket as shared storage" + type = object({ + name = string + policy = string + attach_policy = bool + attach_deny_insecure_transport_policy = bool + attach_require_latest_tls_policy = bool + attach_public_policy = bool + block_public_acls = bool + block_public_policy = bool + ignore_public_acls = bool + restrict_public_buckets = bool + kms_key_id = string + sse_algorithm = string + ownership = string + versioning = string + }) + default = null +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/versions.tf b/infrastructure/quick-deploy/aws-benchmark/storage/versions.tf new file mode 100644 index 000000000..6afbb9b9f --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/storage/versions.tf @@ -0,0 +1,32 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.47.0" + } + null = { + source = "hashicorp/null" + version = "~> 3.1.0" + } + random = { + source = "hashicorp/random" + version = "~> 3.4.3" + } + kubernetes = { + source = "hashicorp/kubernetes" + version = "~> 2.13.0" + } + kubectl = { + source = "gavinbunney/kubectl" + version = "~> 1.14.0" + } + tls = { + source = "hashicorp/tls" + version = "~> 4.0.4" + } + pkcs12 = { + source = "chilicat/pkcs12" + version = "~> 0.0.7" + } + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/Makefile b/infrastructure/quick-deploy/aws-benchmark/vpc/Makefile new file mode 100644 index 000000000..081cce988 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/Makefile @@ -0,0 +1,70 @@ +CURRENT_DIR=$(shell pwd) +GENERATED_DIR=$(CURRENT_DIR)/generated +PARAMETERS_FILE?=parameters.tfvars +STATE_FILE=vpc-terraform.tfstate +OUTPUT_FILE=$(GENERATED_DIR)/vpc-output.json +MODULES_DIR?=$(GENERATED_DIR)/infra-modules +MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') +MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') + +export TF_DATA_DIR?=$(GENERATED_DIR) +export SUFFIX?=main +export REGION?=eu-west-3 +export PROFILE?=default +export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) +export PUBLIC_VPC?=true + +.PHONY: apply destroy + +all: get-modules init apply output +deploy: get-modules init apply output +destroy: init delete + +init: + mkdir -p $(GENERATED_DIR) + terraform init -upgrade \ + -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ + -backend-config 'region=$(REGION)' \ + -backend-config 'key=$(STATE_FILE)' \ + -backend-config 'profile=$(PROFILE)' + +apply: + terraform apply \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'enable_public_vpc=$(PUBLIC_VPC)' \ + -state $(STATE_FILE) \ + -auto-approve + +output: + @echo -n "{\"vpc\":" > $(OUTPUT_FILE) + @terraform output -state=$(STATE_FILE) -json vpc >> $(OUTPUT_FILE) + @echo -n "}" >> $(OUTPUT_FILE) + @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" + +delete: + terraform destroy \ + -var-file $(PARAMETERS_FILE) \ + -var 'region=$(REGION)' \ + -var 'suffix=$(SUFFIX)' \ + -var 'profile=$(PROFILE)' \ + -var 'enable_public_vpc=$(PUBLIC_VPC)' \ + -state $(STATE_FILE) \ + -auto-approve + +get-modules: + @if [ -d $(MODULES_DIR) ]; then\ + git -C $(MODULES_DIR) fetch --all --tags;\ + git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ + git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ + else \ + git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ + fi + +clean: + rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform + +docs: + terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf new file mode 100644 index 000000000..43c4092a5 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf @@ -0,0 +1,10 @@ +terraform { + backend "s3" { + key = "vpc-terraform.tfstate" + region = var.region + profile = var.profile + encrypt = true + force_path_style = true + workspace_key_prefix = "vpc" + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf new file mode 100644 index 000000000..f85409def --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf @@ -0,0 +1,26 @@ +# Current account +data "aws_caller_identity" "current" {} + +resource "random_string" "random_resources" { + length = 5 + special = false + upper = false + numeric = true +} + +resource "time_static" "creation_date" {} + +locals { + random_string = random_string.random_resources.result + suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string + cluster_name = "${var.cluster_name}-${local.suffix}" + kms_name = "armonik-kms-vpc-${local.suffix}-${local.random_string}" + vpc_name = "${var.vpc.name}-${local.suffix}" + enable_private_subnet = !var.enable_public_vpc + tags = merge(var.tags, { + "application" = "armonik" + "deployment version" = local.suffix + "created by" = data.aws_caller_identity.current.arn + "creation date" = time_static.creation_date.rfc3339 + }) +} diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/main.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/main.tf new file mode 100644 index 000000000..4c25efc18 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/main.tf @@ -0,0 +1,27 @@ +# AWS KMS +module "kms" { + count = (var.vpc.flow_log_cloudwatch_log_group_kms_key_id == "" ? 1 : 0) + source = "../generated/infra-modules/utils/aws/kms" + name = local.kms_name + tags = local.tags +} + +# AWS VPC +module "vpc" { + source = "../generated/infra-modules/networking/aws/vpc" + tags = local.tags + name = local.vpc_name + vpc = { + cluster_name = local.cluster_name + private_subnets = var.vpc.cidr_block_private + public_subnets = var.vpc.cidr_block_public + main_cidr_block = var.vpc.main_cidr_block + pod_cidr_block_private = var.vpc.pod_cidr_block_private + enable_private_subnet = local.enable_private_subnet + enable_nat_gateway = local.enable_private_subnet + single_nat_gateway = local.enable_private_subnet + flow_log_cloudwatch_log_group_retention_in_days = var.vpc.flow_log_cloudwatch_log_group_retention_in_days + flow_log_cloudwatch_log_group_kms_key_id = (var.vpc.flow_log_cloudwatch_log_group_kms_key_id != "" ? var.vpc.flow_log_cloudwatch_log_group_kms_key_id : module.kms.0.arn) + peering = var.vpc.peering + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf new file mode 100644 index 000000000..31317c575 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf @@ -0,0 +1,14 @@ +# VPC +output "vpc" { + description = "VPC infos" + value = { + id = module.vpc.id + cidr_block = module.vpc.cidr_block + cidr_block_private = var.vpc.cidr_block_private + private_subnet_ids = module.vpc.private_subnet_ids + public_subnet_ids = module.vpc.public_subnet_ids + pods_subnet_ids = module.vpc.pods_subnet_ids + pod_cidr_block_private = module.vpc.pod_cidr_block_private + eks_cluster_name = local.cluster_name + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars new file mode 100644 index 000000000..de09798ae --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars @@ -0,0 +1,60 @@ +# Profile +profile = "default" + +# Region +region = "eu-west-3" + +# SUFFIX +suffix = "main" + +# AWS TAGs +tags = { + "name" = "" + "env" = "" + "entity" = "" + "bu" = "" + "owner" = "" + "application code" = "" + "project code" = "" + "cost center" = "" + "Support Contact" = "" + "origin" = "terraform" + "unit of measure" = "" + "epic" = "" + "functional block" = "" + "hostname" = "" + "interruptible" = "" + "tostop" = "" + "tostart" = "" + "branch" = "" + "gridserver" = "" + "it division" = "" + "Confidentiality" = "" + "csp" = "aws" + "grafanaserver" = "" + "Terraform" = "true" + "DST_Update" = "" +} + +# EKS cluster name +cluster_name = "armonik-eks" + +# VPC +vpc = { + name = "armonik-vpc" + # list of CIDR block associated with the private subnet + cidr_block_private = ["10.0.0.0/18", "10.0.64.0/18", "10.0.128.0/18"] + # list of CIDR block associated with the public subnet + cidr_block_public = ["10.0.192.0/24", "10.0.193.0/24", "10.0.194.0/24"] + # Main CIDR block associated to the VPC + main_cidr_block = "10.0.0.0/16" + # cidr block associated with pod + pod_cidr_block_private = ["10.1.0.0/16", "10.2.0.0/16", "10.3.0.0/16"] + enable_private_subnet = true + flow_log_cloudwatch_log_group_kms_key_id = "" + flow_log_cloudwatch_log_group_retention_in_days = 30 + peering = { + enabled = false + peer_vpc_ids = [] + } +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf new file mode 100644 index 000000000..c0fc95d9d --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf @@ -0,0 +1,4 @@ +provider "aws" { + region = var.region + profile = var.profile +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf new file mode 100644 index 000000000..ba45ad415 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf @@ -0,0 +1,64 @@ +# Profile +variable "profile" { + description = "Profile of AWS credentials to deploy Terraform sources" + type = string + default = "default" +} + +# Region +variable "region" { + description = "AWS region where the infrastructure will be deployed" + type = string + default = "eu-west-3" +} + +# SUFFIX +variable "suffix" { + description = "To suffix the AWS resources" + type = string + default = "" +} + +# AWS TAGs +variable "tags" { + description = "Tags for AWS resources" + type = any + default = {} +} + +# EKS cluster name +variable "cluster_name" { + description = "EKS cluster name" + type = string + default = "" +} + +# VPC +variable "vpc" { + description = "Parameters of AWS VPC" + type = object({ + name = string + # list of CIDR block associated with the private subnet + cidr_block_private = list(string) + # list of CIDR block associated with the public subnet + cidr_block_public = list(string) + # Main CIDR block associated to the VPC + main_cidr_block = string + # cidr block associated with pod + pod_cidr_block_private = list(string) + enable_private_subnet = bool + flow_log_cloudwatch_log_group_kms_key_id = string + flow_log_cloudwatch_log_group_retention_in_days = number + peering = object({ + enabled = bool + peer_vpc_ids = list(string) + }) + }) +} + +# Enable public VPC +variable "enable_public_vpc" { + description = "Enable public VPC" + type = bool + default = true +} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf new file mode 100644 index 000000000..223ad5cf4 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.47.0" + } + random = { + source = "hashicorp/random" + version = "~> 3.4.3" + } + null = { + source = "hashicorp/null" + version = "~> 3.1.0" + } + } +} \ No newline at end of file diff --git a/test/README.md b/test/README.md index d895328e6..84ec70a9f 100644 --- a/test/README.md +++ b/test/README.md @@ -3,7 +3,7 @@ This document describes how to use the benchmarking scripts. Those tests are an example of benchmarking tests using bench and htcmock to measure the performances of ArmoniK. -We have to deploy ArmoniK on aws with two partitions (bench and htcmock) with 100 pods for each partition using redis as storage. +We have to deploy ArmoniK(aws-benchmark) on aws with two partitions (bench and htcmock) with 100 pods for each partition using redis as storage.
 .  
diff --git a/test/bench/100_pods/redis/python_scripts/merge_jsons.py b/test/bench/100_pods/redis/python_scripts/merge_jsons.py
index 665f35362..f1b2c17ee 100755
--- a/test/bench/100_pods/redis/python_scripts/merge_jsons.py
+++ b/test/bench/100_pods/redis/python_scripts/merge_jsons.py
@@ -14,6 +14,6 @@
 with open("../stats/5k.json", "r") as stats:
     result2 = json.load(stats)
 # print(merged)
-with open("results.json", "w") as r:
+with open("../stats/results.json", "w") as r:
     dict_json = [merge(result[0], result[1]), result[2], result2]
     json.dump(dict_json, r)
diff --git a/test/bench/100_pods/redis/test_scripts/bench_1k.sh b/test/bench/100_pods/redis/test_scripts/bench_1k.sh
index 7cae27089..c49cc6218 100755
--- a/test/bench/100_pods/redis/test_scripts/bench_1k.sh
+++ b/test/bench/100_pods/redis/test_scripts/bench_1k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
 #run  1000 tasks on 100 pods
 docker run --rm \
diff --git a/test/bench/100_pods/redis/test_scripts/bench_5k.sh b/test/bench/100_pods/redis/test_scripts/bench_5k.sh
index 83036fa76..8ca3fc7b3 100755
--- a/test/bench/100_pods/redis/test_scripts/bench_5k.sh
+++ b/test/bench/100_pods/redis/test_scripts/bench_5k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
 #run  5000 tasks on 100 pods
 docker run --rm \
diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh
index 629dfbbe1..ab64f113e 100755
--- a/test/bench/100_pods/redis/test_scripts/test.sh
+++ b/test/bench/100_pods/redis/test_scripts/test.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # warm up run
-./bench_10k.sh
+./bench_1k.sh
 
 #clearmeasured runs
 ./bench_1k.sh >> ../stats/1k.json && ./bench_5k.sh >> ../stats/5k.json
diff --git a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py
index 8ebace6ab..0092ce92d 100755
--- a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py
+++ b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py
@@ -11,7 +11,7 @@
     result.append(json.load(test_env))
 with open("../stats/5k.json", "r") as stats:
     result.append(json.load(stats))
-with open("results.json", "w") as r:
+with open("../stats/results.json", "w") as r:
 
     dict_json = [merge(result[0], result[1]), result[2]]
     json.dump(dict_json, r)
diff --git a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh
index de778ea8c..4aac6b16c 100755
--- a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh
+++ b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
  docker run --rm \
               -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \
diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh
index 2c3a83024..c296382c0 100755
--- a/test/htcmock/100_pods/redis/test_scripts/test.sh
+++ b/test/htcmock/100_pods/redis/test_scripts/test.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # warm up run
-./bench_10k.sh
+./htcmock_5k.sh
 
 #clearmeasured runs
 ./htcmock_5k.sh >> ../stats/5k.json

From a755c83ad2d8dd881754b603f1a84ebf46456de8 Mon Sep 17 00:00:00 2001
From: YKharouni 
Date: Wed, 5 Jul 2023 11:29:23 +0200
Subject: [PATCH 13/38] delete result examples

---
 .../100_pods/redis/test_scripts/results.json  | 156 ------------------
 .../100_pods/redis/test_scripts/results.json  | 126 --------------
 2 files changed, 282 deletions(-)
 delete mode 100644 test/bench/100_pods/redis/test_scripts/results.json
 delete mode 100644 test/htcmock/100_pods/redis/test_scripts/results.json

diff --git a/test/bench/100_pods/redis/test_scripts/results.json b/test/bench/100_pods/redis/test_scripts/results.json
deleted file mode 100644
index 0b1cdeaa7..000000000
--- a/test/bench/100_pods/redis/test_scripts/results.json
+++ /dev/null
@@ -1,156 +0,0 @@
-[
-  {
-    "armonik_versions": {
-      "armonik": "2.13.2",
-      "infra": "0.0.2",
-      "core": "0.13.2",
-      "api": "3.6.0",
-      "gui": "0.9.0",
-      "extcsharp": "0.11.1",
-      "samples": "2.13.2"
-    },
-    "armonik_images": {
-      "armonik": [],
-      "infra": [
-        "https://github.com/aneoconsulting/ArmoniK.Infra.git"
-      ],
-      "core": [
-        "dockerhubaneo/armonik_pollingagent",
-        "dockerhubaneo/armonik_control_metrics",
-        "dockerhubaneo/armonik_control_partition_metrics",
-        "dockerhubaneo/armonik_control",
-        "dockerhubaneo/armonik_core_stream_test_worker",
-        "dockerhubaneo/armonik_core_stream_test_client",
-        "dockerhubaneo/armonik_core_htcmock_test_worker",
-        "dockerhubaneo/armonik_core_htcmock_test_client",
-        "dockerhubaneo/armonik_core_bench_test_worker",
-        "dockerhubaneo/armonik_core_bench_test_client"
-      ],
-      "api": [],
-      "gui": [
-        "dockerhubaneo/armonik_admin_app",
-        "dockerhubaneo/armonik_admin_api"
-      ],
-      "extcsharp": [
-        "dockerhubaneo/armonik_worker_dll"
-      ],
-      "samples": []
-    },
-    "image_tags": {
-      "registry.k8s.io/autoscaling/cluster-autoscaler": "v1.23.0",
-      "registry.k8s.io/metrics-server/metrics-server": "v0.6.2",
-      "ghcr.io/kedacore/keda": "2.9.3",
-      "ghcr.io/kedacore/keda-metrics-apiserver": "2.9.3",
-      "public.ecr.aws/aws-ec2/aws-node-termination-handler": "v1.19.0",
-      "amazon/aws-efs-csi-driver": "v1.5.1",
-      "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe": "v2.9.0-eks-1-22-19",
-      "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar": "v2.7.0-eks-1-22-19",
-      "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner": "v3.4.0-eks-1-22-19",
-      "symptoma/activemq": "5.17.0",
-      "mongo": "6.0.1",
-      "redis": "7.0.8",
-      "minio/minio": "RELEASE.2023-02-10T18-48-39Z",
-      "datalust/seq": "2023.1",
-      "grafana/grafana": "9.3.6",
-      "prom/node-exporter": "v1.5.0",
-      "prom/prometheus": "v2.42.0",
-      "fluent/fluent-bit": "2.0.9",
-      "rtsp/mongosh": "1.7.1",
-      "nginx": "1.23.3",
-      "nginxinc/nginx-unprivileged": "1.23.3",
-      "datalust/seqcli": "2023.1"
-    },
-    "helm_charts": {
-      "keda": {
-        "repository": "https://kedacore.github.io/charts",
-        "version": "2.9.4"
-      },
-      "metrics_server": {
-        "repository": "https://kubernetes-sigs.github.io/metrics-server/",
-        "version": "3.8.3"
-      },
-      "cluster_autoscaler": {
-        "repository": "https://kubernetes.github.io/autoscaler",
-        "version": "9.24.0"
-      },
-      "termination_handler": {
-        "repository": "https://aws.github.io/eks-charts",
-        "version": "0.21.0"
-      },
-      "efs_csi_driver": {
-        "repository": "https://kubernetes-sigs.github.io/aws-efs-csi-driver/",
-        "version": "2.3.0"
-      }
-    },
-    "test_environnement": {
-      "instance_type": "c24.xlarge",
-      "Processor": "Intel Xeon de 2e (Cascade Lake)",
-      "CPU_frequency": "3.6 GHz - 3.9 GHz",
-      "nb_cpus": "96",
-      "RAM": "192",
-      "Network_bandwidth": "25",
-      "EBS_bandwidth": "19000",
-      "Kubernetes": "AWS EKS 1.25",
-      "Object_object_type": "AWS S3",
-      "Storage_queue_storage": "Amazon MQ, broker : ActiveMQ 5.16.4",
-      "Storage_table_type": "MongoDB 6.0.1",
-      "OS": "Linux"
-    }
-  },
-  [
-    {
-      "Test": "bench",
-      "ElapsedTime": "00:00:17.3338445",
-      "SubmissionTime": "00:00:02.2282835",
-      "TasksExecutionTime": "00:00:12.4735445",
-      "ResultRetrievingTime": "00:00:02.6031342",
-      "CountExecutionTime": "00:00:00.0250447",
-      "TotalTasks": 1000,
-      "ErrorTasks": 0,
-      "CompletedTasks": 1000,
-      "CancelledTasks": 0,
-      "$type": "BenchOptions",
-      "NTasks": 1000,
-      "TaskDurationMs": 1,
-      "PayloadSize": 1,
-      "ResultSize": 1,
-      "BatchSize": 50,
-      "TaskRpcException": "",
-      "TaskError": "",
-      "Partition": "bench",
-      "ShowEvents": false,
-      "MaxRetries": 5,
-      "DegreeOfParallelism": 5,
-      "throughput": 450.6534474988734,
-      "nb_pods": 100
-    }
-  ],
-  [
-    {
-      "Test": "bench",
-      "ElapsedTime": "00:01:30.3747670",
-      "SubmissionTime": "00:00:11.2812712",
-      "TasksExecutionTime": "00:01:06.3434008",
-      "ResultRetrievingTime": "00:00:12.7157179",
-      "CountExecutionTime": "00:00:00.0366380",
-      "TotalTasks": 5000,
-      "ErrorTasks": 0,
-      "CompletedTasks": 5000,
-      "CancelledTasks": 0,
-      "$type": "BenchOptions",
-      "NTasks": 5000,
-      "TaskDurationMs": 1,
-      "PayloadSize": 1,
-      "ResultSize": 1,
-      "BatchSize": 50,
-      "TaskRpcException": "",
-      "TaskError": "",
-      "Partition": "bench",
-      "ShowEvents": false,
-      "MaxRetries": 5,
-      "DegreeOfParallelism": 5,
-      "throughput": 442.3995752964077,
-      "nb_pods": 100
-    }
-  ]
-]
\ No newline at end of file
diff --git a/test/htcmock/100_pods/redis/test_scripts/results.json b/test/htcmock/100_pods/redis/test_scripts/results.json
deleted file mode 100644
index 2d43cd583..000000000
--- a/test/htcmock/100_pods/redis/test_scripts/results.json
+++ /dev/null
@@ -1,126 +0,0 @@
-[
-  {
-    "armonik_versions": {
-      "armonik": "2.13.2",
-      "infra": "0.0.2",
-      "core": "0.13.2",
-      "api": "3.6.0",
-      "gui": "0.9.0",
-      "extcsharp": "0.11.1",
-      "samples": "2.13.2"
-    },
-    "armonik_images": {
-      "armonik": [],
-      "infra": [
-        "https://github.com/aneoconsulting/ArmoniK.Infra.git"
-      ],
-      "core": [
-        "dockerhubaneo/armonik_pollingagent",
-        "dockerhubaneo/armonik_control_metrics",
-        "dockerhubaneo/armonik_control_partition_metrics",
-        "dockerhubaneo/armonik_control",
-        "dockerhubaneo/armonik_core_stream_test_worker",
-        "dockerhubaneo/armonik_core_stream_test_client",
-        "dockerhubaneo/armonik_core_htcmock_test_worker",
-        "dockerhubaneo/armonik_core_htcmock_test_client",
-        "dockerhubaneo/armonik_core_bench_test_worker",
-        "dockerhubaneo/armonik_core_bench_test_client"
-      ],
-      "api": [],
-      "gui": [
-        "dockerhubaneo/armonik_admin_app",
-        "dockerhubaneo/armonik_admin_api"
-      ],
-      "extcsharp": [
-        "dockerhubaneo/armonik_worker_dll"
-      ],
-      "samples": []
-    },
-    "image_tags": {
-      "registry.k8s.io/autoscaling/cluster-autoscaler": "v1.23.0",
-      "registry.k8s.io/metrics-server/metrics-server": "v0.6.2",
-      "ghcr.io/kedacore/keda": "2.9.3",
-      "ghcr.io/kedacore/keda-metrics-apiserver": "2.9.3",
-      "public.ecr.aws/aws-ec2/aws-node-termination-handler": "v1.19.0",
-      "amazon/aws-efs-csi-driver": "v1.5.1",
-      "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe": "v2.9.0-eks-1-22-19",
-      "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar": "v2.7.0-eks-1-22-19",
-      "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner": "v3.4.0-eks-1-22-19",
-      "symptoma/activemq": "5.17.0",
-      "mongo": "6.0.1",
-      "redis": "7.0.8",
-      "minio/minio": "RELEASE.2023-02-10T18-48-39Z",
-      "datalust/seq": "2023.1",
-      "grafana/grafana": "9.3.6",
-      "prom/node-exporter": "v1.5.0",
-      "prom/prometheus": "v2.42.0",
-      "fluent/fluent-bit": "2.0.9",
-      "rtsp/mongosh": "1.7.1",
-      "nginx": "1.23.3",
-      "nginxinc/nginx-unprivileged": "1.23.3",
-      "datalust/seqcli": "2023.1"
-    },
-    "helm_charts": {
-      "keda": {
-        "repository": "https://kedacore.github.io/charts",
-        "version": "2.9.4"
-      },
-      "metrics_server": {
-        "repository": "https://kubernetes-sigs.github.io/metrics-server/",
-        "version": "3.8.3"
-      },
-      "cluster_autoscaler": {
-        "repository": "https://kubernetes.github.io/autoscaler",
-        "version": "9.24.0"
-      },
-      "termination_handler": {
-        "repository": "https://aws.github.io/eks-charts",
-        "version": "0.21.0"
-      },
-      "efs_csi_driver": {
-        "repository": "https://kubernetes-sigs.github.io/aws-efs-csi-driver/",
-        "version": "2.3.0"
-      }
-    },
-    "test_environnement": {
-      "instance_type": "c24.xlarge",
-      "Processor": "Intel Xeon de 2e (Cascade Lake)",
-      "CPU_frequency": "3.6 GHz - 3.9 GHz",
-      "nb_cpus": "96",
-      "RAM": "192",
-      "Network_bandwidth": "25",
-      "EBS_bandwidth": "19000",
-      "Kubernetes": "AWS EKS 1.25",
-      "Object_object_type": "AWS S3",
-      "Storage_queue_storage": "Amazon MQ, broker : ActiveMQ 5.17.0",
-      "Storage_table_type": "MongoDB 6.0.1",
-      "OS": "Linux"
-    }
-  },
-  [
-    {
-      "Test": "htcmock",
-      "@t": "2023-07-03T14:06:40.8884583Z",
-      "@mt": "Client was executed in {time}s",
-      "@l": "Warning",
-      "time": 15.6904386,
-      "SourceContext": "Htc.Mock.Client",
-      "configuration": {
-        "@t": "2023-07-03T14:06:25.1939026Z",
-        "@mt": "Start new run with {configuration}",
-        "configuration": "{RunConfiguration: {TotalCalculationTime: 01:00:00,TotalNbSubTasks: 5000,Data: 1,Memory: 1,SubTasksLevels: 4,AvgDurationMs: 719.8560287942412,MinDurationMs: 239,MaxDurationMs: 21595}}",
-        "SourceContext": "Htc.Mock.Client"
-      },
-      "throughput": {
-        "@t": "2023-07-03T14:11:52.8259331Z",
-        "@mt": "Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})",
-        "session": "5439ba2a-5b22-4263-88f9-42001d481faa",
-        "throughput": 731.8840579710145,
-        "nTasks": 6868,
-        "timespan": "00:00:09.3840000",
-        "SourceContext": "ArmoniK.Samples.HtcMock.Client.GridClient"
-      },
-      "nb_pods": 100
-    }
-  ]
-]
\ No newline at end of file

From f840edf8ba9c8285043bc05a51fc67509ab8f1f6 Mon Sep 17 00:00:00 2001
From: YKharouni 
Date: Wed, 5 Jul 2023 14:12:04 +0200
Subject: [PATCH 14/38] format result json file

---
 test/bench/100_pods/redis/test_scripts/test.sh   | 3 +++
 test/htcmock/100_pods/redis/test_scripts/test.sh | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh
index ab64f113e..d63ce063c 100755
--- a/test/bench/100_pods/redis/test_scripts/test.sh
+++ b/test/bench/100_pods/redis/test_scripts/test.sh
@@ -11,6 +11,9 @@
 #merge json files
 ../python_scripts/merge_jsons.py
 
+# save a pretty json file
+jq . ../stats/results.json > ../stats/pretty_results.json
+
 #print the test stats and plot graphs
 #../python_scripts/wjson.py
 
diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh
index c296382c0..ba089f620 100755
--- a/test/htcmock/100_pods/redis/test_scripts/test.sh
+++ b/test/htcmock/100_pods/redis/test_scripts/test.sh
@@ -11,5 +11,8 @@
 #merge json files
 ../python_scripts/merge_jsons.py
 
+# save a pretty json file
+jq . ../stats/results.json > ../stats/pretty_results.json
+
 #print the test stats and plot graphs
 #../python_scripts/wjson.py

From c91878eab72053367eb479b04049ed4a744be538 Mon Sep 17 00:00:00 2001
From: YKharouni 
Date: Thu, 6 Jul 2023 10:39:09 +0200
Subject: [PATCH 15/38] add 10k and 100k tasks scripts

---
 test/README.md                                | 36 +++++----
 .../100_pods/redis/python_scripts/cleaner.py  |  4 +
 .../redis/python_scripts/merge_jsons.py       | 15 ++--
 .../100_pods/redis/python_scripts/wjson.py    |  4 +-
 .../100_pods/redis/test_scripts/bench_100k.sh | 17 ++++
 .../100_pods/redis/test_scripts/bench_10k.sh  | 17 ++++
 .../bench/100_pods/redis/test_scripts/test.sh |  2 +-
 .../redis/python_scripts/merge_jsons.py       |  9 +--
 .../100_pods/redis/python_scripts/wjson.py    | 81 -------------------
 9 files changed, 76 insertions(+), 109 deletions(-)
 create mode 100755 test/bench/100_pods/redis/test_scripts/bench_100k.sh
 create mode 100755 test/bench/100_pods/redis/test_scripts/bench_10k.sh
 delete mode 100755 test/htcmock/100_pods/redis/python_scripts/wjson.py

diff --git a/test/README.md b/test/README.md
index 84ec70a9f..ce0a33ca3 100644
--- a/test/README.md
+++ b/test/README.md
@@ -1,9 +1,10 @@
 # HOW TO USE IT
 
-This document describes how to use the benchmarking scripts. 
+This document describes how to use the benchmarking scripts.
 
 Those tests are an example of benchmarking tests using bench and htcmock to measure the performances of ArmoniK.  
-We have to deploy ArmoniK(aws-benchmark) on aws with two partitions (bench and htcmock) with 100 pods for each partition using redis as storage.   
+We have to deploy [ArmoniK(aws-benchmark)](https://github.com/aneoconsulting/ArmoniK/tree/yk/benchmarking_scripts/infrastructure/quick-deploy/aws-benchmark) on aws with two partitions (bench and htcmock) with 100 pods for each partition
+using redis as storage.
 
 
 .  
@@ -36,37 +37,42 @@ We have to deploy ArmoniK(aws-benchmark) on aws with two partitions (bench and h
 
 
- # Bench & Htcmock ### Run the tests * bench_1k.sh & bench_5k.sh : scripts for each test where we set the parameters of the test to run. -* test.sh : script to run all the tests cases and store the results in Json files. +* test.sh : script to run all the tests cases and store the results in Json files. ### Clean the output * cleaner.py : will clean the json output files. -Parameters : path to the json files we want to clean. - -* merge_jsons.py : merges the cleaned results files with the parameters json file of the tested version of ArmoniK and est_env.json file (third party components of ArmoniK). -* prerequisites: we have to install jsonmerge (pip install jsonmerge) +* merge_jsons.py : merges the cleaned results files with the parameters json file of the tested version of ArmoniK and + est_env.json file (third party components of ArmoniK). +* prerequisites: install jsonmerge +```console +user@user:~$ pip install jsonmerge +``` -### Analyse the results -wjson.py : will read the clean stats files so we can manipulate the data. +### Analyse the results -* Parameters : List of clean json files +* wjson.py : will read the clean stats files, so we can manipulate the data. ### How to run the tests : -#### Linux : -* Run the script test.sh in the directory /test/bench/100_pods/redis/test_scripts to run the tests of bench, store the outputs, clean them and merge them with the environment and infrastructure description files. -* Run the script test.sh in the directory /test/htcmock/100_pods/redis/test_scripts to run the tests of htcmock, store the outputs, clean them and merge them with the environment and infrastructure description files. +#### Linux : + +* Run the script test.sh in the directory /test/bench/100_pods/redis/test_scripts to run the tests of bench, store the + outputs, clean them and merge them with the environment and infrastructure description files. +* Run the script test.sh in the directory /test/htcmock/100_pods/redis/test_scripts to run the tests of htcmock, store + the outputs, clean them and merge them with the environment and infrastructure description files. ```console user@user:~$ ./test.sh ``` -# Stresstest : + +# Stresstest : + TODO: diff --git a/test/bench/100_pods/redis/python_scripts/cleaner.py b/test/bench/100_pods/redis/python_scripts/cleaner.py index d95e54880..550c151b4 100755 --- a/test/bench/100_pods/redis/python_scripts/cleaner.py +++ b/test/bench/100_pods/redis/python_scripts/cleaner.py @@ -36,3 +36,7 @@ def clean_file(file): clean_file(file) file = "../stats/5k.json" clean_file(file) +file = "../stats/10k.json" +clean_file(file) +file = "../stats/100k.json" +clean_file(file) \ No newline at end of file diff --git a/test/bench/100_pods/redis/python_scripts/merge_jsons.py b/test/bench/100_pods/redis/python_scripts/merge_jsons.py index f1b2c17ee..cafd2dfaa 100755 --- a/test/bench/100_pods/redis/python_scripts/merge_jsons.py +++ b/test/bench/100_pods/redis/python_scripts/merge_jsons.py @@ -4,16 +4,19 @@ import re from jsonmerge import merge -result = [] with open("../../../../../versions.tfvars.json", "r") as versions: - result.append(json.load(versions)) + infra = json.load(versions) with open("../stats/test_env.json", "r") as test_env: - result.append(json.load(test_env)) + env = (json.load(test_env)) with open("../stats/1k.json", "r") as stats: - result.append(json.load(stats)) + result_1k = json.load(stats) with open("../stats/5k.json", "r") as stats: - result2 = json.load(stats) + result_5k = json.load(stats) +with open("../stats/10k.json", "r") as stats: + result_10k = json.load(stats) +with open("../stats/100k.json", "r") as stats: + result_100k = json.load(stats) # print(merged) with open("../stats/results.json", "w") as r: - dict_json = [merge(result[0], result[1]), result[2], result2] + dict_json = [merge(infra, env), result_1k, result_5k, result_10k, result_100k] json.dump(dict_json, r) diff --git a/test/bench/100_pods/redis/python_scripts/wjson.py b/test/bench/100_pods/redis/python_scripts/wjson.py index 28db694f9..c5774fc4e 100755 --- a/test/bench/100_pods/redis/python_scripts/wjson.py +++ b/test/bench/100_pods/redis/python_scripts/wjson.py @@ -38,7 +38,7 @@ def __init__(self, file): if __name__ == "__main__": - files = ['../stats/1k.json', '../stats/5k.json'] + files = ['../stats/1k.json', '../stats/5k.json', '../stats/10k.json', '../stats/100k.json'] JsonFiles = [x for x in files if x.endswith(".json")] # dictionary to store the stats of each test case @@ -46,6 +46,8 @@ def __init__(self, file): } cases["1k"] = TestCase(JsonFiles[0]) cases["5k"] = TestCase(JsonFiles[1]) + cases["10k"] = TestCase(JsonFiles[2]) + cases["100k"] = TestCase(JsonFiles[3]) # Dictionary to store the mean of each test case mean = { diff --git a/test/bench/100_pods/redis/test_scripts/bench_100k.sh b/test/bench/100_pods/redis/test_scripts/bench_100k.sh new file mode 100755 index 000000000..5cda920dc --- /dev/null +++ b/test/bench/100_pods/redis/test_scripts/bench_100k.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + +#run 10000 tasks on 100 pods +docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e BenchOptions__nTasks=100000 \ + -e BenchOptions__TaskDurationMs=1 \ + -e BenchOptions__PayloadSize=1 \ + -e BenchOptions__ResultSize=1 \ + -e BenchOptions__Partition=bench \ + -e BenchOptions__ShowEvents=false \ + -e BenchOptions__BatchSize=50 \ + -e BenchOptions__MaxRetries=5 \ + -e BenchOptions__DegreeOfParallelism=5 \ + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/test/bench/100_pods/redis/test_scripts/bench_10k.sh b/test/bench/100_pods/redis/test_scripts/bench_10k.sh new file mode 100755 index 000000000..5e137bc7c --- /dev/null +++ b/test/bench/100_pods/redis/test_scripts/bench_10k.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + +#run 10000 tasks on 100 pods +docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e BenchOptions__nTasks=10000 \ + -e BenchOptions__TaskDurationMs=1 \ + -e BenchOptions__PayloadSize=1 \ + -e BenchOptions__ResultSize=1 \ + -e BenchOptions__Partition=bench \ + -e BenchOptions__ShowEvents=false \ + -e BenchOptions__BatchSize=50 \ + -e BenchOptions__MaxRetries=5 \ + -e BenchOptions__DegreeOfParallelism=5 \ + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh index d63ce063c..a3a336103 100755 --- a/test/bench/100_pods/redis/test_scripts/test.sh +++ b/test/bench/100_pods/redis/test_scripts/test.sh @@ -4,7 +4,7 @@ ./bench_1k.sh #clearmeasured runs -./bench_1k.sh >> ../stats/1k.json && ./bench_5k.sh >> ../stats/5k.json +./bench_1k.sh >> ../stats/1k.json && ./bench_5k.sh >> ../stats/5k.json && ./bench_10k.sh >> ../stats/10k.json && ./bench_100k.sh >> ../stats/100k.json #clean the output file ../python_scripts/cleaner.py diff --git a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py index 0092ce92d..6089868b7 100755 --- a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py +++ b/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py @@ -4,14 +4,13 @@ import re from jsonmerge import merge -result = [] with open("../../../../../versions.tfvars.json", "r") as versions: - result.append(json.load(versions)) + infra = json.load(versions) with open("../stats/test_env.json", "r") as test_env: - result.append(json.load(test_env)) + env = json.load(test_env) with open("../stats/5k.json", "r") as stats: - result.append(json.load(stats)) + result_5k = json.load(stats) with open("../stats/results.json", "w") as r: - dict_json = [merge(result[0], result[1]), result[2]] + dict_json = [merge(infra, env), result_5k] json.dump(dict_json, r) diff --git a/test/htcmock/100_pods/redis/python_scripts/wjson.py b/test/htcmock/100_pods/redis/python_scripts/wjson.py deleted file mode 100755 index 28db694f9..000000000 --- a/test/htcmock/100_pods/redis/python_scripts/wjson.py +++ /dev/null @@ -1,81 +0,0 @@ -#! /usr/bin/env python3 - -import json -from pytimeparse import parse -import matplotlib.pyplot as plt -import numpy as np - - -# Class test_case -# An object store a lists of the stats of all the runs of the test case -# So we could calculate the mean and the median of each stat -class TestCase: - - def __init__(self, file): - self.nbtasks = [] - self.time = [] - self.exec_time = [] - self.sub_time = [] - self.retrv_time = [] - self.throughput = [] - self.d_parallel = [] - self.file = file - with open(file) as my_bench_file: - data = my_bench_file.read() - # case = TestCase() - runs = json.loads(data) - - for run in runs: - if (run["nb_pods"] == 100): - self.nbtasks.append(run["TotalTasks"]) - self.time.append(float(parse(run["ElapsedTime"]))) - self.exec_time.append(float(parse(run["TasksExecutionTime"]))) - self.sub_time.append(float(parse(run["SubmissionTime"]))) - self.retrv_time.append(float(parse(run["ResultRetrievingTime"]))) - self.throughput.append(float(run["throughput"])) - self.d_parallel.append(run["DegreeOfParallelism"]) - - -if __name__ == "__main__": - - files = ['../stats/1k.json', '../stats/5k.json'] - JsonFiles = [x for x in files if x.endswith(".json")] - - # dictionary to store the stats of each test case - cases = { - } - cases["1k"] = TestCase(JsonFiles[0]) - cases["5k"] = TestCase(JsonFiles[1]) - - # Dictionary to store the mean of each test case - mean = { - "time": {}, - "exec_time": {}, - "sub_time": {}, - "retrv_time": {}, - "throughput": {} - } - - # calculte the mean of each test case - for file in files: - filename = file.split(".")[0] - mean["time"][filename] = np.mean(cases[filename].time) - mean["exec_time"][filename] = np.mean(cases[filename].exec_time) - mean["sub_time"][filename] = np.mean(cases[filename].sub_time) - mean["retrv_time"][filename] = np.mean(cases[filename].retrv_time) - mean["throughput"][filename] = np.mean(cases[filename].throughput) - - # print the stats - for file in files: - filename = file.split(".")[0] - print('Degree of parallelism of retrieving time is : ' + str(cases[filename].d_parallel[0])) - print('mean total time for treatement of ' + filename + ' tasks on 100 pods is : ' + str( - mean["time"][filename]) + ' s') - print('mean time of the execution of ' + filename + ' tasks on 100 pods is : ' + str( - mean["exec_time"][filename]) + ' s') - print('mean time of the submission of ' + filename + ' tasks on 100 pods is : ' + str( - mean["sub_time"][filename]) + ' s') - print('mean time of the retrieving of ' + filename + ' tasks on 100 pods is : ' + str( - mean["retrv_time"][filename]) + ' s') - print('mean throughput for ' + filename + ' tasks on 100 pods is : ' + str( - mean["throughput"][filename]) + " tasks/s \n") From dea61baca852dd6c6641ecaf42e18d1c6cdb3262 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Thu, 6 Jul 2023 10:50:36 +0200 Subject: [PATCH 16/38] update doc --- test/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/README.md b/test/README.md index ce0a33ca3..8086e9c15 100644 --- a/test/README.md +++ b/test/README.md @@ -26,8 +26,8 @@ using redis as storage. | └── redis | ├── python_scripts | | ├── cleaner.py -| | ├── merge_jsons.py -| | └── wjson.py +| | └── merge_jsons.py +| | | ├── stats | | └── test_env.json | └── test_scripts @@ -58,7 +58,7 @@ user@user:~$ pip install jsonmerge ### Analyse the results -* wjson.py : will read the clean stats files, so we can manipulate the data. +* wjson.py : will read the clean stats files, so we can manipulate the data of bench tests. ### How to run the tests : From beca946fe5fc21acf9bf632187504d1088cfafae Mon Sep 17 00:00:00 2001 From: YKharouni Date: Thu, 6 Jul 2023 15:53:51 +0200 Subject: [PATCH 17/38] add print benchmarking output --- test/bench/100_pods/redis/test_scripts/test.sh | 3 ++- test/htcmock/100_pods/redis/test_scripts/test.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/100_pods/redis/test_scripts/test.sh index a3a336103..23bc4cd7d 100755 --- a/test/bench/100_pods/redis/test_scripts/test.sh +++ b/test/bench/100_pods/redis/test_scripts/test.sh @@ -11,8 +11,9 @@ #merge json files ../python_scripts/merge_jsons.py -# save a pretty json file +# save and print pretty json file jq . ../stats/results.json > ../stats/pretty_results.json +jq . ../stats/pretty_results.json #print the test stats and plot graphs #../python_scripts/wjson.py diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/100_pods/redis/test_scripts/test.sh index ba089f620..6a76cbcd7 100755 --- a/test/htcmock/100_pods/redis/test_scripts/test.sh +++ b/test/htcmock/100_pods/redis/test_scripts/test.sh @@ -11,8 +11,9 @@ #merge json files ../python_scripts/merge_jsons.py -# save a pretty json file +# save and print pretty json file jq . ../stats/results.json > ../stats/pretty_results.json +jq . ../stats/pretty_results.json #print the test stats and plot graphs #../python_scripts/wjson.py From 2b246ffd72d05af3823cb0c9bca2ca1c78ac5b34 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Thu, 6 Jul 2023 16:29:07 +0200 Subject: [PATCH 18/38] update ArmoniK versions --- .../aws-benchmark/armonik/parameters.tfvars | 22 +++++++++---------- .../aws-benchmark/ecr/parameters.tfvars | 16 +++++++------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars index 4db83836c..8b50fd467 100644 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars +++ b/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars @@ -33,7 +33,7 @@ control_plane = { service_type = "ClusterIP" replicas = 1 image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-control-plane" - tag = "0.13.2" + tag = "0.14.3" image_pull_policy = "IfNotPresent" port = 5001 limits = { @@ -80,7 +80,7 @@ control_plane = { admin_gui = { name = "admin-app" image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-admin-app" - tag = "0.9.0" + tag = "0.9.1" port = 1080 limits = { cpu = "1000m" @@ -146,7 +146,7 @@ compute_plane = { # ArmoniK polling agent polling_agent = { image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" - tag = "0.13.2" + tag = "0.14.3" image_pull_policy = "IfNotPresent" limits = { cpu = "2000m" @@ -162,7 +162,7 @@ compute_plane = { { name = "worker" image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-worker" - tag = "0.11.1" + tag = "0.12.1" image_pull_policy = "IfNotPresent" limits = { cpu = "1000m" @@ -195,7 +195,6 @@ compute_plane = { ] } }, - #bench partition bench = { # number of replicas for each deployment of compute plane replicas = 100 @@ -206,7 +205,7 @@ compute_plane = { # ArmoniK polling agent polling_agent = { image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" - tag = "0.13.2" + tag = "0.14.3" image_pull_policy = "IfNotPresent" limits = { cpu = "2000m" @@ -220,9 +219,9 @@ compute_plane = { # ArmoniK workers worker = [ { - name = "worker" + name = "bench" image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-bench" - tag = "0.13.2" + tag = "0.14.3" image_pull_policy = "IfNotPresent" limits = { cpu = "1000m" @@ -255,7 +254,6 @@ compute_plane = { ] } }, - #htcmock partition htcmock = { # number of replicas for each deployment of compute plane replicas = 100 @@ -266,7 +264,7 @@ compute_plane = { # ArmoniK polling agent polling_agent = { image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" - tag = "0.13.2" + tag = "0.14.3" image_pull_policy = "IfNotPresent" limits = { cpu = "2000m" @@ -280,9 +278,9 @@ compute_plane = { # ArmoniK workers worker = [ { - name = "worker" + name = "htcmock" image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-htcmock" - tag = "0.13.2" + tag = "0.14.3" image_pull_policy = "IfNotPresent" limits = { cpu = "1000m" diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars index 18ec009d0..521db8a7b 100644 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars +++ b/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars @@ -48,42 +48,42 @@ ecr = { { name = "armonik-control-plane" image = "dockerhubaneo/armonik_control" - tag = "0.13.2" + tag = "0.14.3" }, { name = "armonik-polling-agent" image = "dockerhubaneo/armonik_pollingagent" - tag = "0.13.2" + tag = "0.14.3" }, { name = "armonik-worker" image = "dockerhubaneo/armonik_worker_dll" - tag = "0.11.1" + tag = "0.12.1" }, { name = "armonik-bench" image = "dockerhubaneo/armonik_core_bench_test_worker" - tag = "0.13.2" + tag = "0.14.3" }, { name = "armonik-htcmock" image = "dockerhubaneo/armonik_core_htcmock_test_worker" - tag = "0.13.2" + tag = "0.14.3" }, { name = "metrics-exporter" image = "dockerhubaneo/armonik_control_metrics" - tag = "0.13.2" + tag = "0.14.3" }, { name = "partition-metrics-exporter" image = "dockerhubaneo/armonik_control_partition_metrics" - tag = "0.13.2" + tag = "0.14.3" }, { name = "armonik-admin-app" image = "dockerhubaneo/armonik_admin_app" - tag = "0.9.0" + tag = "0.9.1" }, { name = "armonik-admin-app-old" From 30cc7ac08884df86059f9f99bc93b82bc93b2982 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Fri, 7 Jul 2023 15:59:39 +0200 Subject: [PATCH 19/38] update monitoring --- .../quick-deploy/aws-benchmark/monitoring/parameters.tfvars | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars index d9df15657..c6be76bfc 100644 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars +++ b/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars @@ -85,7 +85,7 @@ monitoring = { } metrics_exporter = { image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/metrics-exporter" - tag = "0.13.2" + tag = "0.14.3" image_pull_secrets = "" service_type = "ClusterIP" node_selector = { service = "metrics" } @@ -98,7 +98,7 @@ monitoring = { } partition_metrics_exporter = { image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/partition-metrics-exporter" - tag = "0.13.2" + tag = "0.14.3" image_pull_secrets = "" service_type = "ClusterIP" node_selector = { service = "metrics" } From 97b95bcd84514874f3f88c421b9c8ea92dd70679 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 10:37:39 +0200 Subject: [PATCH 20/38] update test scripts --- test/bench/100_pods/redis/test_scripts/bench_100k.sh | 2 +- test/bench/100_pods/redis/test_scripts/bench_10k.sh | 2 +- test/bench/100_pods/redis/test_scripts/bench_1k.sh | 2 +- test/bench/100_pods/redis/test_scripts/bench_5k.sh | 2 +- test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/bench/100_pods/redis/test_scripts/bench_100k.sh b/test/bench/100_pods/redis/test_scripts/bench_100k.sh index 5cda920dc..d9a0a8499 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_100k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_100k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 10000 tasks on 100 pods docker run --rm \ diff --git a/test/bench/100_pods/redis/test_scripts/bench_10k.sh b/test/bench/100_pods/redis/test_scripts/bench_10k.sh index 5e137bc7c..4c4ff7f19 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_10k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_10k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 10000 tasks on 100 pods docker run --rm \ diff --git a/test/bench/100_pods/redis/test_scripts/bench_1k.sh b/test/bench/100_pods/redis/test_scripts/bench_1k.sh index c49cc6218..e736e2361 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_1k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_1k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 1000 tasks on 100 pods docker run --rm \ diff --git a/test/bench/100_pods/redis/test_scripts/bench_5k.sh b/test/bench/100_pods/redis/test_scripts/bench_5k.sh index 8ca3fc7b3..a704d4b6c 100755 --- a/test/bench/100_pods/redis/test_scripts/bench_5k.sh +++ b/test/bench/100_pods/redis/test_scripts/bench_5k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 5000 tasks on 100 pods docker run --rm \ diff --git a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh index 4aac6b16c..4f9cb02f5 100755 --- a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh +++ b/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws-benchmark/armonik/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ From c5d7973a03b03bf6059e382dec8548e5c75a48ad Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 10:41:42 +0200 Subject: [PATCH 21/38] replace benchmarking deployment with a parameters file --- .../quick-deploy/aws-benchmark/Makefile | 320 --------- .../quick-deploy/aws-benchmark/README.md | 420 ------------ .../aws-benchmark/armonik/Makefile | 73 -- .../aws-benchmark/armonik/backend.tf | 10 - .../aws-benchmark/armonik/locals.tf | 0 .../aws-benchmark/armonik/main.tf | 32 - .../aws-benchmark/armonik/outputs.tf | 12 - .../aws-benchmark/armonik/parameters.tfvars | 372 ---------- .../aws-benchmark/armonik/providers.tf | 24 - .../aws-benchmark/armonik/variables.tf | 264 -------- .../aws-benchmark/armonik/versions.tf | 12 - .../aws-benchmark/backend/Makefile | 27 - .../backend/backend-resources.yaml | 127 ---- .../quick-deploy/aws-benchmark/ecr/Makefile | 68 -- .../quick-deploy/aws-benchmark/ecr/backend.tf | 10 - .../quick-deploy/aws-benchmark/ecr/locals.tf | 24 - .../quick-deploy/aws-benchmark/ecr/main.tf | 16 - .../quick-deploy/aws-benchmark/ecr/outputs.tf | 4 - .../aws-benchmark/ecr/parameters.tfvars | 184 ----- .../aws-benchmark/ecr/providers.tf | 4 - .../aws-benchmark/ecr/variables.tf | 36 - .../aws-benchmark/ecr/versions.tf | 16 - .../quick-deploy/aws-benchmark/eks/Makefile | 76 --- .../quick-deploy/aws-benchmark/eks/backend.tf | 10 - .../quick-deploy/aws-benchmark/eks/locals.tf | 43 -- .../quick-deploy/aws-benchmark/eks/main.tf | 54 -- .../quick-deploy/aws-benchmark/eks/outputs.tf | 19 - .../aws-benchmark/eks/parameters.tfvars | 296 -------- .../aws-benchmark/eks/providers.tf | 33 - .../aws-benchmark/eks/variables.tf | 138 ---- .../aws-benchmark/eks/versions.tf | 28 - .../quick-deploy/aws-benchmark/envvars.sh | 9 - .../quick-deploy/aws-benchmark/keda/Makefile | 71 -- .../aws-benchmark/keda/backend.tf | 10 - .../quick-deploy/aws-benchmark/keda/locals.tf | 14 - .../quick-deploy/aws-benchmark/keda/main.tf | 21 - .../aws-benchmark/keda/outputs.tf | 4 - .../aws-benchmark/keda/parameters.tfvars | 28 - .../aws-benchmark/keda/providers.tf | 19 - .../aws-benchmark/keda/variables.tf | 56 -- .../aws-benchmark/keda/versions.tf | 0 .../aws-benchmark/metrics-server/Makefile | 71 -- .../aws-benchmark/metrics-server/backend.tf | 10 - .../aws-benchmark/metrics-server/locals.tf | 17 - .../aws-benchmark/metrics-server/main.tf | 15 - .../aws-benchmark/metrics-server/outputs.tf | 4 - .../metrics-server/parameters.tfvars | 37 - .../aws-benchmark/metrics-server/providers.tf | 19 - .../aws-benchmark/metrics-server/variables.tf | 78 --- .../aws-benchmark/metrics-server/versions.tf | 0 .../aws-benchmark/monitoring/Makefile | 76 --- .../aws-benchmark/monitoring/backend.tf | 10 - .../aws-benchmark/monitoring/iam.tf | 61 -- .../aws-benchmark/monitoring/locals.tf | 99 --- .../aws-benchmark/monitoring/main.tf | 164 ----- .../aws-benchmark/monitoring/outputs.tf | 52 -- .../monitoring/parameters.tfvars | 136 ---- .../aws-benchmark/monitoring/providers.tf | 24 - .../aws-benchmark/monitoring/secrets.tf | 92 --- .../aws-benchmark/monitoring/variables.tf | 151 ----- .../aws-benchmark/monitoring/versions.tf | 16 - .../aws-benchmark/parameters.tfvars | 641 ++++++++++++++++++ .../aws-benchmark/storage/Makefile | 79 --- .../aws-benchmark/storage/backend.tf | 10 - .../aws-benchmark/storage/locals.tf | 72 -- .../aws-benchmark/storage/main.tf | 162 ----- .../aws-benchmark/storage/outputs.tf | 35 - .../aws-benchmark/storage/parameters.tfvars | 176 ----- .../aws-benchmark/storage/providers.tf | 24 - .../storage/s3-iam-object-storage.tf | 68 -- .../aws-benchmark/storage/s3-iam.tf | 57 -- .../aws-benchmark/storage/secrets.tf | 99 --- .../aws-benchmark/storage/variables.tf | 230 ------- .../aws-benchmark/storage/versions.tf | 32 - .../quick-deploy/aws-benchmark/vpc/Makefile | 70 -- .../quick-deploy/aws-benchmark/vpc/backend.tf | 10 - .../quick-deploy/aws-benchmark/vpc/locals.tf | 26 - .../quick-deploy/aws-benchmark/vpc/main.tf | 27 - .../quick-deploy/aws-benchmark/vpc/outputs.tf | 14 - .../aws-benchmark/vpc/parameters.tfvars | 60 -- .../aws-benchmark/vpc/providers.tf | 4 - .../aws-benchmark/vpc/variables.tf | 64 -- .../aws-benchmark/vpc/versions.tf | 16 - 83 files changed, 641 insertions(+), 5451 deletions(-) delete mode 100644 infrastructure/quick-deploy/aws-benchmark/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/README.md delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/backend/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/eks/versions.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/envvars.sh delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/keda/versions.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/metrics-server/versions.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/secrets.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf create mode 100644 infrastructure/quick-deploy/aws-benchmark/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/s3-iam-object-storage.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/storage/versions.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/Makefile delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/main.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf delete mode 100644 infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf diff --git a/infrastructure/quick-deploy/aws-benchmark/Makefile b/infrastructure/quick-deploy/aws-benchmark/Makefile deleted file mode 100644 index 7b5245f8e..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/Makefile +++ /dev/null @@ -1,320 +0,0 @@ -export ARMONIK_SUFFIX?=main -export ARMONIK_REGION?=eu-west-3 -export ARMONIK_PROFILE?=default -export ARMONIK_BUCKET_NAME?=armonik-tfstate -export ARMONIK_KUBERNETES_NAMESPACE?=armonik -export KEDA_KUBERNETES_NAMESPACE?=default -export METRICS_SERVER_KUBERNETES_NAMESPACE?=kube-system -export TFSTATE_BUCKET_NAME=$(ARMONIK_BUCKET_NAME)-$(ARMONIK_SUFFIX) -export PUBLIC_VPC?=true -export PUBLIC_ACCESS_EKS?=true - -CURRENT_DIR=$(shell pwd) -VPC_PARAMETERS_FILE?=$(CURRENT_DIR)/vpc/generated/vpc-output.json -STORAGE_PARAMETERS_FILE?=$(CURRENT_DIR)/storage/generated/storage-output.json -MONITORING_PARAMETERS_FILE?=$(CURRENT_DIR)/monitoring/generated/monitoring-output.json -EKS_PARAMETERS_FILE?=$(CURRENT_DIR)/eks/generated/eks-output.json -KUBECONFIG?=$(CURRENT_DIR)/eks/generated/kubeconfig -GENERATED_DIR=$(CURRENT_DIR)/generated -MODULES_DIR=$(GENERATED_DIR)/infra-modules -VERSIONS_FILE?=$(shell realpath ../../../versions.tfvars.json) - -#################################### -# KSM and S3 buckets for TF states # -#################################### - -deploy-s3-of-backend: - $(MAKE) -C $(CURRENT_DIR)/backend deploy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - BUCKET_NAME=$(ARMONIK_BUCKET_NAME) \ - PROFILE=$(ARMONIK_PROFILE) - -destroy-s3-of-backend: - $(MAKE) -C $(CURRENT_DIR)/backend destroy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - BUCKET_NAME=$(ARMONIK_BUCKET_NAME) \ - PROFILE=$(ARMONIK_PROFILE) - -#################################### -# AWS VPC # -#################################### - -deploy-vpc: - $(MAKE) -C $(CURRENT_DIR)/vpc deploy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - PUBLIC_VPC=$(PUBLIC_VPC) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -destroy-vpc: - $(MAKE) -C $(CURRENT_DIR)/vpc destroy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - PUBLIC_VPC=$(PUBLIC_VPC) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-vpc: - $(MAKE) -C $(CURRENT_DIR)/vpc clean - -#################################### -# AWS ECR # -#################################### - -deploy-ecr: - $(MAKE) -C $(CURRENT_DIR)/ecr deploy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -destroy-ecr: - $(MAKE) -C $(CURRENT_DIR)/ecr destroy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-ecr: - $(MAKE) -C $(CURRENT_DIR)/ecr clean - -#################################### -# AWS EKS # -#################################### - -deploy-eks: - $(MAKE) -C $(CURRENT_DIR)/eks deploy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - PUBLIC_ACCESS_EKS=$(PUBLIC_ACCESS_EKS) \ - KUBECONFIG=$(KUBECONFIG) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -destroy-eks: - $(MAKE) -C $(CURRENT_DIR)/eks destroy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - PUBLIC_ACCESS_EKS=$(PUBLIC_ACCESS_EKS) \ - KUBECONFIG=$(KUBECONFIG) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-eks: - $(MAKE) -C $(CURRENT_DIR)/eks clean - -#################################### -# Kubernetes namespace # -#################################### - -create-namespace: - @KEDA=$(shell kubectl --kubeconfig $(KUBECONFIG) get deploy -A -l app=keda-operator --no-headers=true -o name) - @METRICS_SERVER=$(shell kubectl --kubeconfig $(KUBECONFIG) get deploy -A -l k8s-app=metrics-server --no-headers=true -o name) - @kubectl --kubeconfig $(KUBECONFIG) get namespace $(ARMONIK_KUBERNETES_NAMESPACE) > /dev/null 2>&1 && echo "namespace : '$(ARMONIK_KUBERNETES_NAMESPACE)' is already created." || kubectl --kubeconfig $(KUBECONFIG) create namespace $(ARMONIK_KUBERNETES_NAMESPACE) - @kubectl --kubeconfig $(KUBECONFIG) get namespace $(KEDA_KUBERNETES_NAMESPACE) > /dev/null 2>&1 && echo "namespace : '$(KEDA_KUBERNETES_NAMESPACE)' is already created." || kubectl --kubeconfig $(KUBECONFIG) create namespace $(KEDA_KUBERNETES_NAMESPACE) - @kubectl --kubeconfig $(KUBECONFIG) get namespace $(METRICS_SERVER_KUBERNETES_NAMESPACE) > /dev/null 2>&1 && echo "namespace : '$(METRICS_SERVER_KUBERNETES_NAMESPACE)' is already created." || kubectl --kubeconfig $(KUBECONFIG) create namespace $(METRICS_SERVER_KUBERNETES_NAMESPACE) - -delete-namespace: - kubectl --kubeconfig $(KUBECONFIG) delete namespace $(ARMONIK_KUBERNETES_NAMESPACE) || true - kubectl --kubeconfig $(KUBECONFIG) delete namespace $(KEDA_KUBERNETES_NAMESPACE) || true - kubectl --kubeconfig $(KUBECONFIG) delete namespace $(METRICS_SERVER_KUBERNETES_NAMESPACE) || true - -#################################### -# KEDA # -#################################### - -deploy-keda: - @if [ "${KEDA}" = "" ]; then\ - $(MAKE) -C $(CURRENT_DIR)/keda deploy \ - NAMESPACE=$(KEDA_KUBERNETES_NAMESPACE) \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE);\ - fi - -destroy-keda: - $(MAKE) -C $(CURRENT_DIR)/keda destroy \ - NAMESPACE=$(KEDA_KUBERNETES_NAMESPACE) \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-keda: - $(MAKE) -C $(CURRENT_DIR)/keda clean - -#################################### -# Metrics server # -#################################### - -deploy-metrics-server: - $(MAKE) -C $(CURRENT_DIR)/metrics-server deploy \ - NAMESPACE=$(METRICS_SERVER_KUBERNETES_NAMESPACE) \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -destroy-metrics-server: - $(MAKE) -C $(CURRENT_DIR)/metrics-server destroy \ - NAMESPACE=$(METRICS_SERVER_KUBERNETES_NAMESPACE) \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-metrics-server: - $(MAKE) -C $(CURRENT_DIR)/metrics-server clean - -#################################### -# AWS Storage # -#################################### - -deploy-storage: - $(MAKE) -C $(CURRENT_DIR)/storage deploy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ - VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ - EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -destroy-storage: - $(MAKE) -C $(CURRENT_DIR)/storage destroy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ - VPC_PARAMETERS_FILE=$(VPC_PARAMETERS_FILE) \ - EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-storage: - $(MAKE) -C $(CURRENT_DIR)/storage clean - -#################################### -# Monitoring # -#################################### - -deploy-monitoring: - $(MAKE) -C $(CURRENT_DIR)/monitoring deploy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ - STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ - EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -destroy-monitoring: - $(MAKE) -C $(CURRENT_DIR)/monitoring destroy \ - SUFFIX=$(ARMONIK_SUFFIX) \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ - STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ - EKS_PARAMETERS_FILE=$(EKS_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-monitoring: - $(MAKE) -C $(CURRENT_DIR)/monitoring clean - -#################################### -# ArmoniK # -#################################### - -deploy-armonik: - $(MAKE) -C $(CURRENT_DIR)/armonik deploy \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ - STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ - MONITORING_PARAMETERS_FILE=$(MONITORING_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -destroy-armonik: - $(MAKE) -C $(CURRENT_DIR)/armonik destroy \ - REGION=$(ARMONIK_REGION) \ - PROFILE=$(ARMONIK_PROFILE) \ - KUBECONFIG=$(KUBECONFIG) \ - NAMESPACE=$(ARMONIK_KUBERNETES_NAMESPACE) \ - STORAGE_PARAMETERS_FILE=$(STORAGE_PARAMETERS_FILE) \ - MONITORING_PARAMETERS_FILE=$(MONITORING_PARAMETERS_FILE) \ - TFSTATE_BUCKET_NAME=$(TFSTATE_BUCKET_NAME) \ - MODULES_DIR=$(MODULES_DIR) \ - VERSIONS_FILE=$(VERSIONS_FILE) - -clean-armonik: - $(MAKE) -C $(CURRENT_DIR)/armonik clean - -#################################### -# KUBECONFIG # -#################################### - -kubeconfig: - @echo "Execute the following commands:" - @echo "------------------------------" - @echo "export KUBECONFIG=$(shell cat $(EKS_PARAMETERS_FILE) | jq -r '.eks.kubeconfig_file')" - -#################################### -# Modules # -#################################### - -clean-modules: - @rm -rf $(GENERATED_DIR) - -#################################### -# All # -#################################### - -deploy-all: deploy-vpc deploy-ecr deploy-eks create-namespace deploy-keda deploy-metrics-server deploy-storage deploy-monitoring deploy-armonik kubeconfig - -destroy-all: destroy-armonik destroy-monitoring destroy-storage destroy-metrics-server destroy-keda delete-namespace destroy-eks destroy-ecr destroy-vpc - -clean-all: clean-armonik clean-monitoring clean-storage clean-metrics-server clean-keda clean-eks clean-ecr clean-vpc clean-modules diff --git a/infrastructure/quick-deploy/aws-benchmark/README.md b/infrastructure/quick-deploy/aws-benchmark/README.md deleted file mode 100644 index e9e9d780d..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/README.md +++ /dev/null @@ -1,420 +0,0 @@ -# Table of contents - -- [Table of contents](#table-of-contents) -- [Introduction](#introduction) -- [Prerequisites](#prerequisites) - - [Software](#software) - - [AWS credentials](#aws-credentials) -- [Set environment variables](#set-environment-variables) -- [Prepare backend for Terraform](#preapre-backend-for-terraform) -- [Deploy infrastructure](#deploy-infrastructure) - - [AWS VPC](#aws-vpc) - - [AWS ECR](#aws-ecr) - - [AWS EKS](#aws-eks) - - [KEDA](#keda) - - [Metrics server](#metrics-server) - - [Storage](#storage) - - [Monitoring](#monitoring) -- [Deploy ArmoniK](#deploy-armonik) -- [Merge multiple kubeconfig](#merge-multiple-kubeconfig) -- [Clean-up](#clean-up) - -# Introduction - -Hereafter, You have instructions to deploy infrastructure for ArmoniK on AWS cloud. - -The infrastructure is composed of: - -* AWS VPC -* AWS ECR for docker images -* AWS EKS -* [KEDA](https://keda.sh/) -* Storage: - * AWS S3 buckets: - * to save safely `.tfsate` - * to upload `.dll` for worker pods - * AWS Elasticache (Redis engine) - * Amazon MQ (ActiveMQ broker engine) - * Onpremise MongoDB -* Monitoring: - * AWS CloudWatch - * Fluent-bit - * Grafana - * Keda - * Metrics exporter - * Metrics server - * Node exporter - * Partition metrics exporter - * Prometheus - * Seq server for structured log data of ArmoniK -* ArmoniK: - * Control plane - * Compute plane: - * polling agent - * workers - * Ingress - * Admin GUI - -# Prerequisites - -## Software - -The following software or tool should be installed upon your local Linux machine or VM from which you deploy the -infrastructure: - -* If You have Windows machine, You can install [WSL 2](../../docs/kubernetes/localhost/wsl2.md) -* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) version 2 -* [Docker](https://docs.docker.com/engine/install/) -* [GNU make](https://www.gnu.org/software/make/) -* [JQ](https://stedolan.github.io/jq/download/) -* [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) v1.23.6 -* [Helm](https://helm.sh/docs/intro/install/) -* [Openssl](https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/) -* [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) version 1.0.9 and later - -## AWS credentials - -You must have credentials to be able to create AWS resources. You must create and provide -your [AWS programmatic access keys](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys) -in your environment as follows: - -```bash -mkdir -p ~/.aws -cat < -aws_secret_access_key = -EOF -``` - -You can check connectivity to AWS using the following command: - -```bash -aws sts get-caller-identity -``` - -the output of this command should be as follows: - -```bash -{ - "UserId": "", - "Account": "", - "Arn": "arn:aws:iam:::user/" -} -``` - -# Set environment variables - -From the **root** of the repository, position yourself in directory `infrastructure/quick-deploy/aws`. - -```bash -cd infrastructure/quick-deploy/aws -``` - -You need to set a list of environment variables [envvars.sh](envvars.sh) : - -```bash -source envvars.sh -``` - -**or:** - -```bash -export ARMONIK_PROFILE=default -export ARMONIK_REGION=eu-west-3 -export ARMONIK_SUFFIX=main -export ARMONIK_BUCKET_NAME=armonik-tfstate -export ARMONIK_KUBERNETES_NAMESPACE=armonik -export KEDA_KUBERNETES_NAMESPACE=default -export METRICS_SERVER_KUBERNETES_NAMESPACE=kube-system -export PUBLIC_VPC=true -export PUBLIC_ACCESS_EKS=true -``` - -where: - -- `ARMONIK_PROFILE`: defines your AWS profile which has credentials to deploy in AWS Cloud -- `ARMONIK_REGION`: presents the region where all resources will be created -- `ARMONIK_SUFFIX`: will be used as suffix to the name of all resources -- `ARMONIK_BUCKET_NAME`: is the name of S3 bucket in which `.tfsate` will be safely stored -- `ARMONIK_KUBERNETES_NAMESPACE`: is the namespace in Kubernetes for ArmoniK -- `KEDA_KUBERNETES_NAMESPACE`: is the namespace in Kubernetes for [KEDA](https://keda.sh/) -- `METRICS_SERVER_KUBERNETES_NAMESPACE`: is the namespace in Kubernetes for metrics server -- `PUBLIC_VPC`: is boolean defining whether the AWS VPC to be deployed should be public -- `PUBLIC_ACCESS_EKS`: is boolean defining whether the AWS EKS to be deployed should have a public access - -**Warning:** `ARMONIK_SUFFIX` must be *UNIQUE* to allow resources to have unique name in AWS - -# Prepare backend for Terraform - -You need to create a S3 bucket to save safely `.tfstate` files of Terraform. This bucket will be encrypted with an AWS -KMS key. - -Execute the following command to create the S3 bucket: - -```bash -make deploy-s3-of-backend -``` - -# Deploy infrastructure - -## AWS VPC - -You need to create an AWS Virtual Private Cloud (VPC) that provides an isolated virtual network environment. The -parameters of this VPC are in [vpc/parameters.tfvars](vpc/parameters.tfvars). - -Execute the following command to create the VPC: - -```bash -make deploy-vpc -``` - -The VPC deployment generates an output file `vpc/generated/vpc-output.json` which contains information needed for the -deployments of storage and Kubernetes. - -## AWS ECR - -You need to create an AWS Elastic Container Registry (ECR) and push the container images needed for Kubernetes and -ArmoniK [ecr/parameters.tfvars](ecr/parameters.tfvars). - -Execute the following command to create the ECR and push the list of container images: - -```bash -make deploy-ecr -``` - -The list of created ECR repositories are in `ecr/generated/ecr-output.json`. - -## AWS EKS - -You need to create an AWS Elastic Kubernetes Service (EKS). The parameters of EKS to be created are defined -in [eks/parameters.tfvars](eks/parameters.tfvars). - -Execute the following command to create the EKS: - -```bash -make deploy-eks -``` - -**or:** - -```bash -make deploy-eks VPC_PARAMETERS_FILE= -``` - -where: - -- `` is the **absolute** path to file `vpc/generated/vpc-output.json` containing the information - about the VPC previously created. - -The EKS deployment generates an output file `eks/generated/eks-output.json`. - -### Create Kubernetes namespace - -After the EKS deployment, You create a Kubernetes namespaces for ArmoniK with the name set in the environment -variable`ARMONIK_KUBERNETES_NAMESPACE`, for KEDA with the name set in the environment -variable`KEDA_KUBERNETES_NAMESPACE` and for Metrics server with the name set in the environment -variable`METRICS_SERVER_KUBERNETES_NAMESPACE`: - -```bash -make create-namespace -``` - -## KEDA - -The parameters of KEDA are defined in [keda/parameters.tfvars](keda/parameters.tfvars). - -Execute the following command to install KEDA: - -```bash -make deploy-keda -``` - -The Keda deployment generates an output file `keda/generated/keda-output.json`. - -**NOTE:** Please note that KEDA must be deployed only ONCE on the same Kubernetes cluster. - -## Metrics server - -The parameters of Metrics server are defined in [metrics-server/parameters.tfvars](metrics-server/parameters.tfvars). - -Execute the following command to install metrics server: - -```bash -make deploy-metrics-server -``` - -The metrics server deployment generates an output file `metrics-server/generated/metrics-server-output.json`. - -**NOTE:** Please note that metrics server must be deployed only ONCE on the same Kubernetes cluster. - -## Storage - -You need to create AWS storage for ArmoniK which are: - -* AWS Elasticache with Redis engine -* Amazon MQ with ActiveMQ broker engine -* Amazon S3 bucket to upload `.dll` for ArmoniK workers -* MongoDB as a Kubernetes service - -The parameters of each storage are defined in [storage/parameters.tfvars](storage/parameters.tfvars). - -Execute the following command to create the storage: - -```bash -make deploy-storage -``` - -**or:** - -```bash -make deploy-storage \ - VPC_PARAMETERS_FILE= \ - EKS_PARAMETERS_FILE= -``` - -where: - -- `` is the **absolute** path to file `vpc/generated/vpc-output.json` -- `` is the **absolute** path to file `eks/generated/eks-output.json` - -These files are input information for storage deployment containing the information about the VPC and EKS previously -created. - -The storage deployment generates an output file `storage/generated/storage-output.json` which contains information -needed for ArmoniK. - -## Monitoring - -You deploy the following resources for monitoring ArmoniK : - -* Seq to collect the ArmoniK application logs -* Grafana -* Prometheus - -The parameters of each monitoring resources are defined in [monitoring/parameters.tfvars](monitoring/parameters.tfvars). - -Execute the following command to create the monitoring tools: - -```bash -make deploy-monitoring -``` - -**or:** - -```bash -make deploy-monitoring \ - EKS_PARAMETERS_FILE= \ - STORAGE_PARAMETERS_FILE= -``` - -where: - -- `` is the **absolute** path to file `eks/generated/eks-output.json` containing the information - about the VPC previously created. -- `` is the **absolute** path to file `storage/generated/storage-output.json` containing the - information about the storage previously created. - -The monitoring deployment generates an output file `monitoring/generated/monitoring-output.json` that contains -information needed for ArmoniK. - -# Deploy ArmoniK - -After deploying the infrastructure, You can install ArmoniK in AWS EKS. The installation deploys: - -* ArmoniK control plane -* ArmoniK compute plane - -Execute the following command to deploy ArmoniK: - -```bash -make deploy-armonik -``` - -**or:** - -```bash -make deploy-armonik \ - STORAGE_PARAMETERS_FILE= \ - MONITORING_PARAMETERS_FILE= -``` - -where: - -- `` is the **absolute** path to file `storage/generated/storage-output.json` -- `` is the **absolute** path to file `monitoring/generated/monitoring-output.json` - -These files are input information for ArmoniK containing the information about storage and monitoring tools previously -created. - -The ArmoniK deployment generates an output file `armonik/generated/armonik-output.json` that contains the endpoint URL -of ArmoniK control plane. - -### All-in-one deploy - -All commands described above can be executed with one command. To deploy infrastructure and ArmoniK in all-in-one -command, You execute: - -```bash -make deploy-all -``` - -# Merge multiple kubeconfig - -When accessing multiple Kubernetes clusters, you will have many kubeconfig files. By default, kubectl only looks for a -file named config in the `$HOME/.kube` directory. - -So, to manage multiple Kubernetes clusters execute the following command: - -```bash -make kubeconfig -``` - -Export `KUBECONFIG` as displayed by the above command. - -# Clean-up - -To delete all resources created in AWS, You can execute the following all-in-one command: - -```bash -make destroy-all -``` - -**or:** execute the following commands in this order: - -```bash -make destroy-armonik -make destroy-monitoring -make destroy-storage -make destroy-metrics-server -make destroy-keda -make destroy-eks -make destroy-vpc -make destroy-ecr -``` - -To clean-up and delete all generated files, You execute: - -```bash -make clean-all -``` - -**or:** - -```bash -make clean-armonik -make clean-monitoring -make clean-storage -make clean-metrics-server -make clean-keda -make clean-eks -make clean-vpc -make clean-ecr -``` - -### [Return to the infrastructure main page](../../README.md) - -### [Return to the project main page](../../../README.md) - - - diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/Makefile b/infrastructure/quick-deploy/aws-benchmark/armonik/Makefile deleted file mode 100644 index 7af4435dc..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -INGRESS_CERTIFICATES_DIR=$(GENERATED_DIR)/certificates/ingress -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=armonik-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/armonik-output.json -VERSIONS_FILE?=../../../../versions.tfvars.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export REGION?=eu-west-3 -export PROFILE?=default -export NAMESPACE?=armonik -export SUFFIX?=main -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) -export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"armonik\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json armonik >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf deleted file mode 100644 index d03bb83bb..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "armonik-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "armonik" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/locals.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/locals.tf deleted file mode 100644 index e69de29bb..000000000 diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/main.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/main.tf deleted file mode 100644 index 840052853..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/main.tf +++ /dev/null @@ -1,32 +0,0 @@ -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 - extra_conf = { - compute = try(var.extra_conf.compute, {}) - control = try(var.extra_conf.control, {}) - core = try(var.extra_conf.core, {}) - log = try(var.extra_conf.log, {}) - polling = try(var.extra_conf.polling, {}) - worker = try(var.extra_conf.worker, {}) - } - compute_plane = { for k, v in var.compute_plane : k => merge({ - partition_data = { - priority = 1 - reserved_pods = 1 - max_pods = 100 - preemption_percentage = 50 - parent_partition_ids = [] - pod_configuration = null - } - }, v) } - control_plane = var.control_plane - admin_gui = var.admin_gui - admin_old_gui = var.admin_old_gui - ingress = var.ingress - job_partitions_in_database = var.job_partitions_in_database - authentication = var.authentication -} diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf deleted file mode 100644 index 3378a6629..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/outputs.tf +++ /dev/null @@ -1,12 +0,0 @@ -output "armonik" { - description = "ArmoniK endpoint URL" - value = { - control_plane_url = module.armonik.endpoint_urls.control_plane_url - grafana_url = module.armonik.endpoint_urls.grafana_url - seq_web_url = module.armonik.endpoint_urls.seq_web_url - admin_api_url = module.armonik.endpoint_urls.admin_api_url - admin_app_url = module.armonik.endpoint_urls.admin_app_url - admin_old_url = module.armonik.endpoint_urls.admin_old_url - } -} - diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars deleted file mode 100644 index 8b50fd467..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/parameters.tfvars +++ /dev/null @@ -1,372 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# Kubeconfig path -k8s_config_path = "~/.kube/config" - -# Kubeconfig context -k8s_config_context = "default" - -# Kubernetes namespace -namespace = "armonik" - -# Logging level -logging_level = "Information" - -# Job to insert partitions in the database -job_partitions_in_database = { - name = "job-partitions-in-database" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/mongosh" - tag = "1.7.1" - image_pull_policy = "IfNotPresent" - image_pull_secrets = "" - node_selector = { service = "control-plane" } - annotations = {} -} - -# Parameters of control plane -control_plane = { - name = "control-plane" - service_type = "ClusterIP" - replicas = 1 - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-control-plane" - tag = "0.14.3" - image_pull_policy = "IfNotPresent" - port = 5001 - limits = { - cpu = "1000m" - memory = "2048Mi" - } - requests = { - cpu = "200m" - memory = "500Mi" - } - image_pull_secrets = "" - node_selector = { service = "control-plane" } - annotations = {} - hpa = { - polling_interval = 15 - cooldown_period = 300 - min_replica_count = 3 - max_replica_count = 3 - behavior = { - restore_to_original_replica_count = true - stabilization_window_seconds = 300 - type = "Percent" - value = 100 - period_seconds = 15 - } - triggers = [ - { - type = "cpu" - metric_type = "Utilization" - value = "80" - }, - { - type = "memory" - metric_type = "Utilization" - value = "80" - }, - ] - } - default_partition = "default" -} - -# Parameters of admin GUI -# Put to null if we not want deploy it -admin_gui = { - name = "admin-app" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-admin-app" - tag = "0.9.1" - port = 1080 - limits = { - cpu = "1000m" - memory = "1024Mi" - } - requests = { - cpu = "100m" - memory = "128Mi" - } - service_type = "ClusterIP" - replicas = 1 - image_pull_policy = "IfNotPresent" - image_pull_secrets = "" - node_selector = { service = "control-plane" } -} - -#Parameters of old admin GUI -admin_old_gui = { - api = { - name = "admin-api" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-admin-api-old" - tag = "0.8.0" - port = 3333 - limits = { - cpu = "1000m" - memory = "1024Mi" - } - requests = { - cpu = "100m" - memory = "128Mi" - } - } - old = { - name = "admin-old-gui" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-admin-app-old" - tag = "0.8.0" - port = 1080 - limits = { - cpu = "1000m" - memory = "1024Mi" - } - requests = { - cpu = "100m" - memory = "128Mi" - } - } - service_type = "ClusterIP" - replicas = 1 - image_pull_policy = "IfNotPresent" - image_pull_secrets = "" - node_selector = { service = "control-plane" } -} - -# Parameters of the compute plane -compute_plane = { - default = { - # number of replicas for each deployment of compute plane - replicas = 1 - termination_grace_period_seconds = 30 - image_pull_secrets = "" - node_selector = { service = "workers" } - annotations = {} - # ArmoniK polling agent - polling_agent = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" - tag = "0.14.3" - image_pull_policy = "IfNotPresent" - limits = { - cpu = "2000m" - memory = "2048Mi" - } - requests = { - cpu = "1000m" - memory = "256Mi" - } - } - # ArmoniK workers - worker = [ - { - name = "worker" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-worker" - tag = "0.12.1" - image_pull_policy = "IfNotPresent" - limits = { - cpu = "1000m" - memory = "1024Mi" - } - requests = { - cpu = "500m" - memory = "512Mi" - } - } - ] - hpa = { - type = "prometheus" - polling_interval = 15 - cooldown_period = 300 - min_replica_count = 1 - max_replica_count = 100 - behavior = { - restore_to_original_replica_count = true - stabilization_window_seconds = 300 - type = "Percent" - value = 100 - period_seconds = 15 - } - triggers = [ - { - type = "prometheus" - threshold = 2 - }, - ] - } - }, - bench = { - # number of replicas for each deployment of compute plane - replicas = 100 - termination_grace_period_seconds = 30 - image_pull_secrets = "" - node_selector = { service = "workers" } - annotations = {} - # ArmoniK polling agent - polling_agent = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" - tag = "0.14.3" - image_pull_policy = "IfNotPresent" - limits = { - cpu = "2000m" - memory = "2048Mi" - } - requests = { - cpu = "1000m" - memory = "256Mi" - } - } - # ArmoniK workers - worker = [ - { - name = "bench" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-bench" - tag = "0.14.3" - image_pull_policy = "IfNotPresent" - limits = { - cpu = "1000m" - memory = "1024Mi" - } - requests = { - cpu = "500m" - memory = "512Mi" - } - } - ] - hpa = { - type = "prometheus" - polling_interval = 15 - cooldown_period = 300 - min_replica_count = 100 - max_replica_count = 100 - behavior = { - restore_to_original_replica_count = true - stabilization_window_seconds = 300 - type = "Percent" - value = 100 - period_seconds = 15 - } - triggers = [ - { - type = "prometheus" - threshold = 2 - }, - ] - } - }, - htcmock = { - # number of replicas for each deployment of compute plane - replicas = 100 - termination_grace_period_seconds = 30 - image_pull_secrets = "" - node_selector = { service = "workers" } - annotations = {} - # ArmoniK polling agent - polling_agent = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-polling-agent" - tag = "0.14.3" - image_pull_policy = "IfNotPresent" - limits = { - cpu = "2000m" - memory = "2048Mi" - } - requests = { - cpu = "1000m" - memory = "256Mi" - } - } - # ArmoniK workers - worker = [ - { - name = "htcmock" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/armonik-htcmock" - tag = "0.14.3" - image_pull_policy = "IfNotPresent" - limits = { - cpu = "1000m" - memory = "1024Mi" - } - requests = { - cpu = "500m" - memory = "512Mi" - } - } - ] - hpa = { - type = "prometheus" - polling_interval = 15 - cooldown_period = 300 - min_replica_count = 100 - max_replica_count = 100 - behavior = { - restore_to_original_replica_count = true - stabilization_window_seconds = 300 - type = "Percent" - value = 100 - period_seconds = 15 - } - triggers = [ - { - type = "prometheus" - threshold = 2 - }, - ] - } - }, -} - -# Deploy ingress -# PS: to not deploy ingress put: "ingress=null" -ingress = { - name = "ingress" - service_type = "LoadBalancer" - replicas = 1 - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/nginx" - tag = "1.23.3" - image_pull_policy = "IfNotPresent" - http_port = 5000 - grpc_port = 5001 - limits = null - requests = null - image_pull_secrets = "" - node_selector = { service = "control-plane" } - annotations = {} - tls = false - mtls = false - generate_client_cert = false - custom_client_ca_file = "" -} - -authentication = { - name = "job-authentication-in-database" - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/mongosh" - tag = "1.7.1" - image_pull_policy = "IfNotPresent" - image_pull_secrets = "" - node_selector = { service = "control-plane" } - authentication_datafile = "" - require_authentication = false - require_authorization = false -} - -extra_conf = { - core = { - Amqp__AllowHostMismatch = false - Amqp__MaxPriority = "10" - Amqp__MaxRetries = "5" - Amqp__QueueStorage__LockRefreshPeriodicity = "00:00:45" - Amqp__QueueStorage__PollPeriodicity = "00:00:10" - Amqp__QueueStorage__LockRefreshExtension = "00:02:00" - MongoDB__TableStorage__PollingDelayMin = "00:00:01" - MongoDB__TableStorage__PollingDelayMax = "00:00:10" - MongoDB__TableStorage__PollingDelay = "00:00:01" - MongoDB__DataRetention = "10.00:00:00" - MongoDB__AllowInsecureTls = true - Redis__Timeout = 3000 - Redis__SslHost = "" - } - control = { - Submitter__MaxErrorAllowed = 50 - } -} - diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf deleted file mode 100644 index 6e2dbd516..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/providers.tf +++ /dev/null @@ -1,24 +0,0 @@ -provider "aws" { - region = var.region - profile = var.profile -} - -# 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/aws-benchmark/armonik/variables.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/variables.tf deleted file mode 100644 index ee09c9db3..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/variables.tf +++ /dev/null @@ -1,264 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# Kubeconfig path -variable "k8s_config_path" { - description = "Path of the configuration file of K8s" - type = string - default = "~/.kube/config" -} - -# Kubeconfig context -variable "k8s_config_context" { - description = "Context of K8s" - type = string - default = "default" -} - -# Kubernetes namespace -variable "namespace" { - description = "Kubernetes namespace for ArmoniK" - type = string - default = "armonik" -} - -# Logging level -variable "logging_level" { - description = "Logging level in ArmoniK" - type = string - default = "Information" -} - -# List of needed storage -variable "storage_endpoint_url" { - description = "List of storage needed by ArmoniK" - type = any - default = {} -} - -# Monitoring -variable "monitoring" { - description = "Endpoint URL of monitoring" - type = any - default = {} -} - - -# Extra configuration -variable "extra_conf" { - description = "Add extra configuration in the configmaps" - #type = object({ - # compute = optional(map(string), {}) - # control = optional(map(string), {}) - # core = optional(map(string), {}) - # log = optional(map(string), {}) - # polling = optional(map(string), {}) - # worker = optional(map(string), {}) - #}) - type = any - default = {} -} - -# Job to insert partitions in the database -variable "job_partitions_in_database" { - description = "Job to insert partitions IDs in the database" - type = object({ - name = string - image = string - tag = string - image_pull_policy = string - image_pull_secrets = string - node_selector = any - annotations = any - }) -} - -# Parameters of control plane -variable "control_plane" { - description = "Parameters of the control plane" - type = object({ - name = string - service_type = string - replicas = number - image = string - tag = string - image_pull_policy = string - port = number - limits = object({ - cpu = string - memory = string - }) - requests = object({ - cpu = string - memory = string - }) - image_pull_secrets = string - node_selector = any - annotations = any - # KEDA scaler - hpa = any - default_partition = string - }) -} - -# Parameters of admin gui -variable "admin_gui" { - description = "Parameters of the admin GUI" - type = object({ - name = string - image = string - tag = string - port = number - limits = object({ - cpu = string - memory = string - }) - requests = object({ - cpu = string - memory = string - }) - service_type = string - replicas = number - image_pull_policy = string - image_pull_secrets = string - node_selector = any - }) - default = null -} - -variable "admin_old_gui" { - description = "Parameters of the old admin GUI" - type = object({ - api = object({ - name = string - image = string - tag = string - port = number - limits = object({ - cpu = string - memory = string - }) - requests = object({ - cpu = string - memory = string - }) - }) - old = object({ - name = string - image = string - tag = string - port = number - limits = object({ - cpu = string - memory = string - }) - requests = object({ - cpu = string - memory = string - }) - }) - service_type = string - replicas = number - image_pull_policy = string - image_pull_secrets = string - node_selector = any - }) - default = null -} - -# Parameters of the compute plane -variable "compute_plane" { - description = "Parameters of the compute plane" - type = map(object({ - replicas = number - termination_grace_period_seconds = number - image_pull_secrets = string - node_selector = any - annotations = any - polling_agent = object({ - image = string - tag = string - image_pull_policy = string - limits = object({ - cpu = string - memory = string - }) - requests = object({ - cpu = string - memory = string - }) - }) - worker = list(object({ - name = string - image = string - tag = string - image_pull_policy = string - limits = object({ - cpu = string - memory = string - }) - requests = object({ - cpu = string - memory = string - }) - })) - # KEDA scaler - hpa = any - })) -} - -variable "ingress" { - description = "Parameters of the ingress controller" - type = object({ - name = string - service_type = string - replicas = number - image = string - tag = string - image_pull_policy = string - http_port = number - grpc_port = number - limits = object({ - cpu = string - memory = string - }) - requests = object({ - cpu = string - memory = string - }) - image_pull_secrets = string - node_selector = any - annotations = any - tls = bool - mtls = bool - generate_client_cert = bool - custom_client_ca_file = string - }) -} - -# Authentication behavior -variable "authentication" { - description = "Authentication behavior" - type = object({ - name = string - image = string - tag = string - image_pull_policy = string - image_pull_secrets = string - node_selector = any - authentication_datafile = string - require_authentication = bool - require_authorization = bool - }) -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf b/infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf deleted file mode 100644 index 4aa87e608..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/armonik/versions.tf +++ /dev/null @@ -1,12 +0,0 @@ -terraform { - required_providers { - kubernetes = { - source = "hashicorp/kubernetes" - version = "~> 2.7.1" - } - tls = { - source = "hashicorp/tls" - version = "~> 4.0.4" - } - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/backend/Makefile b/infrastructure/quick-deploy/aws-benchmark/backend/Makefile deleted file mode 100644 index 68a8241e8..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/backend/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -export SUFFIX?=main -export REGION?=eu-west-3 -export BUCKET_NAME?=armonik-tfstate -export PROFILE?=default -export TFSTATE_BUCKET_NAME=$(BUCKET_NAME)-$(SUFFIX) -BACKEND?=generated -YAML_SRC:=backend-resources.yaml - -all: deploy - -deploy: $(YAML_SRC) - @mkdir -p $(BACKEND) - aws --profile $(PROFILE) cloudformation create-stack --stack-name $(SUFFIX) --region $(REGION) --template-body file://$(YAML_SRC) --parameters ParameterKey=Tag,ParameterValue=$(SUFFIX) ParameterKey=BucketName,ParameterValue=$(BUCKET_NAME) - @echo "Waiting for cloud formation successful deployment" - @aws --profile $(PROFILE) cloudformation wait stack-create-complete --stack-name $(SUFFIX) --region $(REGION) - @aws --profile $(PROFILE) cloudformation describe-stacks --stack-name $(SUFFIX) --region $(REGION) --query 'Stacks[0]' > $(BACKEND)/output.json - -destroy: - aws --profile $(PROFILE) --region $(REGION) s3api delete-objects \ - --bucket "${TFSTATE_BUCKET_NAME}" \ - --delete "`aws s3api list-object-versions \ - --bucket "${TFSTATE_BUCKET_NAME}" \ - --output=json \ - --query='{Objects: Versions[].{Key:Key,VersionId:VersionId}}'`" - aws --profile $(PROFILE) cloudformation delete-stack --stack-name $(SUFFIX) --region $(REGION) - @aws --profile $(PROFILE) cloudformation wait stack-delete-complete --stack-name $(shell aws cloudformation describe-stacks --region $(REGION) --stack-name $(SUFFIX) --query 'Stacks[0].StackId' --output text) --region $(REGION) - diff --git a/infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml b/infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml deleted file mode 100644 index 9435da37a..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/backend/backend-resources.yaml +++ /dev/null @@ -1,127 +0,0 @@ ---- - -AWSTemplateFormatVersion: '2010-09-09' -Description: 'Security: KMS customer managed CMK for AWS services and S3 buckets for Terraform' -Metadata: - 'AWS::CloudFormation::Interface': - ParameterGroups: - - Label: - default: 'Tag needs to follow S3 naming rules.' - Parameters: - - Tag - - Label: - default: 'Name of S3 bucket' - Parameters: - - BucketName -Parameters: - Tag: - Description: 'Recommended to suffix the different required buckets' - Type: String - Default: '' - BucketName: - Description: 'Recommended to name S3 bucket' - Type: String - Default: '' -Resources: - Key: - DeletionPolicy: Delete - UpdateReplacePolicy: Retain - Type: 'AWS::KMS::Key' - Properties: - KeySpec: SYMMETRIC_DEFAULT - KeyUsage: ENCRYPT_DECRYPT - KeyPolicy: - Version: '2012-10-17' - Statement: - - Effect: Allow - Principal: - AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:root' - Action: 'kms:*' - Resource: '*' - - Effect: Allow - Principal: - AWS: !Sub '${AWS::AccountId}' - Action: - - kms:Encrypt* - - kms:Decrypt* - - kms:ReEncrypt* - - kms:GenerateDataKey* - - kms:Describe* - Resource: '*' - Condition: - StringEquals: - kms:ViaService: - - !Sub 'ec2.${AWS::Region}.amazonaws.com' - - !Sub 's3.${AWS::Region}.amazonaws.com' - - !Sub 'dynamodb.${AWS::Region}.amazonaws.com' - - !Sub 'ecr.${AWS::Region}.amazonaws.com' - - !Sub 'eks.${AWS::Region}.amazonaws.com' - - !Sub 'elasticache.${AWS::Region}.amazonaws.com' - - !Sub 'mq.${AWS::Region}.amazonaws.com' - - Effect: Allow - Principal: - Service: !Sub 'logs.${AWS::Region}.amazonaws.com' - Action: - - kms:Encrypt* - - kms:Decrypt* - - kms:ReEncrypt* - - kms:GenerateDataKey* - - kms:Describe* - Resource: '*' - Condition: - ArnEquals: - kms:EncryptionContext:aws:logs:arn: !Sub 'arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*:*' - - Effect: Allow - Principal: - AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling' - Action: - - kms:Encrypt* - - kms:Decrypt* - - kms:ReEncrypt* - - kms:GenerateDataKey* - - kms:Describe* - Resource: '*' - - Effect: Allow - Principal: - AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling' - Action: - - kms:CreateGrant - Resource: '*' - Condition: - Bool: - kms:GrantIsForAWSResource: true - KeyAlias: - DeletionPolicy: Delete - UpdateReplacePolicy: Retain - Type: 'AWS::KMS::Alias' - Properties: - AliasName: !Sub - - 'alias/armonik-kms-${Tag}-${RANDOM}' - - RANDOM: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] - TargetKeyId: !Ref Key - ArmoniKTfstate: - Type: 'AWS::S3::Bucket' - Properties: - BucketName: !Sub - - '${BucketName}-${Tag}' - - RANDOM: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] - VersioningConfiguration: - Status: Enabled - BucketEncryption: - ServerSideEncryptionConfiguration: - - ServerSideEncryptionByDefault: - SSEAlgorithm: 'aws:kms' - KMSMasterKeyID: !GetAtt 'Key.Arn' - DeletionPolicy: Delete -Outputs: - StackName: - Description: 'Stack name.' - Value: !Sub '${AWS::StackName}' - KeyArn: - Description: 'Key ARN.' - Value: !GetAtt 'Key.Arn' - Export: - Name: !Sub '${AWS::StackName}-KeyArn' - ArmoniKTfstateBucketId: - Description: 'S3 bucket name for .tfstates of ArmoniK' - Value: !Ref ArmoniKTfstate \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/Makefile b/infrastructure/quick-deploy/aws-benchmark/ecr/Makefile deleted file mode 100644 index e95bf2329..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=ecr-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/ecr-output.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export SUFFIX?=main -export REGION?=eu-west-3 -export PROFILE?=default -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -parallelism 1 \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"ecr_repositories\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json ecr_repositories >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf deleted file mode 100644 index 9af078478..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "ecr-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "ecr" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf deleted file mode 100644 index e4db5499e..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/locals.tf +++ /dev/null @@ -1,24 +0,0 @@ -# Current account -data "aws_caller_identity" "current" {} - -resource "random_string" "random_resources" { - length = 5 - special = false - upper = false - numeric = true -} - -resource "time_static" "creation_date" {} - -locals { - random_string = random_string.random_resources.result - suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string - kms_name = "armonik-kms-ecr-${local.suffix}-${local.random_string}" - repositories = [for element in var.ecr.repositories : merge(element, { name = "${local.suffix}/${element.name}" })] - tags = merge({ - "application" = "armonik" - "deployment version" = local.suffix - "created by" = data.aws_caller_identity.current.arn - "creation date" = time_static.creation_date.rfc3339 - }, var.tags) -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/main.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/main.tf deleted file mode 100644 index 0e1d5aece..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/main.tf +++ /dev/null @@ -1,16 +0,0 @@ -# AWS KMS -module "kms" { - count = (var.ecr.kms_key_id == "" ? 1 : 0) - source = "../generated/infra-modules/utils/aws/kms" - name = local.kms_name - tags = local.tags -} - -# AWS ECR -module "ecr" { - source = "../generated/infra-modules/container-registry/aws/ecr" - profile = var.profile - tags = local.tags - kms_key_id = (var.ecr.kms_key_id != "" ? var.ecr.kms_key_id : module.kms.0.arn) - repositories = var.ecr.repositories -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf deleted file mode 100644 index 98d1b3b5e..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/outputs.tf +++ /dev/null @@ -1,4 +0,0 @@ -# ECR images -output "ecr_repositories" { - value = module.ecr.repositories -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars deleted file mode 100644 index 521db8a7b..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/parameters.tfvars +++ /dev/null @@ -1,184 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# SUFFIX -suffix = "main" - -# Tags -tags = { - "name" = "" - "env" = "" - "entity" = "" - "bu" = "" - "owner" = "" - "application code" = "" - "project code" = "" - "cost center" = "" - "Support Contact" = "" - "origin" = "terraform" - "unit of measure" = "" - "epic" = "" - "functional block" = "" - "hostname" = "" - "interruptible" = "" - "tostop" = "" - "tostart" = "" - "branch" = "" - "gridserver" = "" - "it division" = "" - "Confidentiality" = "" - "csp" = "aws" - "grafanaserver" = "" - "Terraform" = "true" - "DST_Update" = "" -} - -# List of ECR repositories to create -ecr = { - kms_key_id = "" - repositories = [ - { - name = "mongodb" - image = "mongo" - tag = "6.0.1" - }, - { - name = "armonik-control-plane" - image = "dockerhubaneo/armonik_control" - tag = "0.14.3" - }, - { - name = "armonik-polling-agent" - image = "dockerhubaneo/armonik_pollingagent" - tag = "0.14.3" - }, - { - name = "armonik-worker" - image = "dockerhubaneo/armonik_worker_dll" - tag = "0.12.1" - }, - { - name = "armonik-bench" - image = "dockerhubaneo/armonik_core_bench_test_worker" - tag = "0.14.3" - }, - { - name = "armonik-htcmock" - image = "dockerhubaneo/armonik_core_htcmock_test_worker" - tag = "0.14.3" - }, - { - name = "metrics-exporter" - image = "dockerhubaneo/armonik_control_metrics" - tag = "0.14.3" - }, - { - name = "partition-metrics-exporter" - image = "dockerhubaneo/armonik_control_partition_metrics" - tag = "0.14.3" - }, - { - name = "armonik-admin-app" - image = "dockerhubaneo/armonik_admin_app" - tag = "0.9.1" - }, - { - name = "armonik-admin-app-old" - image = "dockerhubaneo/armonik_admin_app" - tag = "0.8.0" - }, - { - name = "armonik-admin-api-old" - image = "dockerhubaneo/armonik_admin_api" - tag = "0.8.0" - }, - { - name = "mongosh" - image = "rtsp/mongosh" - tag = "1.7.1" - }, - { - name = "seq" - image = "datalust/seq" - tag = "2023.1" - }, - { - name = "seqcli" - image = "datalust/seqcli" - tag = "2023.1" - }, - { - name = "grafana" - image = "grafana/grafana" - tag = "9.3.6" - }, - { - name = "prometheus" - image = "prom/prometheus" - tag = "v2.42.0" - }, - { - name = "cluster-autoscaler" - image = "registry.k8s.io/autoscaling/cluster-autoscaler" - tag = "v1.23.0" - }, - { - name = "aws-node-termination-handler" - image = "public.ecr.aws/aws-ec2/aws-node-termination-handler" - tag = "v1.19.0" - }, - { - name = "metrics-server" - image = "registry.k8s.io/metrics-server/metrics-server" - tag = "v0.6.2" - }, - { - name = "fluent-bit" - image = "fluent/fluent-bit" - tag = "2.0.9" - }, - { - name = "node-exporter" - image = "prom/node-exporter" - tag = "v1.5.0" - }, - { - name = "nginx" - image = "nginxinc/nginx-unprivileged" - tag = "1.23.3" - }, - { - name = "keda" - image = "ghcr.io/kedacore/keda" - tag = "2.9.3" - }, - { - name = "keda-metrics-apiserver" - image = "ghcr.io/kedacore/keda-metrics-apiserver" - tag = "2.9.3" - }, - { - name = "aws-efs-csi-driver" - image = "amazon/aws-efs-csi-driver" - tag = "v1.5.1" - }, - { - name = "livenessprobe" - image = "public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe" - tag = "v2.9.0-eks-1-22-19" - }, - { - name = "node-driver-registrar" - image = "public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar" - tag = "v2.7.0-eks-1-22-19" - }, - { - name = "external-provisioner" - image = "public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner" - tag = "v3.4.0-eks-1-22-19" - } - ] -} diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf deleted file mode 100644 index c0fc95d9d..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/providers.tf +++ /dev/null @@ -1,4 +0,0 @@ -provider "aws" { - region = var.region - profile = var.profile -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf deleted file mode 100644 index 9c4ce86d7..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/variables.tf +++ /dev/null @@ -1,36 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# SUFFIX -variable "suffix" { - description = "To suffix the AWS resources" - type = string - default = "" -} - -# AWS TAGs -variable "tags" { - description = "Tags for AWS resources" - type = any - default = {} -} - -# List of ECR repositories to create -variable "ecr" { - description = "List of ECR repositories to create" - type = object({ - kms_key_id = string - repositories = list(any) - }) -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf b/infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf deleted file mode 100644 index 191bee1ad..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/ecr/versions.tf +++ /dev/null @@ -1,16 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.47" - } - random = { - source = "hashicorp/random" - version = "~> 3.4.3" - } - null = { - source = "hashicorp/null" - version = "~> 3.1.0" - } - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/Makefile b/infrastructure/quick-deploy/aws-benchmark/eks/Makefile deleted file mode 100644 index a4495bca8..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=eks-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/eks-output.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export SUFFIX?=main -export REGION?=eu-west-3 -export PROFILE?=default -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) -export VPC_PARAMETERS_FILE?=$(CURRENT_DIR)/../vpc/generated/vpc-output.json -export PUBLIC_ACCESS_EKS?=true -export KUBECONFIG?=$(GENERATED_DIR)/kubeconfig - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var-file $(VPC_PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'enable_public_eks_access=$(PUBLIC_ACCESS_EKS)' \ - -var 'kubeconfig_file=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"eks\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json eks >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var-file $(VPC_PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'enable_public_eks_access=$(PUBLIC_ACCESS_EKS)' \ - -var 'kubeconfig_file=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/backend.tf b/infrastructure/quick-deploy/aws-benchmark/eks/backend.tf deleted file mode 100644 index 0a1689de7..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "eks-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "eks" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/locals.tf b/infrastructure/quick-deploy/aws-benchmark/eks/locals.tf deleted file mode 100644 index 94d5b63e4..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/locals.tf +++ /dev/null @@ -1,43 +0,0 @@ -# Current account -data "aws_caller_identity" "current" {} - -resource "random_string" "random_resources" { - length = 5 - special = false - upper = false - numeric = true -} - -locals { - random_string = random_string.random_resources.result - suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string - cluster_name = try(var.vpc.eks_cluster_name, "armonik-eks-${local.suffix}") - kms_name = "armonik-kms-eks-${local.suffix}-${local.random_string}" - cluster_endpoint_public_access = var.enable_public_eks_access - vpc = { - id = try(var.vpc.id, "") - private_subnet_ids = try(var.vpc.private_subnet_ids, []) - pods_subnet_ids = try(var.vpc.pods_subnet_ids, []) - } - tags = merge({ - "application" = "armonik" - "deployment version" = local.suffix - "created by" = data.aws_caller_identity.current.arn - "creation date" = null_resource.timestamp.triggers["creation_date"] - }, var.tags) -} - -# this external provider is used to get date during the plan step. -data "external" "static_timestamp" { - program = ["date", "+{ \"creation_date\": \"%Y/%m/%d %T\" }"] -} - -# this resource is just used to prevent change of the creation_date during successive 'terraform apply' -resource "null_resource" "timestamp" { - triggers = { - creation_date = data.external.static_timestamp.result.creation_date - } - lifecycle { - ignore_changes = [triggers] - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/main.tf b/infrastructure/quick-deploy/aws-benchmark/eks/main.tf deleted file mode 100644 index e7cd52412..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/main.tf +++ /dev/null @@ -1,54 +0,0 @@ -# AWS KMS -module "kms" { - count = (var.eks.encryption_keys.cluster_log_kms_key_id != "" && var.eks.encryption_keys.cluster_encryption_config != "" && var.eks.encryption_keys.ebs_kms_key_id != "" ? 0 : 1) - source = "../generated/infra-modules/utils/aws/kms" - name = local.kms_name - tags = local.tags -} - -# AWS EKS -module "eks" { - source = "../generated/infra-modules/kubernetes/aws/eks" - profile = var.profile - tags = local.tags - name = local.cluster_name - node_selector = var.node_selector - kubeconfig_file = abspath(var.kubeconfig_file) - vpc = { - id = local.vpc.id - private_subnet_ids = local.vpc.private_subnet_ids - pods_subnet_ids = local.vpc.pods_subnet_ids - } - eks = { - region = var.region - cluster_version = var.eks.cluster_version - cluster_endpoint_private_access = var.eks.cluster_endpoint_private_access - cluster_endpoint_private_access_cidrs = var.eks.cluster_endpoint_private_access_cidrs - cluster_endpoint_private_access_sg = var.eks.cluster_endpoint_private_access_sg - cluster_endpoint_public_access = local.cluster_endpoint_public_access - cluster_endpoint_public_access_cidrs = var.eks.cluster_endpoint_public_access_cidrs - cluster_log_retention_in_days = var.eks.cluster_log_retention_in_days - docker_images = { - cluster_autoscaler = { - image = var.eks.docker_images.cluster_autoscaler.image - tag = var.eks.docker_images.cluster_autoscaler.tag - } - instance_refresh = { - image = var.eks.docker_images.instance_refresh.image - tag = var.eks.docker_images.instance_refresh.tag - } - } - instance_refresh = var.eks.instance_refresh - cluster_autoscaler = var.eks.cluster_autoscaler - encryption_keys = { - cluster_log_kms_key_id = (var.eks.encryption_keys.cluster_log_kms_key_id != "" ? var.eks.encryption_keys.cluster_log_kms_key_id : module.kms.0.arn) - cluster_encryption_config = (var.eks.encryption_keys.cluster_encryption_config != "" ? var.eks.encryption_keys.cluster_encryption_config : module.kms.0.arn) - ebs_kms_key_id = (var.eks.encryption_keys.ebs_kms_key_id != "" ? var.eks.encryption_keys.ebs_kms_key_id : module.kms.0.arn) - } - map_roles = var.eks.map_roles - map_users = var.eks.map_users - } - eks_managed_node_groups = var.eks_managed_node_groups - self_managed_node_groups = var.self_managed_node_groups - fargate_profiles = var.fargate_profiles -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf deleted file mode 100644 index 46c16189a..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/outputs.tf +++ /dev/null @@ -1,19 +0,0 @@ -# EKS -output "eks" { - description = "EKS parameters" - value = { - cluster_name = module.eks.cluster_name - cluster_id = module.eks.cluster_id - eks_managed_worker_iam_role_names = module.eks.eks_managed_worker_iam_role_names - self_managed_worker_iam_role_names = module.eks.self_managed_worker_iam_role_names - fargate_profiles_worker_iam_role_names = module.eks.fargate_profiles_worker_iam_role_names - worker_iam_role_names = module.eks.worker_iam_role_names - issuer = module.eks.issuer - kubeconfig_file = module.eks.kubeconfig_file - } -} - -output "kubeconfig" { - description = "Use multiple Kubernetes cluster with KUBECONFIG environment variable" - value = "export KUBECONFIG=${module.eks.kubeconfig_file}" -} diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars deleted file mode 100644 index 14b0da346..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/parameters.tfvars +++ /dev/null @@ -1,296 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# SUFFIX -suffix = "main" - -# Tags -tags = { - "name" = "" - "env" = "" - "entity" = "" - "bu" = "" - "owner" = "" - "application code" = "" - "project code" = "" - "cost center" = "" - "Support Contact" = "" - "origin" = "terraform" - "unit of measure" = "" - "epic" = "" - "functional block" = "" - "hostname" = "" - "interruptible" = "" - "tostop" = "" - "tostart" = "" - "branch" = "" - "gridserver" = "" - "it division" = "" - "Confidentiality" = "" - "csp" = "aws" - "grafanaserver" = "" - "Terraform" = "true" - "DST_Update" = "" -} - -# Node selector -node_selector = { service = "monitoring" } - -# AWS EKS -eks = { - name = "armonik-eks" - cluster_version = "1.25" - cluster_endpoint_private_access = true # vpc.enable_private_subnet - cluster_endpoint_private_access_cidrs = [] - cluster_endpoint_private_access_sg = [] - cluster_endpoint_public_access = false - cluster_endpoint_public_access_cidrs = ["0.0.0.0/0"] - cluster_log_retention_in_days = 30 - docker_images = { - cluster_autoscaler = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/cluster-autoscaler" - tag = "v1.23.0" - } - instance_refresh = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/aws-node-termination-handler" - tag = "v1.19.0" - } - } - cluster_autoscaler = { - expander = "least-waste" # random, most-pods, least-waste, price, priority - scale_down_enabled = true - min_replica_count = 0 - scale_down_utilization_threshold = 0.5 - scale_down_non_empty_candidates_count = 30 - max_node_provision_time = "15m0s" - scan_interval = "10s" - scale_down_delay_after_add = "2m" - scale_down_delay_after_delete = "0s" - scale_down_delay_after_failure = "3m" - scale_down_unneeded_time = "2m" - skip_nodes_with_system_pods = true - version = "9.24.0" - repository = "https://kubernetes.github.io/autoscaler" - namespace = "kube-system" - } - instance_refresh = { - namespace = "kube-system" - repository = "https://aws.github.io/eks-charts" - version = "0.21.0" - } - encryption_keys = { - cluster_log_kms_key_id = "" - cluster_encryption_config = "" - ebs_kms_key_id = "" - } - map_roles = [] - map_users = [] -} - -# List of EKS managed node groups -eks_managed_node_groups = { - # Default node group for workers of ArmoniK - workers = { - name = "workers" - launch_template_description = "Node group for ArmoniK Compute-plane pods" - ami_type = "AL2_x86_64" - instance_types = ["c5.24xlarge"] - capacity_type = "SPOT" - min_size = 0 - desired_size = 0 - max_size = 1000 - labels = { - service = "workers" - "node.kubernetes.io/lifecycle" = "spot" - } - taints = { - dedicated = { - key = "service" - value = "workers" - effect = "NO_SCHEDULE" - } - } - iam_role_use_name_prefix = false - iam_role_additional_policies = { - AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" - } - } - # Node group for metrics: Metrics exporter and Prometheus - metrics = { - name = "metrics" - launch_template_description = "Node group for metrics: Metrics exporter and Prometheus" - ami_type = "AL2_x86_64" - instance_types = ["c5.24xlarge"] - capacity_type = "ON_DEMAND" - min_size = 1 - desired_size = 1 - max_size = 5 - labels = { - service = "metrics" - "node.kubernetes.io/lifecycle" = "ondemand" - } - taints = { - dedicated = { - key = "service" - value = "metrics" - effect = "NO_SCHEDULE" - } - } - iam_role_use_name_prefix = false - iam_role_additional_policies = { - AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" - } - } - # Node group for ArmoniK control-plane: control-plane and Ingress - control_plane = { - name = "control-plane" - launch_template_description = "Node group for ArmoniK Control-plane and Ingress" - ami_type = "AL2_x86_64" - instance_types = ["c5.24xlarge"] - capacity_type = "ON_DEMAND" - min_size = 1 - desired_size = 1 - max_size = 10 - labels = { - service = "control-plane" - "node.kubernetes.io/lifecycle" = "ondemand" - } - taints = { - dedicated = { - key = "service" - value = "control-plane" - effect = "NO_SCHEDULE" - } - } - iam_role_use_name_prefix = false - iam_role_additional_policies = { - AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" - } - } - # Node group for monitoring: metrics server, keda, seq, grafana, cluster-autoscaler, coreDNS, termination handler - monitoring = { - name = "monitoring" - launch_template_description = "Node group for monitoring" - ami_type = "AL2_x86_64" - instance_types = ["c5.24xlarge"] - capacity_type = "ON_DEMAND" - min_size = 1 - desired_size = 1 - max_size = 5 - labels = { - service = "monitoring" - "node.kubernetes.io/lifecycle" = "ondemand" - } - taints = { - dedicated = { - key = "service" - value = "monitoring" - effect = "NO_SCHEDULE" - } - } - iam_role_use_name_prefix = false - iam_role_additional_policies = { - AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" - } - } - # Node group for data-plane - # state_database, inner_storage, task_queue - state_database = { - name = "mongodb" - launch_template_description = "Node group for MongoDB" - ami_type = "AL2_x86_64" - instance_types = ["c5.24xlarge"] - use_custom_launch_template = true - block_device_mappings = { - xvda = { - device_name = "/dev/xvda" - ebs = { - volume_size = 75 - volume_type = "gp3" - iops = 3000 - throughput = 150 - encrypted = null - kms_key_id = null - delete_on_termination = true - } - } - } - capacity_type = "ON_DEMAND" - min_size = 1 - desired_size = 1 - max_size = 10 - labels = { - service = "state-database" - "node.kubernetes.io/lifecycle" = "ondemand" - } - taints = { - dedicated = { - key = "service" - value = "state-database" - effect = "NO_SCHEDULE" - } - } - iam_role_use_name_prefix = false - iam_role_additional_policies = { - AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" - } - } -} - -# List of self managed node groups -self_managed_node_groups = { - others = { - name = "others" - launch_template_description = "Node group for others" - instance_type = "c5.24xlarge" - min_size = 0 - desired_size = 0 - max_size = 5 - force_delete = true - force_delete_warm_pool = true - instance_market_options = { - market_type = "spot" - } - bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'" - iam_role_use_name_prefix = false - iam_role_additional_policies = { - AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" - } - } - others_mixed = { - name = "others-mixed" - launch_template_description = "Mixed On demand and SPOT instances for other pods" - min_size = 0 - desired_size = 0 - max_size = 5 - use_mixed_instances_policy = true - mixed_instances_policy = { - on_demand_allocation_strategy = "lowest-price" - on_demand_base_capacity = 0 - on_demand_percentage_above_base_capacity = 20 # 20% On-Demand Instances, 80% Spot Instances - spot_allocation_strategy = "price-capacity-optimized" - spot_instance_pools = null - spot_max_price = null - } - override = [ - { - instance_type = "c5.4xlarge" - weighted_capacity = "1" - }, - { - instance_type = "c5.2xlarge" - weighted_capacity = "2" - }, - ] - iam_role_use_name_prefix = false - iam_role_additional_policies = { - AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" - } - } -} - -# List of fargate profiles -fargate_profiles = {} diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/providers.tf b/infrastructure/quick-deploy/aws-benchmark/eks/providers.tf deleted file mode 100644 index 80b2f1732..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/providers.tf +++ /dev/null @@ -1,33 +0,0 @@ -provider "aws" { - region = var.region - profile = var.profile -} - -provider "kubernetes" { - host = module.eks.cluster_endpoint - cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) - - exec { - api_version = "client.authentication.k8s.io/v1beta1" - command = "aws" - # This requires the awscli to be installed locally where Terraform is executed - args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] - } -} - -# package manager for kubernetes -provider "helm" { - helm_driver = "configmap" - kubernetes { - host = module.eks.cluster_endpoint - cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) - insecure = false - - exec { - api_version = "client.authentication.k8s.io/v1beta1" - command = "aws" - # This requires the awscli to be installed locally where Terraform is executed - args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name] - } - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/variables.tf b/infrastructure/quick-deploy/aws-benchmark/eks/variables.tf deleted file mode 100644 index 5b034ecc1..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/variables.tf +++ /dev/null @@ -1,138 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# SUFFIX -variable "suffix" { - description = "To suffix the AWS resources" - type = string - default = "" -} - -# AWS TAGs -variable "tags" { - description = "Tags for AWS resources" - type = any - default = {} -} - -# Node selector -variable "node_selector" { - description = "Node selector for Seq" - type = any - default = {} -} - -# VPC infos -variable "vpc" { - description = "AWS VPC info" - type = any - default = {} -} - -# Kubeconfig file path -variable "kubeconfig_file" { - description = "Kubeconfig file path" - type = string - default = "generated/kubeconfig" -} - -# AWS EKS -variable "eks" { - description = "Parameters of AWS EKS" - type = object({ - name = string - cluster_version = string - cluster_endpoint_private_access = bool # vpc.enable_private_subnet - cluster_endpoint_private_access_cidrs = list(string) - cluster_endpoint_private_access_sg = list(string) - cluster_endpoint_public_access = bool - cluster_endpoint_public_access_cidrs = list(string) - cluster_log_retention_in_days = number - docker_images = object({ - cluster_autoscaler = object({ - image = string - tag = string - }) - instance_refresh = object({ - image = string - tag = string - }) - }) - cluster_autoscaler = object({ - expander = string - scale_down_enabled = bool - min_replica_count = number - scale_down_utilization_threshold = number - scale_down_non_empty_candidates_count = number - max_node_provision_time = string - scan_interval = string - scale_down_delay_after_add = string - scale_down_delay_after_delete = string - scale_down_delay_after_failure = string - scale_down_unneeded_time = string - skip_nodes_with_system_pods = bool - version = optional(string, "9.24.0") - repository = optional(string, "https://kubernetes.github.io/autoscaler") - namespace = optional(string, "kube-system") - }) - instance_refresh = object({ - namespace = optional(string, "kube-system") - repository = optional(string, "https://aws.github.io/eks-charts") - version = optional(string, "0.21.0") - }) - encryption_keys = object({ - cluster_log_kms_key_id = string - cluster_encryption_config = string - ebs_kms_key_id = string - }) - map_roles = list(object({ - rolearn = string - username = string - groups = list(string) - })) - map_users = list(object({ - userarn = string - username = string - groups = list(string) - })) - }) -} - -# Enable EKS public access -variable "enable_public_eks_access" { - description = "Enable EKS public access" - type = bool - default = true -} - -# List of EKS managed node groups -variable "eks_managed_node_groups" { - description = "List of EKS managed node groups" - type = any - default = null -} - -# List of self managed node groups -variable "self_managed_node_groups" { - description = "List of self managed node groups" - type = any - default = null -} - -# List of fargate profiles -variable "fargate_profiles" { - description = "List of fargate profiles" - type = any - default = null -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/eks/versions.tf b/infrastructure/quick-deploy/aws-benchmark/eks/versions.tf deleted file mode 100644 index 9fb8e702b..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/eks/versions.tf +++ /dev/null @@ -1,28 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.47" - } - kubernetes = { - source = "hashicorp/kubernetes" - version = "~> 2.13.0" - } - cloudinit = { - source = "hashicorp/cloudinit" - version = "~> 2.2.0" - } - helm = { - source = "hashicorp/helm" - version = "~> 2.7.0" - } - random = { - source = "hashicorp/random" - version = "~> 3.4.3" - } - local = { - source = "hashicorp/local" - version = "~> 2.2.0" - } - } -} diff --git a/infrastructure/quick-deploy/aws-benchmark/envvars.sh b/infrastructure/quick-deploy/aws-benchmark/envvars.sh deleted file mode 100644 index d7eb33a9f..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/envvars.sh +++ /dev/null @@ -1,9 +0,0 @@ -export ARMONIK_PROFILE="default" -export ARMONIK_REGION="eu-west-3" -export ARMONIK_SUFFIX="main" -export ARMONIK_BUCKET_NAME="armonik-tfstate" -export ARMONIK_KUBERNETES_NAMESPACE="armonik" -export KEDA_KUBERNETES_NAMESPACE="default" -export METRICS_SERVER_KUBERNETES_NAMESPACE="kube-system" -export PUBLIC_VPC="true" -export PUBLIC_ACCESS_EKS="true" diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/Makefile b/infrastructure/quick-deploy/aws-benchmark/keda/Makefile deleted file mode 100644 index a4020e871..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/keda/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=keda-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/keda-output.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export REGION?=eu-west-3 -export PROFILE?=default -export NAMESPACE?=default -export SUFFIX?=main -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) -export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"keda\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json keda >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/backend.tf b/infrastructure/quick-deploy/aws-benchmark/keda/backend.tf deleted file mode 100644 index 80fb20ec4..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/keda/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "keda-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "armonik" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/locals.tf b/infrastructure/quick-deploy/aws-benchmark/keda/locals.tf deleted file mode 100644 index 5ac3a23d0..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/keda/locals.tf +++ /dev/null @@ -1,14 +0,0 @@ -locals { - # Keda - keda_namespace = try(var.namespace, "default") - keda_keda_image = try(var.keda.docker_image.keda.image, "ghcr.io/kedacore/keda") - keda_keda_tag = try(var.keda.docker_image.keda.tag, "2.6.1") - keda_metricsApiServer_image = try(var.keda.docker_image.metricsApiServer.image, "ghcr.io/kedacore/keda-metrics-apiserver") - keda_metricsApiServer_tag = try(var.keda.docker_image.metricsApiServer.tag, "2.6.1") - keda_image_pull_secrets = try(var.keda.image_pull_secrets, "") - keda_node_selector = try(var.keda.node_selector, {}) - keda_metrics_server_dns_policy = try(var.keda.metrics_server_dns_policy, "ClusterFirst") - keda_metrics_server_use_host_network = try(var.keda.metrics_server_use_host_network, false) - keda_chart_repository = try(coalesce(var.keda.helm_chart_repository), "https://kedacore.github.io/charts") - keda_chart_version = try(coalesce(var.keda.helm_chart_version), "2.9.4") -} diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/main.tf b/infrastructure/quick-deploy/aws-benchmark/keda/main.tf deleted file mode 100644 index 6e4191ff5..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/keda/main.tf +++ /dev/null @@ -1,21 +0,0 @@ -# Keda -module "keda" { - source = "../generated/infra-modules/monitoring/onpremise/keda" - namespace = local.keda_namespace - docker_image = { - keda = { - image = local.keda_keda_image - tag = local.keda_keda_tag - } - metricsApiServer = { - image = local.keda_metricsApiServer_image - tag = local.keda_metricsApiServer_tag - } - } - image_pull_secrets = local.keda_image_pull_secrets - node_selector = local.keda_node_selector - helm_chart_repository = local.keda_chart_repository - helm_chart_version = local.keda_chart_version - metrics_server_dns_policy = local.keda_metrics_server_dns_policy - metrics_server_use_host_network = local.keda_metrics_server_use_host_network -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf deleted file mode 100644 index 7be92c32d..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/keda/outputs.tf +++ /dev/null @@ -1,4 +0,0 @@ -output "keda" { - description = "Keda" - value = module.keda -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars deleted file mode 100644 index f594ef242..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/keda/parameters.tfvars +++ /dev/null @@ -1,28 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# Kubernetes namespace -namespace = "default" - -# Keda infos -keda = { - docker_image = { - keda = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/keda" - tag = "2.9.3" - } - metricsApiServer = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/keda-metrics-apiserver" - tag = "2.9.3" - } - } - image_pull_secrets = "" - node_selector = { service = "monitoring" } - metrics_server_dns_policy = "ClusterFirst" - metrics_server_use_host_network = false - helm_chart_repository = "https://kedacore.github.io/charts" - helm_chart_version = "2.9.4" -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/providers.tf b/infrastructure/quick-deploy/aws-benchmark/keda/providers.tf deleted file mode 100644 index 882c7d3ce..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/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/aws-benchmark/keda/variables.tf b/infrastructure/quick-deploy/aws-benchmark/keda/variables.tf deleted file mode 100644 index 262d023e1..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/keda/variables.tf +++ /dev/null @@ -1,56 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# Kubeconfig path -variable "k8s_config_path" { - description = "Path of the configuration file of K8s" - type = string - default = "~/.kube/config" -} - -# Kubeconfig context -variable "k8s_config_context" { - description = "Context of K8s" - type = string - default = "default" -} - -# Kubernetes namespace -variable "namespace" { - description = "Kubernetes namespace for Keda" - type = string -} - -# Keda infos -variable "keda" { - description = "Keda infos" - type = object({ - docker_image = object({ - keda = object({ - image = string - tag = string - }) - metricsApiServer = object({ - image = string - tag = string - }) - }) - image_pull_secrets = string - node_selector = any - metrics_server_dns_policy = string - metrics_server_use_host_network = bool - helm_chart_repository = string - helm_chart_version = string - }) -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/keda/versions.tf b/infrastructure/quick-deploy/aws-benchmark/keda/versions.tf deleted file mode 100644 index e69de29bb..000000000 diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile b/infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile deleted file mode 100644 index 17e3fdb47..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/metrics-server/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=metrics-server-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/metrics-server-output.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export REGION?=eu-west-3 -export PROFILE?=default -export NAMESPACE?=kube-system -export SUFFIX?=main -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) -export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"metrics_server\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json metrics_server >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf deleted file mode 100644 index 12d373aa9..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/metrics-server/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "metrics-server-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "armonik" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf deleted file mode 100644 index b1c1d547b..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/metrics-server/locals.tf +++ /dev/null @@ -1,17 +0,0 @@ -locals { - # metrics server - namespace = try(var.namespace, "kube-system") - image = try(var.docker_image.image, "k8s.gcr.io/metrics-server/metrics-server") - tag = try(var.docker_image.tag, "v0.6.1") - image_pull_secrets = try(var.image_pull_secrets, "") - node_selector = try(var.node_selector, {}) - default_args = try(var.args, []) == [] ? [ - "--cert-dir=/tmp", - "--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname", - "--kubelet-use-node-status-port", - "--metric-resolution=15s" - ] : var.args - host_network = try(var.host_network, false) - helm_chart_repository = try(coalesce(var.helm_chart_repository), "https://kubernetes-sigs.github.io/metrics-server/") - helm_chart_version = try(coalesce(var.helm_chart_version), "3.8.3") -} diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf deleted file mode 100644 index fa4545378..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/metrics-server/main.tf +++ /dev/null @@ -1,15 +0,0 @@ -# Metrics server -module "metrics_server" { - source = "../generated/infra-modules/monitoring/onpremise/metrics-server" - namespace = local.namespace - docker_image = { - image = local.image - tag = local.tag - } - image_pull_secrets = local.image_pull_secrets - node_selector = local.node_selector - default_args = local.default_args - host_network = local.host_network - helm_chart_repository = local.helm_chart_repository - helm_chart_version = local.helm_chart_version -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf deleted file mode 100644 index 16a0e31b1..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/metrics-server/outputs.tf +++ /dev/null @@ -1,4 +0,0 @@ -output "metrics_server" { - description = "metrics server" - value = module.metrics_server -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars deleted file mode 100644 index e64f80770..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/metrics-server/parameters.tfvars +++ /dev/null @@ -1,37 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# Kubernetes namespace -namespace = "kube-system" - -# metrics server info -docker_image = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/metrics-server" - tag = "v0.6.2" -} - -# Image pull secret -image_pull_secrets = "" - -# node selector -node_selector = { service = "monitoring" } - -# args -args = [ - "--cert-dir=/tmp", - "--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname", - "--kubelet-use-node-status-port", - "--metric-resolution=15s" -] - -# Host network -host_network = false - -# Repository of helm chart -helm_chart_repository = "https://kubernetes-sigs.github.io/metrics-server/" - -# Version of helm chart -helm_chart_version = "3.8.3" \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/providers.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/providers.tf deleted file mode 100644 index 882c7d3ce..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/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/aws-benchmark/metrics-server/variables.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/variables.tf deleted file mode 100644 index 693504453..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/metrics-server/variables.tf +++ /dev/null @@ -1,78 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# Kubeconfig path -variable "k8s_config_path" { - description = "Path of the configuration file of K8s" - type = string - default = "~/.kube/config" -} - -# Kubeconfig context -variable "k8s_config_context" { - description = "Context of K8s" - type = string - default = "default" -} - -# Kubernetes namespace -variable "namespace" { - description = "Kubernetes namespace for metrics server" - type = string -} - -# Docker image -variable "docker_image" { - description = "Docker image for metrics server" - type = object({ - image = string - tag = string - }) -} - -# image pull secrets -variable "image_pull_secrets" { - description = "image_pull_secrets for metrics server" - type = string -} - -# Node selector -variable "node_selector" { - description = "Node selector for metrics server" - type = any -} - -# Args -variable "args" { - description = "Arguments for metrics server" - type = list(string) -} - -# Host network -variable "host_network" { - description = "Host network for metrics server" - type = bool -} - -# Repository of helm chart -variable "helm_chart_repository" { - description = "Path to helm chart repository for metrics server" - type = string -} - -# Version of helm chart -variable "helm_chart_version" { - description = "Version of chart helm for metrics server" - type = string -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/metrics-server/versions.tf b/infrastructure/quick-deploy/aws-benchmark/metrics-server/versions.tf deleted file mode 100644 index e69de29bb..000000000 diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile b/infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile deleted file mode 100644 index f21efd37b..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=monitoring-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/monitoring-output.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export SUFFIX?=main -export REGION?=eu-west-3 -export PROFILE?=default -export NAMESPACE?=armonik -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) -export EKS_PARAMETERS_FILE?=$(CURRENT_DIR)/../eks/generated/eks-output.json -export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var-file $(EKS_PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"monitoring\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json monitoring >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var-file $(EKS_PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf deleted file mode 100644 index 3228617a4..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "monitoring-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "monitoring" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf deleted file mode 100644 index c7e3d7201..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/iam.tf +++ /dev/null @@ -1,61 +0,0 @@ -# Send logs in cloudwatch -data "aws_iam_policy_document" "send_logs_from_fluent_bit_to_cloudwatch_document" { - count = (local.cloudwatch_enabled ? 1 : 0) - statement { - sid = "SendLogsFromFluentBitToCloudWatch" - actions = [ - "logs:CreateLogStream", - "logs:CreateLogGroup", - "logs:PutLogEvents", - ] - effect = "Allow" - resources = [ - "arn:aws:logs:${var.region}:${data.aws_caller_identity.current.account_id}:log-group:${local.cloudwatch_log_group_name}:*" - ] - } -} - -resource "aws_iam_policy" "send_logs_from_fluent_bit_to_cloudwatch_policy" { - count = (local.cloudwatch_enabled ? 1 : 0) - name_prefix = "send-logs-from-fluent-bit-to-cloudwatch-${var.eks.cluster_name}" - description = "Policy for allowing send logs from fluent-bit ${var.eks.cluster_name} to cloudwatch" - policy = data.aws_iam_policy_document.send_logs_from_fluent_bit_to_cloudwatch_document.0.json - tags = local.tags -} - -resource "aws_iam_policy_attachment" "send_logs_from_fluent_bit_to_cloudwatch_attachment" { - count = (local.cloudwatch_enabled ? 1 : 0) - name = "send-logs-from-fluent-bit-to-cloudwatch-${var.eks.cluster_name}" - policy_arn = aws_iam_policy.send_logs_from_fluent_bit_to_cloudwatch_policy.0.arn - roles = var.eks.worker_iam_role_names -} - -# Write objects in S3 -data "aws_iam_policy_document" "write_object" { - count = (local.s3_enabled ? 1 : 0) - statement { - sid = "WriteFromS3" - actions = [ - "s3:PutObject" - ] - effect = "Allow" - resources = [ - "${var.monitoring.s3.arn}/*" - ] - } -} - -resource "aws_iam_policy" "write_object" { - count = (local.s3_enabled ? 1 : 0) - name_prefix = "s3-logs-write-${var.eks.cluster_name}" - description = "Policy for allowing read object in S3 logs ${var.eks.cluster_name}" - policy = data.aws_iam_policy_document.write_object[0].json - tags = local.tags -} - -resource "aws_iam_policy_attachment" "write_object" { - count = (local.s3_enabled ? 1 : 0) - name = "s3-logs-write-${var.eks.cluster_name}" - policy_arn = aws_iam_policy.write_object[0].arn - roles = var.eks.worker_iam_role_names -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf deleted file mode 100644 index dfd5812ca..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/locals.tf +++ /dev/null @@ -1,99 +0,0 @@ -data "aws_caller_identity" "current" {} - -resource "random_string" "random_resources" { - length = 5 - special = false - upper = false - numeric = true -} - -resource "time_static" "creation_date" {} - -locals { - random_string = random_string.random_resources.result - suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string - kms_name = "armonik-kms-monitoring-${local.suffix}-${local.random_string}" - cloudwatch_log_group_name = "/aws/containerinsights/${var.eks.cluster_name}/application" - tags = merge(var.tags, { - "application" = "armonik" - "deployment version" = local.suffix - "created by" = data.aws_caller_identity.current.arn - "creation date" = time_static.creation_date.rfc3339 - }) - - # Seq - seq_enabled = tobool(try(var.monitoring.seq.enabled, false)) - seq_image = try(var.monitoring.seq.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/seq") - seq_tag = try(var.monitoring.seq.tag, "2021.4") - seq_port = try(var.monitoring.seq.port, 8080) - seq_image_pull_secrets = try(var.monitoring.seq.image_pull_secrets, "") - seq_service_type = try(var.monitoring.seq.service_type, "LoadBalancer") - seq_node_selector = try(var.monitoring.seq.node_selector, {}) - seq_system_ram_target = try(var.monitoring.seq.system_ram_target, 0.2) - cli_seq_image = try(var.monitoring.seq.cli_image, "datalust/seqcli") - cli_seq_tag = try(var.monitoring.seq.cli_tag, "2021.4") - cli_seq_image_pull_secrets = try(var.monitoring.seq.cli_image_pull_secrets, "") - retention_in_days = try(var.monitoring.seq.retention_in_days, "2d") - - # Grafana - grafana_enabled = tobool(try(var.monitoring.grafana.enabled, false)) - grafana_image = try(var.monitoring.grafana.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/grafana") - grafana_tag = try(var.monitoring.grafana.tag, "latest") - grafana_port = try(var.monitoring.grafana.port, 3000) - grafana_image_pull_secrets = try(var.monitoring.grafana.image_pull_secrets, "") - grafana_service_type = try(var.monitoring.grafana.service_type, "LoadBalancer") - grafana_node_selector = try(var.monitoring.grafana.node_selector, {}) - - # node exporter - node_exporter_enabled = tobool(try(var.monitoring.node_exporter.enabled, false)) - node_exporter_image = try(var.monitoring.node_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/node-exporter") - node_exporter_tag = try(var.monitoring.node_exporter.tag, "latest") - node_exporter_image_pull_secrets = try(var.monitoring.node_exporter.image_pull_secrets, "") - node_exporter_node_selector = try(var.monitoring.node_exporter.node_selector, {}) - - # Prometheus - prometheus_image = try(var.monitoring.prometheus.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/prometheus") - prometheus_tag = try(var.monitoring.prometheus.tag, "latest") - prometheus_image_pull_secrets = try(var.monitoring.prometheus.image_pull_secrets, "") - prometheus_service_type = try(var.monitoring.prometheus.service_type, "ClusterIP") - prometheus_node_exporter_image = try(var.monitoring.prometheus.node_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/node-exporter") - prometheus_node_exporter_tag = try(var.monitoring.prometheus.node_exporter.tag, "latest") - prometheus_node_selector = try(var.monitoring.prometheus.node_selector, {}) - - # Metrics exporter - metrics_exporter_image = try(var.monitoring.metrics_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/metrics-exporter") - metrics_exporter_tag = try(var.monitoring.metrics_exporter.tag, "0.11.1") - metrics_exporter_image_pull_secrets = try(var.monitoring.metrics_exporter.image_pull_secrets, "") - metrics_exporter_service_type = try(var.monitoring.metrics_exporter.service_type, "ClusterIP") - metrics_exporter_node_selector = try(var.monitoring.metrics_exporter.node_selector, {}) - metrics_exporter_extra_conf = try(var.monitoring.metrics_exporter.extra_conf, {}) - - # Partition metrics exporter - partition_metrics_exporter_image = try(var.monitoring.partition_metrics_exporter.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/partition-metrics-exporter") - partition_metrics_exporter_tag = try(var.monitoring.partition_metrics_exporter.tag, "0.11.1") - partition_metrics_exporter_image_pull_secrets = try(var.monitoring.partition_metrics_exporter.image_pull_secrets, "") - partition_metrics_exporter_service_type = try(var.monitoring.partition_metrics_exporter.service_type, "ClusterIP") - partition_metrics_exporter_node_selector = try(var.monitoring.partition_metrics_exporter.node_selector, {}) - partition_metrics_exporter_extra_conf = try(var.monitoring.partition_metrics_exporter.extra_conf, {}) - - # CloudWatch - cloudwatch_enabled = tobool(try(var.monitoring.cloudwatch.enabled, false)) - cloudwatch_kms_key_id = try(var.monitoring.cloudwatch.kms_key_id, "") - cloudwatch_retention_in_days = tonumber(try(var.monitoring.cloudwatch.retention_in_days, 30)) - - # Fluent-bit - fluent_bit_image = try(var.monitoring.fluent_bit.image, "${data.aws_caller_identity.current.id}.dkr.ecr.eu-west-3.amazonaws.com/fluent-bit") - fluent_bit_tag = try(var.monitoring.fluent_bit.tag, "1.3.11") - fluent_bit_image_pull_secrets = try(var.monitoring.fluent_bit.image_pull_secrets, "") - fluent_bit_is_daemonset = tobool(try(var.monitoring.fluent_bit.is_daemonset, false)) - fluent_bit_http_port = tonumber(try(var.monitoring.fluent_bit.http_port, 0)) - fluent_bit_read_from_head = tobool(try(var.monitoring.fluent_bit.read_from_head, true)) - fluent_bit_node_selector = try(var.monitoring.fluent_bit.node_selector, {}) - fluent_bit_parser = try(var.monitoring.fluent_bit.parser, "cri") - - # S3 for logs - s3_enabled = tobool(try(var.monitoring.s3.enabled, false)) - s3_name = try(var.monitoring.s3.name, "armonik-logs") - s3_region = try(var.monitoring.s3.region, "eu-west-3") - s3_prefix = try(var.monitoring.s3.prefix, "main") -} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf deleted file mode 100644 index 0810e6048..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/main.tf +++ /dev/null @@ -1,164 +0,0 @@ -# AWS KMS -module "kms" { - count = (local.cloudwatch_kms_key_id == "" && local.cloudwatch_enabled ? 1 : 0) - source = "../generated/infra-modules/utils/aws/kms" - name = local.kms_name - tags = local.tags -} - -# Seq -module "seq" { - count = (local.seq_enabled ? 1 : 0) - source = "../generated/infra-modules/monitoring/onpremise/seq" - namespace = var.namespace - service_type = local.seq_service_type - port = local.seq_port - node_selector = local.seq_node_selector - docker_image = { - image = local.seq_image - tag = local.seq_tag - image_pull_secrets = local.seq_image_pull_secrets - } - docker_image_cron = { - image = local.cli_seq_image - 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 -} - -# node exporter -module "node_exporter" { - count = (local.node_exporter_enabled ? 1 : 0) - source = "../generated/infra-modules/monitoring/onpremise/exporters/node-exporter" - namespace = var.namespace - node_selector = local.node_exporter_node_selector - docker_image = { - image = local.node_exporter_image - 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 - 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}/../../.." -} - -# Partition metrics exporter -#module "partition_metrics_exporter" { -# source = "../generated/infra-modules/monitoring/onpremise/exporters/partition-metrics-exporter" -# namespace = var.namespace -# service_type = local.partition_metrics_exporter_service_type -# node_selector = local.partition_metrics_exporter_node_selector -# 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 -# tag = local.partition_metrics_exporter_tag -# 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 - #"${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 - ] -} - -# Grafana -module "grafana" { - count = (local.grafana_enabled ? 1 : 0) - source = "../generated/infra-modules/monitoring/onpremise/grafana" - namespace = var.namespace - service_type = local.grafana_service_type - port = local.grafana_port - node_selector = local.grafana_node_selector - prometheus_url = module.prometheus.url - docker_image = { - image = local.grafana_image - tag = local.grafana_tag - image_pull_secrets = local.grafana_image_pull_secrets - } - working_dir = "${path.root}/../../.." - authentication = var.authentication - depends_on = [module.prometheus] -} - -# CloudWatch -module "cloudwatch" { - count = (local.cloudwatch_enabled ? 1 : 0) - source = "../generated/infra-modules/monitoring/aws/cloudwatch-log-group" - name = local.cloudwatch_log_group_name - kms_key_id = (local.cloudwatch_kms_key_id != "" ? local.cloudwatch_kms_key_id : module.kms.0.arn) - retention_in_days = local.cloudwatch_retention_in_days - tags = local.tags -} - -# Fluent-bit -module "fluent_bit" { - source = "../generated/infra-modules/monitoring/onpremise/fluent-bit" - namespace = var.namespace - node_selector = local.fluent_bit_node_selector - fluent_bit = { - container_name = "fluent-bit" - image = local.fluent_bit_image - tag = local.fluent_bit_tag - image_pull_secrets = local.fluent_bit_image_pull_secrets - is_daemonset = local.fluent_bit_is_daemonset - parser = local.fluent_bit_parser - http_server = (local.fluent_bit_http_port == 0 ? "Off" : "On") - http_port = (local.fluent_bit_http_port == 0 ? "" : tostring(local.fluent_bit_http_port)) - read_from_head = (local.fluent_bit_read_from_head ? "On" : "Off") - read_from_tail = (local.fluent_bit_read_from_head ? "Off" : "On") - } - seq = (local.seq_enabled ? { - host = module.seq.0.host - port = module.seq.0.port - enabled = true - } : {}) - cloudwatch = (local.cloudwatch_enabled ? { - name = module.cloudwatch.0.name - region = var.region - enabled = true - } : {}) - s3 = (local.s3_enabled ? { - name = local.s3_name - region = local.s3_region - prefix = local.s3_prefix - enabled = true - } : {}) -} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf deleted file mode 100644 index eedd4e195..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/outputs.tf +++ /dev/null @@ -1,52 +0,0 @@ -output "monitoring" { - description = "Monitoring endpoint URLs" - value = { - seq = (local.seq_enabled ? { - host = module.seq.0.host - port = module.seq.0.port - url = module.seq.0.url - web_url = module.seq.0.web_url - enabled = true - } : {}) - grafana = (local.grafana_enabled ? { - host = module.grafana.0.host - port = module.grafana.0.port - url = module.grafana.0.url - enabled = true - } : {}) - prometheus = { - host = module.prometheus.host - port = module.prometheus.port - url = module.prometheus.url - } - metrics_exporter = { - name = module.metrics_exporter.name - host = module.metrics_exporter.host - port = module.metrics_exporter.port - url = module.metrics_exporter.url - namespace = module.metrics_exporter.namespace - } - partition_metrics_exporter = { - name = null #module.partition_metrics_exporter.name - host = null #module.partition_metrics_exporter.host - port = null #module.partition_metrics_exporter.port - url = null #module.partition_metrics_exporter.url - namespace = null #module.partition_metrics_exporter.namespace - } - cloudwatch = (local.cloudwatch_enabled ? { - name = module.cloudwatch.0.name - region = var.region - enabled = true - } : {}) - fluent_bit = { - container_name = module.fluent_bit.container_name - image = module.fluent_bit.image - tag = module.fluent_bit.tag - is_daemonset = module.fluent_bit.is_daemonset - configmaps = { - envvars = module.fluent_bit.configmaps.envvars - config = module.fluent_bit.configmaps.config - } - } - } -} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars deleted file mode 100644 index c6be76bfc..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/parameters.tfvars +++ /dev/null @@ -1,136 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# Kubeconfig path -k8s_config_path = "~/.kube/config" - -# Kubeconfig context -k8s_config_context = "default" - -# Kubernetes namespace -namespace = "armonik" - -# SUFFIX -suffix = "main" - -tags = { - "name" = "" - "env" = "" - "entity" = "" - "bu" = "" - "owner" = "" - "application code" = "" - "project code" = "" - "cost center" = "" - "Support Contact" = "" - "origin" = "terraform" - "unit of measure" = "" - "epic" = "" - "functional block" = "" - "hostname" = "" - "interruptible" = "" - "tostop" = "" - "tostart" = "" - "branch" = "" - "gridserver" = "" - "it division" = "" - "Confidentiality" = "" - "csp" = "aws" - "grafanaserver" = "" - "Terraform" = "true" - "DST_Update" = "" -} - -# Monitoring infos -monitoring = { - seq = { - enabled = true - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/seq" - tag = "2023.1" - port = 8080 - image_pull_secrets = "" - service_type = "ClusterIP" - node_selector = { service = "monitoring" } - system_ram_target = 0.2 - cli_image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/seqcli" - cli_tag = "2023.1" - cli_image_pull_secrets = "" - retention_in_days = "2d" - } - grafana = { - enabled = true - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/grafana" - tag = "9.3.6" - port = 3000 - image_pull_secrets = "" - service_type = "ClusterIP" - node_selector = { service = "monitoring" } - } - node_exporter = { - enabled = true - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/node-exporter" - tag = "v1.5.0" - image_pull_secrets = "" - node_selector = {} - } - prometheus = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/prometheus" - tag = "v2.42.0" - image_pull_secrets = "" - service_type = "ClusterIP" - node_selector = { service = "metrics" } - } - metrics_exporter = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/metrics-exporter" - tag = "0.14.3" - image_pull_secrets = "" - service_type = "ClusterIP" - node_selector = { service = "metrics" } - extra_conf = { - MongoDB__AllowInsecureTls = true - Serilog__MinimumLevel = "Information" - MongoDB__TableStorage__PollingDelayMin = "00:00:01" - MongoDB__TableStorage__PollingDelayMax = "00:00:10" - } - } - partition_metrics_exporter = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/partition-metrics-exporter" - tag = "0.14.3" - image_pull_secrets = "" - service_type = "ClusterIP" - node_selector = { service = "metrics" } - extra_conf = { - MongoDB__AllowInsecureTls = true - Serilog__MinimumLevel = "Information" - MongoDB__TableStorage__PollingDelayMin = "00:00:01" - MongoDB__TableStorage__PollingDelayMax = "00:00:10" - } - } - cloudwatch = { - enabled = true - kms_key_id = "" - retention_in_days = 30 - } - s3 = { - enabled = true - name = "armonik-logs" - region = "eu-west-3" - prefix = "main" - arn = "arn:aws:s3:::armonik-logs" - } - fluent_bit = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/fluent-bit" - tag = "2.0.9" - image_pull_secrets = "" - is_daemonset = true - http_port = 2020 # 0 or 2020 - read_from_head = true - node_selector = {} - parser = "cri" - } -} - -authentication = false diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf deleted file mode 100644 index 6e2dbd516..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/providers.tf +++ /dev/null @@ -1,24 +0,0 @@ -provider "aws" { - region = var.region - profile = var.profile -} - -# 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/aws-benchmark/monitoring/secrets.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/secrets.tf deleted file mode 100644 index 24eb17dda..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/secrets.tf +++ /dev/null @@ -1,92 +0,0 @@ -resource "kubernetes_secret" "metrics_exporter" { - metadata { - name = "metrics-exporter" - namespace = var.namespace - } - data = { - name = module.metrics_exporter.name - host = module.metrics_exporter.host - port = module.metrics_exporter.port - url = module.metrics_exporter.url - namespace = module.metrics_exporter.namespace - } -} - -resource "kubernetes_secret" "partition_metrics_exporter" { - metadata { - name = "partition-metrics-exporter" - namespace = var.namespace - } - data = { - name = null #module.partition_metrics_exporter.name - host = null #module.partition_metrics_exporter.host - port = null #module.partition_metrics_exporter.port - url = null #module.partition_metrics_exporter.url - namespace = null #module.partition_metrics_exporter.namespace - } -} - -resource "kubernetes_secret" "fluent_bit" { - metadata { - name = "fluent-bit" - namespace = var.namespace - } - data = { - is_daemonset = module.fluent_bit.is_daemonset - name = module.fluent_bit.container_name - image = module.fluent_bit.image - tag = module.fluent_bit.tag - envvars = module.fluent_bit.configmaps.envvars - config = module.fluent_bit.configmaps.config - } -} - -resource "kubernetes_secret" "prometheus" { - metadata { - name = "prometheus" - namespace = var.namespace - } - data = { - host = module.prometheus.host - port = module.prometheus.port - url = module.prometheus.url - } -} - -resource "kubernetes_secret" "seq" { - metadata { - name = "seq" - namespace = var.namespace - } - data = local.seq_enabled ? { - host = module.seq.0.host - port = module.seq.0.port - url = module.seq.0.url - web_url = module.seq.0.web_url - enabled = true - } : { - host = null - port = null - url = null - web_url = null - enabled = false - } -} - -resource "kubernetes_secret" "grafana" { - metadata { - name = "grafana" - namespace = var.namespace - } - data = local.grafana_enabled ? { - host = module.grafana.0.host - port = module.grafana.0.port - url = module.grafana.0.url - enabled = true - } : { - host = null - port = null - url = null - enabled = false - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf deleted file mode 100644 index 9765ae3b9..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/variables.tf +++ /dev/null @@ -1,151 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# Kubeconfig path -variable "k8s_config_path" { - description = "Path of the configuration file of K8s" - type = string - default = "~/.kube/config" -} - -# Kubeconfig context -variable "k8s_config_context" { - description = "Context of K8s" - type = string - default = "default" -} - -# SUFFIX -variable "suffix" { - description = "To suffix the AWS resources" - type = string - default = "" -} - -# AWS TAGs -variable "tags" { - description = "Tags for AWS resources" - type = any - default = {} -} - -# Kubernetes namespace -variable "namespace" { - description = "Kubernetes namespace for ArmoniK" - type = string - default = "armonik" -} - -# EKS info -variable "eks" { - description = "EKS info" - type = any - default = {} -} - -# List of needed storage -variable "storage_endpoint_url" { - description = "List of storage needed by ArmoniK" - type = any - default = {} -} - -# Monitoring infos -variable "monitoring" { - description = "Monitoring infos" - type = object({ - seq = object({ - enabled = bool - image = string - tag = string - port = number - image_pull_secrets = string - service_type = string - node_selector = any - system_ram_target = number - cli_image = string - cli_tag = string - cli_image_pull_secrets = string - retention_in_days = string - }) - grafana = object({ - enabled = bool - image = string - tag = string - port = number - image_pull_secrets = string - service_type = string - node_selector = any - }) - node_exporter = object({ - enabled = bool - image = string - tag = string - image_pull_secrets = string - node_selector = any - }) - prometheus = object({ - image = string - tag = string - image_pull_secrets = string - service_type = string - node_selector = any - }) - metrics_exporter = object({ - image = string - tag = string - image_pull_secrets = string - service_type = string - node_selector = any - extra_conf = map(string) - }) - partition_metrics_exporter = object({ - image = string - tag = string - image_pull_secrets = string - service_type = string - node_selector = any - extra_conf = map(string) - }) - cloudwatch = object({ - enabled = bool - kms_key_id = string - retention_in_days = number - }) - s3 = object({ - enabled = bool - name = string - region = string - arn = string - prefix = string - }) - fluent_bit = object({ - image = string - tag = string - image_pull_secrets = string - is_daemonset = bool - http_port = number - read_from_head = string - node_selector = any - parser = string - }) - }) -} - -# Enable authentication of seq and grafana -variable "authentication" { - description = "Enable authentication form in seq and grafana" - type = bool - default = false -} diff --git a/infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf b/infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf deleted file mode 100644 index 234dc9186..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/monitoring/versions.tf +++ /dev/null @@ -1,16 +0,0 @@ -terraform { - required_providers { - external = { - source = "hashicorp/external" - version = "~> 2.2.0" - } - kubernetes = { - source = "hashicorp/kubernetes" - version = "~> 2.13.0" - } - local = { - source = "hashicorp/local" - version = "~> 2.1.0" - } - } -} diff --git a/infrastructure/quick-deploy/aws-benchmark/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/parameters.tfvars new file mode 100644 index 000000000..f2e324e69 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/parameters.tfvars @@ -0,0 +1,641 @@ +# Tags +tags = { + "name" = "" + "env" = "" + "entity" = "" + "bu" = "" + "owner" = "" + "application code" = "" + "project code" = "" + "cost center" = "" + "Support Contact" = "" + "origin" = "terraform" + "unit of measure" = "" + "epic" = "" + "functional block" = "" + "hostname" = "" + "interruptible" = "" + "tostop" = "" + "tostart" = "" + "branch" = "" + "gridserver" = "" + "it division" = "" + "Confidentiality" = "" + "csp" = "aws" + "grafanaserver" = "" + "Terraform" = "true" + "DST_Update" = "" +} + +vpc = { + enable_private_subnet = false +} + +# AWS EKS +eks = { + cluster_version = "1.25" + node_selector = { service = "monitoring" } + cluster_endpoint_public_access = true + map_roles = [] + map_users = [] +} + +# List of EKS managed node groups +eks_managed_node_groups = { + # Default node group for workers of ArmoniK + workers = { + name = "workers" + launch_template_description = "Node group for ArmoniK Compute-plane pods" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "SPOT" + min_size = 0 + desired_size = 0 + max_size = 1000 + labels = { + service = "workers" + "node.kubernetes.io/lifecycle" = "spot" + } + taints = { + dedicated = { + key = "service" + value = "workers" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for metrics: Metrics exporter and Prometheus + metrics = { + name = "metrics" + launch_template_description = "Node group for metrics: Metrics exporter and Prometheus" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 5 + labels = { + service = "metrics" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "metrics" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for ArmoniK control-plane: control-plane and Ingress + control_plane = { + name = "control-plane" + launch_template_description = "Node group for ArmoniK Control-plane and Ingress" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 10 + labels = { + service = "control-plane" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "control-plane" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for monitoring: metrics server, keda, seq, grafana, cluster-autoscaler, coreDNS, termination handler + monitoring = { + name = "monitoring" + launch_template_description = "Node group for monitoring" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 5 + labels = { + service = "monitoring" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "monitoring" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for data-plane + # state_database, inner_storage, task_queue + state_database = { + name = "mongodb" + launch_template_description = "Node group for MongoDB" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + use_custom_launch_template = true + block_device_mappings = { + xvda = { + device_name = "/dev/xvda" + ebs = { + volume_size = 75 + volume_type = "gp3" + iops = 3000 + throughput = 150 + encrypted = null + kms_key_id = null + delete_on_termination = true + } + } + } + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 10 + labels = { + service = "state-database" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "state-database" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } +} + +# List of self managed node groups +self_managed_node_groups = { + others = { + name = "others" + launch_template_description = "Node group for others" + instance_type = "c5.24xlarge" + min_size = 0 + desired_size = 0 + max_size = 5 + force_delete = true + force_delete_warm_pool = true + instance_market_options = { + market_type = "spot" + } + bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'" + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + others_mixed = { + name = "others-mixed" + launch_template_description = "Mixed On demand and SPOT instances for other pods" + min_size = 0 + desired_size = 0 + max_size = 5 + use_mixed_instances_policy = true + mixed_instances_policy = { + on_demand_allocation_strategy = "lowest-price" + on_demand_base_capacity = 0 + on_demand_percentage_above_base_capacity = 20 # 20% On-Demand Instances, 80% Spot Instances + spot_allocation_strategy = "price-capacity-optimized" + spot_instance_pools = null + spot_max_price = null + } + override = [ + { + instance_type = "c5.4xlarge" + weighted_capacity = "1" + }, + { + instance_type = "c5.2xlarge" + weighted_capacity = "2" + }, + ] + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } +} + +# List of fargate profiles +fargate_profiles = {} + +metrics_server = { + node_selector = { service = "monitoring" } +} + +keda = { + node_selector = { service = "monitoring" } +} + +# Object storage +# Uncomment either the `elasticache` or the `s3_os` parameter +elasticache = { + engine = "redis" + engine_version = "6.x" + node_type = "cache.r4.large" + num_cache_clusters = 2 +} + +#s3_os = {} + +mq = { + engine_type = "ActiveMQ" + engine_version = "5.16.4" + host_instance_type = "mq.m5.xlarge" +} + +mongodb = { + node_selector = { service = "state-database" } + #persistent_volume = { + # storage_provisioner = "efs.csi.aws.com" + # resources = { + # requests = { + # storage = "5Gi" + # } + # } + #} +} + +pv_efs = { + csi_driver = { + node_selector = { service = "state-database" } + } +} + +seq = { + node_selector = { service = "monitoring" } +} + +grafana = { + node_selector = { service = "monitoring" } +} + +node_exporter = { + node_selector = {} +} + +prometheus = { + node_selector = { service = "metrics" } +} + +metrics_exporter = { + node_selector = { service = "metrics" } + extra_conf = { + MongoDB__AllowInsecureTls = true + Serilog__MinimumLevel = "Information" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + } +} + +/*parition_metrics_exporter = { + node_selector = { service = "metrics" } + extra_conf = { + MongoDB__AllowInsecureTls = true + Serilog__MinimumLevel = "Information" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + } +}*/ + +fluent_bit = { + is_daemonset = true + node_selector = {} +} + +# Logging level +logging_level = "Information" + +# Parameters of control plane +control_plane = { + limits = { + cpu = "1000m" + memory = "2048Mi" + } + requests = { + cpu = "200m" + memory = "500Mi" + } + default_partition = "default" + node_selector = { service = "control-plane" } +} + +# Parameters of admin GUI +admin_gui = { + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + node_selector = { service = "monitoring" } +} + +# Parameters of old admin GUI +admin_old_gui = { + api = { + name = "admin-api" + port = 3333 + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + } + old = { + name = "admin-old-gui" + port = 1080 + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + } + service_type = "ClusterIP" + replicas = 1 + image_pull_policy = "IfNotPresent" + image_pull_secrets = "" + node_selector = { service = "monitoring" } +} + +# Parameters of the compute plane +compute_plane = { + # Default partition that uses the C# extension for the worker + default = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 1 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_worker_dll" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 1 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + # Partition for the stream worker + stream = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 1 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_core_stream_test_worker" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 1 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + # Partition for the htcmock worker + htcmock = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 100 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_core_htcmock_test_worker" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 100 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + # Partition for the bench worker + bench = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 100 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_core_bench_test_worker" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 100 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, +} + +# Deploy ingress +# PS: to not deploy ingress put: "ingress=null" +ingress = { + tls = false + mtls = false + generate_client_cert = false + node_selector = { service = "control-plane" } +} + +# Job to insert partitions in the database +job_partitions_in_database = { + node_selector = { service = "control-plane" } +} + +# Authentication behavior +authentication = { + node_selector = { service = "control-plane" } +} + +extra_conf = { + core = { + Amqp__AllowHostMismatch = false + Amqp__MaxPriority = "10" + Amqp__MaxRetries = "5" + Amqp__QueueStorage__LockRefreshPeriodicity = "00:00:45" + Amqp__QueueStorage__PollPeriodicity = "00:00:10" + Amqp__QueueStorage__LockRefreshExtension = "00:02:00" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + MongoDB__TableStorage__PollingDelay = "00:00:01" + MongoDB__DataRetention = "10.00:00:00" + MongoDB__AllowInsecureTls = true + Redis__Timeout = 3000 + Redis__SslHost = "" + } + control = { + Submitter__MaxErrorAllowed = 50 + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/Makefile b/infrastructure/quick-deploy/aws-benchmark/storage/Makefile deleted file mode 100644 index 5cde02f55..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=storage-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/storage-output.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export SUFFIX?=main -export REGION?=eu-west-3 -export PROFILE?=default -export NAMESPACE?=armonik -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) -export KUBECONFIG?=$(GENERATED_DIR)/eks/kubeconfig -export VPC_PARAMETERS_FILE?=$(CURRENT_DIR)/../vpc/generated/vpc-output.json -export EKS_PARAMETERS_FILE?=$(CURRENT_DIR)/../eks/generated/eks-output.json - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var-file $(VPC_PARAMETERS_FILE) \ - -var-file $(EKS_PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"storage_endpoint_url\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json storage_endpoint_url >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var-file $(VPC_PARAMETERS_FILE) \ - -var-file $(EKS_PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'namespace=$(NAMESPACE)' \ - -var 'k8s_config_path=$(KUBECONFIG)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/backend.tf b/infrastructure/quick-deploy/aws-benchmark/storage/backend.tf deleted file mode 100644 index a6c983004..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "storage-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "storage" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/locals.tf b/infrastructure/quick-deploy/aws-benchmark/storage/locals.tf deleted file mode 100644 index ef7c1a9eb..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/locals.tf +++ /dev/null @@ -1,72 +0,0 @@ -# Current account -data "aws_caller_identity" "current" {} - -# Random alphanumeric -resource "random_string" "random_resources" { - length = 5 - special = false - upper = false - numeric = true -} - -resource "time_static" "creation_date" {} - -locals { - random_string = random_string.random_resources.result - suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string - iam_s3_decrypt_object_policy_name = "s3-encrypt-decrypt-${var.eks.cluster_name}" - iam_s3_read_object_policy_name = "s3-read-${var.eks.cluster_name}" - iam_s3_decrypt_s3_storage_object_policy_name = "s3-storage-object-encrypt-decrypt-${var.eks.cluster_name}" - kms_name = "armonik-kms-storage-${local.suffix}-${local.random_string}" - s3_fs_name = "${var.s3_fs.name}-${local.suffix}" - s3_os_name = var.s3_os != null ? "${var.s3_os.name}-${local.suffix}" : "" - elasticache_name = var.elasticache != null ? "${var.elasticache.name}-${local.suffix}" : "" - mq_name = "${var.mq.name}-${local.suffix}" - efs_name = "${var.pv_efs.efs.name}-${local.suffix}" - efs_csi_name = "efs-csi-driver-${local.suffix}" - persistent_volume = (try(var.mongodb.persistent_volume.storage_provisioner, "") == "efs.csi.aws.com" ? { - storage_provisioner = var.mongodb.persistent_volume.storage_provisioner - resources = var.mongodb.persistent_volume.resources - parameters = merge(var.mongodb.persistent_volume.parameters, { - provisioningMode = "efs-ap" - fileSystemId = module.efs_persistent_volume.0.efs_id - directoryPerms = "755" - gidRangeStart = "999" # optional - gidRangeEnd = "2000" # optional - basePath = "/mongodb" # optional - }) - } : null) - - tags = merge(var.tags, { - "application" = "armonik" - "deployment version" = local.suffix - "created by" = data.aws_caller_identity.current.arn - "creation date" = time_static.creation_date.rfc3339 - }) - s3_fs_kms_key_id = (var.s3_fs.kms_key_id != "" ? var.s3_fs.kms_key_id : module.kms.0.arn) - s3_os_kms_key_id = (can(coalesce(var.s3_os.kms_key_id)) ? var.s3_os.kms_key_id : module.kms.0.arn) - vpc = { - id = try(var.vpc.id, "") - cidr_block_private = var.vpc.cidr_block_private - cidr_blocks = concat([try(var.vpc.cidr_block, "")], try(var.vpc.pod_cidr_block_private, [])) - subnet_ids = try(var.vpc.private_subnet_ids, []) - } - - # Deployed storage - deployed_object_storages = concat( - length(module.elasticache) > 0 ? ["Redis"] : [], - length(module.s3_os) > 0 ? ["S3"] : [], - ) - deployed_table_storages = ["MongoDB"] - deployed_queue_storages = ["Amqp"] - - # Storage adapters - object_storage_adapter = try(coalesce( - length(module.elasticache) > 0 ? "Redis" : null, - length(module.s3_os) > 0 ? "S3" : null, - ), "") - table_storage_adapter = "MongoDB" - queue_storage_adapter = "Amqp" - adapter_class_name = module.mq.engine_type == "ActiveMQ" ? "ArmoniK.Core.Adapters.Amqp.QueueBuilder" : "ArmoniK.Core.Adapters.RabbitMQ.QueueBuilder" - adapter_absolute_path = module.mq.engine_type == "ActiveMQ" ? "/adapters/queue/amqp/ArmoniK.Core.Adapters.Amqp.dll" : "/adapters/queue/rabbit/ArmoniK.Core.Adapters.RabbitMQ.dll" -} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/main.tf b/infrastructure/quick-deploy/aws-benchmark/storage/main.tf deleted file mode 100644 index ca9259774..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/main.tf +++ /dev/null @@ -1,162 +0,0 @@ -# AWS KMS -module "kms" { - count = (can(coalesce(var.s3_fs.kms_key_id)) && can(coalesce(var.elasticache.encryption_keys.kms_key_id)) && can(coalesce(var.elasticache.encryption_keys.log_kms_key_id)) && can(coalesce(var.s3_os.kms_key_id)) && can(coalesce(var.mq.kms_key_id)) ? 0 : 1) - source = "../generated/infra-modules/utils/aws/kms" - name = local.kms_name - tags = local.tags -} - -# AWS S3 as shared storage -module "s3_fs" { - source = "../generated/infra-modules/storage/aws/s3" - tags = local.tags - name = local.s3_fs_name - s3 = { - policy = var.s3_fs.policy - attach_policy = var.s3_fs.attach_policy - attach_deny_insecure_transport_policy = var.s3_fs.attach_deny_insecure_transport_policy - attach_require_latest_tls_policy = var.s3_fs.attach_require_latest_tls_policy - attach_public_policy = var.s3_fs.attach_public_policy - block_public_acls = var.s3_fs.attach_public_policy - block_public_policy = var.s3_fs.block_public_acls - ignore_public_acls = var.s3_fs.block_public_policy - restrict_public_buckets = var.s3_fs.restrict_public_buckets - kms_key_id = local.s3_fs_kms_key_id - sse_algorithm = (var.s3_fs.kms_key_id != "" ? var.s3_fs.sse_algorithm : "aws:kms") - ownership = var.s3_fs.ownership - versioning = var.s3_fs.versioning - } -} - -# AWS Elasticache -module "elasticache" { - count = var.elasticache != null ? 1 : 0 - source = "../generated/infra-modules/storage/aws/elasticache" - tags = local.tags - name = local.elasticache_name - vpc = local.vpc - elasticache = { - engine = var.elasticache.engine - engine_version = var.elasticache.engine_version - node_type = var.elasticache.node_type - apply_immediately = var.elasticache.apply_immediately - multi_az_enabled = var.elasticache.multi_az_enabled - automatic_failover_enabled = var.elasticache.automatic_failover_enabled - num_cache_clusters = var.elasticache.num_cache_clusters - preferred_cache_cluster_azs = var.elasticache.preferred_cache_cluster_azs - data_tiering_enabled = var.elasticache.data_tiering_enabled - log_retention_in_days = var.elasticache.log_retention_in_days - cloudwatch_log_groups = var.elasticache.cloudwatch_log_groups - encryption_keys = { - kms_key_id = (var.elasticache.encryption_keys.kms_key_id != "" ? var.elasticache.encryption_keys.kms_key_id : module.kms.0.arn) - log_kms_key_id = (var.elasticache.encryption_keys.log_kms_key_id != "" ? var.elasticache.encryption_keys.log_kms_key_id : module.kms.0.arn) - } - } -} - -# AWS S3 as objects storage -module "s3_os" { - count = var.s3_os != null ? 1 : 0 - source = "../generated/infra-modules/storage/aws/s3" - tags = local.tags - name = local.s3_os_name - s3 = { - policy = var.s3_os.policy - attach_policy = var.s3_os.attach_policy - attach_deny_insecure_transport_policy = var.s3_os.attach_deny_insecure_transport_policy - attach_require_latest_tls_policy = var.s3_os.attach_require_latest_tls_policy - attach_public_policy = var.s3_os.attach_public_policy - block_public_acls = var.s3_os.attach_public_policy - block_public_policy = var.s3_os.block_public_acls - ignore_public_acls = var.s3_os.block_public_policy - restrict_public_buckets = var.s3_os.restrict_public_buckets - kms_key_id = local.s3_os_kms_key_id - sse_algorithm = (var.s3_os.kms_key_id != "" ? var.s3_os.sse_algorithm : "aws:kms") - ownership = var.s3_os.ownership - versioning = var.s3_os.versioning - } -} - -# Amazon MQ -module "mq" { - source = "../generated/infra-modules/storage/aws/mq" - tags = local.tags - name = local.mq_name - namespace = var.namespace - vpc = local.vpc - user = { - password = var.mq_credentials.password - username = var.mq_credentials.username - } - mq = { - engine_type = var.mq.engine_type - engine_version = var.mq.engine_version - host_instance_type = var.mq.host_instance_type - apply_immediately = var.mq.apply_immediately - deployment_mode = var.mq.deployment_mode - storage_type = var.mq.storage_type - authentication_strategy = var.mq.authentication_strategy - publicly_accessible = var.mq.publicly_accessible - kms_key_id = (var.mq.kms_key_id != "" ? var.mq.kms_key_id : module.kms.0.arn) - } -} - -# MongoDB -module "mongodb" { - source = "../generated/infra-modules/storage/onpremise/mongodb" - namespace = var.namespace - working_dir = "${path.root}/../../.." - mongodb = { - image = var.mongodb.image - tag = var.mongodb.tag - node_selector = var.mongodb.node_selector - image_pull_secrets = var.mongodb.image_pull_secrets - replicas_number = var.mongodb.replicas_number - } - persistent_volume = local.persistent_volume - depends_on = [module.efs_persistent_volume] -} - -# AWS EFS as persistent volume -module "efs_persistent_volume" { - count = (try(var.mongodb.persistent_volume.storage_provisioner, "") == "efs.csi.aws.com" ? 1 : 0) - source = "../generated/infra-modules/persistent-volume/aws/efs" - eks_issuer = var.eks.issuer - vpc = local.vpc - efs = { - name = local.efs_name - kms_key_id = (var.pv_efs.efs.kms_key_id != "" && var.pv_efs.efs.kms_key_id != null ? var.pv_efs.efs.kms_key_id : module.kms.0.arn) - performance_mode = var.pv_efs.efs.performance_mode - throughput_mode = var.pv_efs.efs.throughput_mode - provisioned_throughput_in_mibps = var.pv_efs.efs.provisioned_throughput_in_mibps - transition_to_ia = var.pv_efs.efs.transition_to_ia - access_point = var.pv_efs.efs.access_point - } - csi_driver = { - name = local.efs_csi_name - namespace = var.pv_efs.csi_driver.namespace - image_pull_secrets = var.pv_efs.csi_driver.image_pull_secrets - node_selector = var.pv_efs.csi_driver.node_selector - repository = var.pv_efs.csi_driver.repository - version = var.pv_efs.csi_driver.version - docker_images = { - efs_csi = { - image = var.pv_efs.csi_driver.docker_images.efs_csi.image - tag = var.pv_efs.csi_driver.docker_images.efs_csi.tag - } - livenessprobe = { - image = var.pv_efs.csi_driver.docker_images.livenessprobe.image - tag = var.pv_efs.csi_driver.docker_images.livenessprobe.tag - } - node_driver_registrar = { - image = var.pv_efs.csi_driver.docker_images.node_driver_registrar.image - tag = var.pv_efs.csi_driver.docker_images.node_driver_registrar.tag - } - external_provisioner = { - image = var.pv_efs.csi_driver.docker_images.external_provisioner.image - tag = var.pv_efs.csi_driver.docker_images.external_provisioner.tag - } - } - } - tags = local.tags -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf deleted file mode 100644 index 22e108b1e..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/outputs.tf +++ /dev/null @@ -1,35 +0,0 @@ -# Storage -output "storage_endpoint_url" { - description = "Storage endpoints URLs" - value = { - object_storage_adapter = local.object_storage_adapter - table_storage_adapter = local.table_storage_adapter - queue_storage_adapter = local.queue_storage_adapter - deployed_object_storages = local.deployed_object_storages - deployed_table_storages = local.deployed_table_storages - deployed_queue_storages = local.deployed_queue_storages - activemq = { - url = module.mq.activemq_endpoint_url.url - web_url = module.mq.web_url - } - redis = length(module.elasticache) > 0 ? { - url = module.elasticache[0].redis_endpoint_url.url - } : null - s3 = length(module.s3_os) > 0 ? { - url = "https://s3.${var.region}.amazonaws.com" - bucket_name = module.s3_os[0].s3_bucket_name - must_force_path_style = false - kms_key_id = module.s3_os[0].kms_key_id - } : null - mongodb = { - url = module.mongodb.url - number_of_replicas = var.mongodb.replicas_number - } - shared = { - service_url = "https://s3.${var.region}.amazonaws.com" - kms_key_id = module.s3_fs.kms_key_id - name = module.s3_fs.s3_bucket_name - file_storage_type = "S3" - } - } -} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars deleted file mode 100644 index b1c4434ef..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/parameters.tfvars +++ /dev/null @@ -1,176 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# SUFFIX -suffix = "main" - -# AWS TAGs -tags = { - "name" = "" - "env" = "" - "entity" = "" - "bu" = "" - "owner" = "" - "application code" = "" - "project code" = "" - "cost center" = "" - "Support Contact" = "" - "origin" = "terraform" - "unit of measure" = "" - "epic" = "" - "functional block" = "" - "hostname" = "" - "interruptible" = "" - "tostop" = "" - "tostart" = "" - "branch" = "" - "gridserver" = "" - "it division" = "" - "Confidentiality" = "" - "csp" = "aws" - "grafanaserver" = "" - "Terraform" = "true" - "DST_Update" = "" -} - -# Kubernetes namespace -namespace = "armonik" - -# S3 as shared storage -s3_fs = { - name = "armonik-s3fs" - policy = "" - attach_policy = false - attach_deny_insecure_transport_policy = true - attach_require_latest_tls_policy = true - attach_public_policy = false - block_public_acls = true - block_public_policy = true - ignore_public_acls = true - restrict_public_buckets = true - kms_key_id = "" - sse_algorithm = "" - ownership = "BucketOwnerPreferred" - versioning = "Disabled" -} - -# Object storage -# Uncomment either the `Elasticache` or the `S3` parameter -# AWS Elasticache -elasticache = { - name = "armonik-elasticache" - engine = "redis" - engine_version = "6.x" - node_type = "cache.r4.large" - apply_immediately = true - multi_az_enabled = false - automatic_failover_enabled = true - num_cache_clusters = 2 - preferred_cache_cluster_azs = [] - # The order of the availability zones in the list is considered. The first item in the list will be the primary node - data_tiering_enabled = false # This parameter must be set to true when using r6gd nodes. - log_retention_in_days = 30 - # Name of CloudWatch log groups for slow-log and engine-log to be created - cloudwatch_log_groups = { - slow_log = "" - engine_log = "" - } - encryption_keys = { - kms_key_id = "" - log_kms_key_id = "" - } -} -/* -# S3 as shared storage -s3_os = { - name = "armonik-s3os" - policy = "" - attach_policy = false - attach_deny_insecure_transport_policy = true - attach_require_latest_tls_policy = true - attach_public_policy = false - block_public_acls = true - block_public_policy = true - ignore_public_acls = true - restrict_public_buckets = true - kms_key_id = "" - sse_algorithm = "" - ownership = "BucketOwnerPreferred" - versioning = "Disabled" -} -*/ - -# MQ parameters -mq = { - name = "armonik-mq" - engine_type = "ActiveMQ" - engine_version = "5.16.4" - host_instance_type = "mq.m5.xlarge" - apply_immediately = true - deployment_mode = "SINGLE_INSTANCE" # "SINGLE_INSTANCE" | "ACTIVE_STANDBY_MULTI_AZ" - storage_type = "ebs" # "ebs" | "efs" - kms_key_id = "" - authentication_strategy = "simple" # "ldap" - publicly_accessible = false -} - -# MQ Credentials -mq_credentials = { - password = "" - username = "" -} - -# Parameters for MongoDB -mongodb = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/mongodb" - tag = "6.0.1" - node_selector = { service = "state-database" } - image_pull_secrets = "" - persistent_volume = null - replicas_number = 2 - # example: {storage_provisioner="efs.csi.aws.com",parameters=null,resources={limits=null,requests={storage="5Gi"}}} -} - -# AWS EFS as Persistent volume -pv_efs = { - # AWS Elastic Filesystem Service - efs = { - name = "armonik-efs" - kms_key_id = "" - performance_mode = "generalPurpose" # "generalPurpose" or "maxIO" - throughput_mode = "bursting" # "bursting" or "provisioned" - provisioned_throughput_in_mibps = null - transition_to_ia = "AFTER_7_DAYS" - # "AFTER_7_DAYS", "AFTER_14_DAYS", "AFTER_30_DAYS", "AFTER_60_DAYS", or "AFTER_90_DAYS" - access_point = null #["mongo"] - } - # EFS Container Storage Interface (CSI) Driver - csi_driver = { - namespace = "kube-system" - image_pull_secrets = "" - node_selector = { service = "state-database" } - repository = "https://kubernetes-sigs.github.io/aws-efs-csi-driver/" - version = "2.3.0" - docker_images = { - efs_csi = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/aws-efs-csi-driver" - tag = "v1.5.1" - } - livenessprobe = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/livenessprobe" - tag = "v2.9.0-eks-1-22-19" - } - node_driver_registrar = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/node-driver-registrar" - tag = "v2.7.0-eks-1-22-19" - } - external_provisioner = { - image = "125796369274.dkr.ecr.eu-west-3.amazonaws.com/external-provisioner" - tag = "v3.4.0-eks-1-22-19" - } - } - } -} diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/providers.tf b/infrastructure/quick-deploy/aws-benchmark/storage/providers.tf deleted file mode 100644 index 1fe5e2c4a..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/providers.tf +++ /dev/null @@ -1,24 +0,0 @@ -provider "aws" { - region = var.region - profile = var.profile -} - -# 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/aws-benchmark/storage/s3-iam-object-storage.tf b/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam-object-storage.tf deleted file mode 100644 index ae5ca842e..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam-object-storage.tf +++ /dev/null @@ -1,68 +0,0 @@ -# Decrypt objects in S3 -data "aws_iam_policy_document" "decrypt_s3_storage_object" { - count = length(module.s3_os) > 0 ? 1 : 0 - statement { - sid = "KMSAccess" - actions = [ - "kms:Encrypt", - "kms:Decrypt", - "kms:ReEncrypt*", - "kms:GenerateDataKey*", - "kms:DescribeKey" - ] - effect = "Allow" - resources = [ - local.s3_os_kms_key_id - ] - } -} - -resource "aws_iam_policy" "decrypt_s3_storage_object" { - count = length(module.s3_os) > 0 ? 1 : 0 - name_prefix = local.iam_s3_decrypt_s3_storage_object_policy_name - description = "Policy for alowing decryption of encrypted object in S3 ${var.eks.cluster_name}" - policy = data.aws_iam_policy_document.decrypt_s3_storage_object[0].json - tags = local.tags -} - -resource "aws_iam_policy_attachment" "decrypt_s3_storage_object" { - count = length(module.s3_os) > 0 ? 1 : 0 - name = "s3-encrypt-decrypt" - policy_arn = aws_iam_policy.decrypt_s3_storage_object[0].arn - roles = var.eks.worker_iam_role_names -} - -# Read objects in S3 -data "aws_iam_policy_document" "fullaccess_s3_storage_object" { - count = length(module.s3_os) > 0 ? 1 : 0 - statement { - sid = "FullAccessFromS3" - actions = [ - "s3:PutObject", - "s3:GetObject", - "s3:ListBucket", - "s3:DeleteObject", - "s3:PutObjectAcl", - "s3:PutObjectTagging", - ] - effect = "Allow" - resources = [ - "${module.s3_os[0].arn}/*" - ] - } -} - -resource "aws_iam_policy" "fullaccess_s3_storage_object" { - count = length(module.s3_os) > 0 ? 1 : 0 - name_prefix = "s3-fullAccess-${var.eks.cluster_name}" - description = "Policy for allowing read/write/delete object in S3 ${var.eks.cluster_name}" - policy = data.aws_iam_policy_document.fullaccess_s3_storage_object[0].json - tags = local.tags -} - -resource "aws_iam_policy_attachment" "fullaccess_s3_storage_object_attachment" { - count = length(module.s3_os) > 0 ? 1 : 0 - name = "s3-fullAccess-${var.eks.cluster_name}" - policy_arn = aws_iam_policy.fullaccess_s3_storage_object[0].arn - roles = var.eks.worker_iam_role_names -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf b/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf deleted file mode 100644 index 5af11a4a5..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/s3-iam.tf +++ /dev/null @@ -1,57 +0,0 @@ -# Decrypt objects in S3 -data "aws_iam_policy_document" "decrypt_object" { - statement { - sid = "KMSAccess" - actions = [ - "kms:Encrypt", - "kms:Decrypt", - "kms:ReEncrypt*", - "kms:GenerateDataKey*", - "kms:DescribeKey" - ] - effect = "Allow" - resources = [ - local.s3_fs_kms_key_id - ] - } -} - -resource "aws_iam_policy" "decrypt_object" { - name_prefix = local.iam_s3_decrypt_object_policy_name - description = "Policy for alowing decryption of encrypted object in S3 ${var.eks.cluster_name}" - policy = data.aws_iam_policy_document.decrypt_object.json - tags = local.tags -} - -resource "aws_iam_policy_attachment" "decrypt_object" { - name = local.iam_s3_decrypt_object_policy_name - policy_arn = aws_iam_policy.decrypt_object.arn - roles = var.eks.worker_iam_role_names -} - -# Read objects in S3 -data "aws_iam_policy_document" "read_object" { - statement { - sid = "ReadFromS3" - actions = [ - "s3:GetObject" - ] - effect = "Allow" - resources = [ - "${module.s3_fs.arn}/*" - ] - } -} - -resource "aws_iam_policy" "read_object" { - name_prefix = "s3-read-${var.eks.cluster_name}" - description = "Policy for allowing read object in S3 ${var.eks.cluster_name}" - policy = data.aws_iam_policy_document.read_object.json - tags = local.tags -} - -resource "aws_iam_policy_attachment" "read_object_attachment" { - name = "s3-read-${var.eks.cluster_name}" - policy_arn = aws_iam_policy.read_object.arn - roles = var.eks.worker_iam_role_names -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf b/infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf deleted file mode 100644 index 7e3c99370..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/secrets.tf +++ /dev/null @@ -1,99 +0,0 @@ -# Secrets -resource "kubernetes_secret" "elasticache" { - count = length(module.elasticache) > 0 ? 1 : 0 - metadata { - name = "redis" - namespace = var.namespace - } - data = { - "chain.pem" = "" - username = "" - password = "" - host = module.elasticache[0].redis_endpoint_url.host - port = module.elasticache[0].redis_endpoint_url.port - url = module.elasticache[0].redis_endpoint_url.url - } -} - -resource "kubernetes_secret" "mq" { - metadata { - name = "activemq" - namespace = var.namespace - } - data = { - "chain.pem" = "" - username = module.mq.user.username - password = module.mq.user.password - host = module.mq.activemq_endpoint_url.host - port = module.mq.activemq_endpoint_url.port - url = module.mq.activemq_endpoint_url.url - web-url = module.mq.web_url - } -} - -resource "kubernetes_secret" "shared_storage" { - metadata { - name = "shared-storage" - namespace = var.namespace - } - data = { - service_url = "https://s3.${var.region}.amazonaws.com" - kms_key_id = module.s3_fs.kms_key_id - name = module.s3_fs.s3_bucket_name - access_key_id = "" - secret_access_key = "" - file_storage_type = "S3" - must_force_path_style = false - } -} - -resource "kubernetes_secret" "s3" { - count = length(module.s3_os) > 0 ? 1 : 0 - metadata { - name = "s3" - namespace = var.namespace - } - data = { - username = "" - password = "" - url = "https://s3.${var.region}.amazonaws.com" - bucket_name = module.s3_os[0].s3_bucket_name - kms_key_id = module.s3_os[0].kms_key_id - must_force_path_style = false - } -} - -resource "kubernetes_secret" "deployed_object_storage" { - metadata { - name = "deployed-object-storage" - namespace = var.namespace - } - data = { - list = join(",", local.deployed_object_storages) - adapter = local.object_storage_adapter - } -} - -resource "kubernetes_secret" "deployed_table_storage" { - metadata { - name = "deployed-table-storage" - namespace = var.namespace - } - data = { - list = join(",", local.deployed_table_storages) - adapter = local.table_storage_adapter - } -} - -resource "kubernetes_secret" "deployed_queue_storage" { - metadata { - name = "deployed-queue-storage" - namespace = var.namespace - } - data = { - list = join(",", local.deployed_queue_storages) - adapter = local.queue_storage_adapter - adapter_class_name = local.adapter_class_name - adapter_absolute_path = local.adapter_absolute_path - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/variables.tf b/infrastructure/quick-deploy/aws-benchmark/storage/variables.tf deleted file mode 100644 index 7f66c17bc..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/variables.tf +++ /dev/null @@ -1,230 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# SUFFIX -variable "suffix" { - description = "To suffix the AWS resources" - type = string - default = "" -} - -# AWS TAGs -variable "tags" { - description = "Tags for AWS resources" - type = any - default = {} -} - -# EKS infos -variable "eks" { - description = "EKS cluster infos" - type = any - default = {} -} - -# Kubeconfig path -variable "k8s_config_path" { - description = "Path of the configuration file of K8s" - type = string - default = "~/.kube/config" -} - -# Kubeconfig context -variable "k8s_config_context" { - description = "Context of K8s" - type = string - default = "default" -} - -# Kubernetes namespace -variable "namespace" { - description = "Kubernetes namespace for ArmoniK" - type = string - default = "armonik" -} - -# VPC infos -variable "vpc" { - description = "AWS VPC info" - type = any -} - -# S3 as shared storage -variable "s3_fs" { - description = "AWS S3 bucket as shared storage" - type = object({ - name = string - policy = string - attach_policy = bool - attach_deny_insecure_transport_policy = bool - attach_require_latest_tls_policy = bool - attach_public_policy = bool - block_public_acls = bool - block_public_policy = bool - ignore_public_acls = bool - restrict_public_buckets = bool - kms_key_id = string - sse_algorithm = string - ownership = string - versioning = string - }) -} - -# AWS Elasticache -variable "elasticache" { - description = "Parameters of Elasticache" - type = object({ - name = string - engine = string - engine_version = string - node_type = string - apply_immediately = bool - multi_az_enabled = bool - automatic_failover_enabled = bool - num_cache_clusters = number - preferred_cache_cluster_azs = list(string) - data_tiering_enabled = bool - log_retention_in_days = number - cloudwatch_log_groups = object({ - slow_log = string - engine_log = string - }) - encryption_keys = object({ - kms_key_id = string - log_kms_key_id = string - }) - }) - default = null -} - -# MQ parameters -variable "mq" { - description = "MQ Service parameters" - type = object({ - name = string - engine_type = string - engine_version = string - host_instance_type = string - apply_immediately = bool - deployment_mode = string - storage_type = string - kms_key_id = string - authentication_strategy = string - publicly_accessible = bool - }) -} - -# MQ Credentials -variable "mq_credentials" { - description = "Amazon MQ credentials" - type = object({ - password = string - username = string - }) - default = { - password = "" - username = "" - } -} - -# Parameters for MongoDB -variable "mongodb" { - description = "Parameters of MongoDB" - type = object({ - image = string - tag = string - node_selector = any - image_pull_secrets = string - replicas_number = number - persistent_volume = object({ - storage_provisioner = string - parameters = map(string) - #Resources for PVC - resources = object({ - limits = object({ - storage = string - }) - requests = object({ - storage = string - }) - }) - }) - }) -} - -# AWS EFS as Persistent volume -variable "pv_efs" { - description = "AWS EFS as Persistent volume" - type = object({ - # AWS Elastic Filesystem Service - efs = object({ - name = string - kms_key_id = string - performance_mode = string # "generalPurpose" or "maxIO" - throughput_mode = string # "bursting" or "provisioned" - provisioned_throughput_in_mibps = number - transition_to_ia = string - # "AFTER_7_DAYS", "AFTER_14_DAYS", "AFTER_30_DAYS", "AFTER_60_DAYS", or "AFTER_90_DAYS" - access_point = list(string) - }) - # EFS Container Storage Interface (CSI) Driver - csi_driver = object({ - namespace = string - image_pull_secrets = string - node_selector = any - repository = optional(string, "https://kubernetes-sigs.github.io/aws-efs-csi-driver/") - version = optional(string, "2.3.0") - docker_images = object({ - efs_csi = object({ - image = string - tag = string - }) - livenessprobe = object({ - image = string - tag = string - }) - node_driver_registrar = object({ - image = string - tag = string - }) - external_provisioner = object({ - image = string - tag = string - }) - }) - }) - }) -} - -# S3 as object storage -variable "s3_os" { - description = "AWS S3 bucket as shared storage" - type = object({ - name = string - policy = string - attach_policy = bool - attach_deny_insecure_transport_policy = bool - attach_require_latest_tls_policy = bool - attach_public_policy = bool - block_public_acls = bool - block_public_policy = bool - ignore_public_acls = bool - restrict_public_buckets = bool - kms_key_id = string - sse_algorithm = string - ownership = string - versioning = string - }) - default = null -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/storage/versions.tf b/infrastructure/quick-deploy/aws-benchmark/storage/versions.tf deleted file mode 100644 index 6afbb9b9f..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/storage/versions.tf +++ /dev/null @@ -1,32 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.47.0" - } - null = { - source = "hashicorp/null" - version = "~> 3.1.0" - } - random = { - source = "hashicorp/random" - version = "~> 3.4.3" - } - kubernetes = { - source = "hashicorp/kubernetes" - version = "~> 2.13.0" - } - kubectl = { - source = "gavinbunney/kubectl" - version = "~> 1.14.0" - } - tls = { - source = "hashicorp/tls" - version = "~> 4.0.4" - } - pkcs12 = { - source = "chilicat/pkcs12" - version = "~> 0.0.7" - } - } -} diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/Makefile b/infrastructure/quick-deploy/aws-benchmark/vpc/Makefile deleted file mode 100644 index 081cce988..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -CURRENT_DIR=$(shell pwd) -GENERATED_DIR=$(CURRENT_DIR)/generated -PARAMETERS_FILE?=parameters.tfvars -STATE_FILE=vpc-terraform.tfstate -OUTPUT_FILE=$(GENERATED_DIR)/vpc-output.json -MODULES_DIR?=$(GENERATED_DIR)/infra-modules -MODULES_SOURCE=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_images.infra[0]') -MODULES_VERSION=$(shell cat $(VERSIONS_FILE) | jq -r '.armonik_versions.infra') - -export TF_DATA_DIR?=$(GENERATED_DIR) -export SUFFIX?=main -export REGION?=eu-west-3 -export PROFILE?=default -export TFSTATE_BUCKET_NAME?=armonik-tfstate-$(SUFFIX) -export PUBLIC_VPC?=true - -.PHONY: apply destroy - -all: get-modules init apply output -deploy: get-modules init apply output -destroy: init delete - -init: - mkdir -p $(GENERATED_DIR) - terraform init -upgrade \ - -backend-config 'bucket=$(TFSTATE_BUCKET_NAME)' \ - -backend-config 'region=$(REGION)' \ - -backend-config 'key=$(STATE_FILE)' \ - -backend-config 'profile=$(PROFILE)' - -apply: - terraform apply \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'enable_public_vpc=$(PUBLIC_VPC)' \ - -state $(STATE_FILE) \ - -auto-approve - -output: - @echo -n "{\"vpc\":" > $(OUTPUT_FILE) - @terraform output -state=$(STATE_FILE) -json vpc >> $(OUTPUT_FILE) - @echo -n "}" >> $(OUTPUT_FILE) - @echo "\nOUTPUT FILE: $(OUTPUT_FILE)" - -delete: - terraform destroy \ - -var-file $(PARAMETERS_FILE) \ - -var 'region=$(REGION)' \ - -var 'suffix=$(SUFFIX)' \ - -var 'profile=$(PROFILE)' \ - -var 'enable_public_vpc=$(PUBLIC_VPC)' \ - -state $(STATE_FILE) \ - -auto-approve - -get-modules: - @if [ -d $(MODULES_DIR) ]; then\ - git -C $(MODULES_DIR) fetch --all --tags;\ - git -C $(MODULES_DIR) -c advice.detachedHead=false checkout $(MODULES_VERSION);\ - git -C $(MODULES_DIR) pull origin $(MODULES_VERSION);\ - else \ - git -c advice.detachedHead=false clone --branch $(MODULES_VERSION) $(MODULES_SOURCE) $(MODULES_DIR);\ - fi - -clean: - rm -rf $(TF_DATA_DIR) .terraform.lock.hcl .terraform - -docs: - terraform-docs markdown table --output-file parameters.md --output-mode inject $(CURRENT_DIR) diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf deleted file mode 100644 index 43c4092a5..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/backend.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - backend "s3" { - key = "vpc-terraform.tfstate" - region = var.region - profile = var.profile - encrypt = true - force_path_style = true - workspace_key_prefix = "vpc" - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf deleted file mode 100644 index f85409def..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/locals.tf +++ /dev/null @@ -1,26 +0,0 @@ -# Current account -data "aws_caller_identity" "current" {} - -resource "random_string" "random_resources" { - length = 5 - special = false - upper = false - numeric = true -} - -resource "time_static" "creation_date" {} - -locals { - random_string = random_string.random_resources.result - suffix = var.suffix != null && var.suffix != "" ? var.suffix : local.random_string - cluster_name = "${var.cluster_name}-${local.suffix}" - kms_name = "armonik-kms-vpc-${local.suffix}-${local.random_string}" - vpc_name = "${var.vpc.name}-${local.suffix}" - enable_private_subnet = !var.enable_public_vpc - tags = merge(var.tags, { - "application" = "armonik" - "deployment version" = local.suffix - "created by" = data.aws_caller_identity.current.arn - "creation date" = time_static.creation_date.rfc3339 - }) -} diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/main.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/main.tf deleted file mode 100644 index 4c25efc18..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/main.tf +++ /dev/null @@ -1,27 +0,0 @@ -# AWS KMS -module "kms" { - count = (var.vpc.flow_log_cloudwatch_log_group_kms_key_id == "" ? 1 : 0) - source = "../generated/infra-modules/utils/aws/kms" - name = local.kms_name - tags = local.tags -} - -# AWS VPC -module "vpc" { - source = "../generated/infra-modules/networking/aws/vpc" - tags = local.tags - name = local.vpc_name - vpc = { - cluster_name = local.cluster_name - private_subnets = var.vpc.cidr_block_private - public_subnets = var.vpc.cidr_block_public - main_cidr_block = var.vpc.main_cidr_block - pod_cidr_block_private = var.vpc.pod_cidr_block_private - enable_private_subnet = local.enable_private_subnet - enable_nat_gateway = local.enable_private_subnet - single_nat_gateway = local.enable_private_subnet - flow_log_cloudwatch_log_group_retention_in_days = var.vpc.flow_log_cloudwatch_log_group_retention_in_days - flow_log_cloudwatch_log_group_kms_key_id = (var.vpc.flow_log_cloudwatch_log_group_kms_key_id != "" ? var.vpc.flow_log_cloudwatch_log_group_kms_key_id : module.kms.0.arn) - peering = var.vpc.peering - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf deleted file mode 100644 index 31317c575..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/outputs.tf +++ /dev/null @@ -1,14 +0,0 @@ -# VPC -output "vpc" { - description = "VPC infos" - value = { - id = module.vpc.id - cidr_block = module.vpc.cidr_block - cidr_block_private = var.vpc.cidr_block_private - private_subnet_ids = module.vpc.private_subnet_ids - public_subnet_ids = module.vpc.public_subnet_ids - pods_subnet_ids = module.vpc.pods_subnet_ids - pod_cidr_block_private = module.vpc.pod_cidr_block_private - eks_cluster_name = local.cluster_name - } -} diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars deleted file mode 100644 index de09798ae..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/parameters.tfvars +++ /dev/null @@ -1,60 +0,0 @@ -# Profile -profile = "default" - -# Region -region = "eu-west-3" - -# SUFFIX -suffix = "main" - -# AWS TAGs -tags = { - "name" = "" - "env" = "" - "entity" = "" - "bu" = "" - "owner" = "" - "application code" = "" - "project code" = "" - "cost center" = "" - "Support Contact" = "" - "origin" = "terraform" - "unit of measure" = "" - "epic" = "" - "functional block" = "" - "hostname" = "" - "interruptible" = "" - "tostop" = "" - "tostart" = "" - "branch" = "" - "gridserver" = "" - "it division" = "" - "Confidentiality" = "" - "csp" = "aws" - "grafanaserver" = "" - "Terraform" = "true" - "DST_Update" = "" -} - -# EKS cluster name -cluster_name = "armonik-eks" - -# VPC -vpc = { - name = "armonik-vpc" - # list of CIDR block associated with the private subnet - cidr_block_private = ["10.0.0.0/18", "10.0.64.0/18", "10.0.128.0/18"] - # list of CIDR block associated with the public subnet - cidr_block_public = ["10.0.192.0/24", "10.0.193.0/24", "10.0.194.0/24"] - # Main CIDR block associated to the VPC - main_cidr_block = "10.0.0.0/16" - # cidr block associated with pod - pod_cidr_block_private = ["10.1.0.0/16", "10.2.0.0/16", "10.3.0.0/16"] - enable_private_subnet = true - flow_log_cloudwatch_log_group_kms_key_id = "" - flow_log_cloudwatch_log_group_retention_in_days = 30 - peering = { - enabled = false - peer_vpc_ids = [] - } -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf deleted file mode 100644 index c0fc95d9d..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/providers.tf +++ /dev/null @@ -1,4 +0,0 @@ -provider "aws" { - region = var.region - profile = var.profile -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf deleted file mode 100644 index ba45ad415..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/variables.tf +++ /dev/null @@ -1,64 +0,0 @@ -# Profile -variable "profile" { - description = "Profile of AWS credentials to deploy Terraform sources" - type = string - default = "default" -} - -# Region -variable "region" { - description = "AWS region where the infrastructure will be deployed" - type = string - default = "eu-west-3" -} - -# SUFFIX -variable "suffix" { - description = "To suffix the AWS resources" - type = string - default = "" -} - -# AWS TAGs -variable "tags" { - description = "Tags for AWS resources" - type = any - default = {} -} - -# EKS cluster name -variable "cluster_name" { - description = "EKS cluster name" - type = string - default = "" -} - -# VPC -variable "vpc" { - description = "Parameters of AWS VPC" - type = object({ - name = string - # list of CIDR block associated with the private subnet - cidr_block_private = list(string) - # list of CIDR block associated with the public subnet - cidr_block_public = list(string) - # Main CIDR block associated to the VPC - main_cidr_block = string - # cidr block associated with pod - pod_cidr_block_private = list(string) - enable_private_subnet = bool - flow_log_cloudwatch_log_group_kms_key_id = string - flow_log_cloudwatch_log_group_retention_in_days = number - peering = object({ - enabled = bool - peer_vpc_ids = list(string) - }) - }) -} - -# Enable public VPC -variable "enable_public_vpc" { - description = "Enable public VPC" - type = bool - default = true -} \ No newline at end of file diff --git a/infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf b/infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf deleted file mode 100644 index 223ad5cf4..000000000 --- a/infrastructure/quick-deploy/aws-benchmark/vpc/versions.tf +++ /dev/null @@ -1,16 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 4.47.0" - } - random = { - source = "hashicorp/random" - version = "~> 3.4.3" - } - null = { - source = "hashicorp/null" - version = "~> 3.1.0" - } - } -} \ No newline at end of file From 27bdb6f5a72931b764dc6aeb0970361eb86ad54e Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 10:54:11 +0200 Subject: [PATCH 22/38] add 100 pods and 1000 pods parameters files --- .../aws-benchmark/parameters_1000pods.tfvars | 641 ++++++++++++++++++ ...eters.tfvars => parameters_100pods.tfvars} | 0 test/README.md | 3 +- 3 files changed, 642 insertions(+), 2 deletions(-) create mode 100644 infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars rename infrastructure/quick-deploy/aws-benchmark/{parameters.tfvars => parameters_100pods.tfvars} (100%) diff --git a/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars b/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars new file mode 100644 index 000000000..5bd858462 --- /dev/null +++ b/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars @@ -0,0 +1,641 @@ +# Tags +tags = { + "name" = "" + "env" = "" + "entity" = "" + "bu" = "" + "owner" = "" + "application code" = "" + "project code" = "" + "cost center" = "" + "Support Contact" = "" + "origin" = "terraform" + "unit of measure" = "" + "epic" = "" + "functional block" = "" + "hostname" = "" + "interruptible" = "" + "tostop" = "" + "tostart" = "" + "branch" = "" + "gridserver" = "" + "it division" = "" + "Confidentiality" = "" + "csp" = "aws" + "grafanaserver" = "" + "Terraform" = "true" + "DST_Update" = "" +} + +vpc = { + enable_private_subnet = false +} + +# AWS EKS +eks = { + cluster_version = "1.25" + node_selector = { service = "monitoring" } + cluster_endpoint_public_access = true + map_roles = [] + map_users = [] +} + +# List of EKS managed node groups +eks_managed_node_groups = { + # Default node group for workers of ArmoniK + workers = { + name = "workers" + launch_template_description = "Node group for ArmoniK Compute-plane pods" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "SPOT" + min_size = 0 + desired_size = 0 + max_size = 1000 + labels = { + service = "workers" + "node.kubernetes.io/lifecycle" = "spot" + } + taints = { + dedicated = { + key = "service" + value = "workers" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for metrics: Metrics exporter and Prometheus + metrics = { + name = "metrics" + launch_template_description = "Node group for metrics: Metrics exporter and Prometheus" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 5 + labels = { + service = "metrics" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "metrics" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for ArmoniK control-plane: control-plane and Ingress + control_plane = { + name = "control-plane" + launch_template_description = "Node group for ArmoniK Control-plane and Ingress" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 10 + labels = { + service = "control-plane" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "control-plane" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for monitoring: metrics server, keda, seq, grafana, cluster-autoscaler, coreDNS, termination handler + monitoring = { + name = "monitoring" + launch_template_description = "Node group for monitoring" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 5 + labels = { + service = "monitoring" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "monitoring" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + # Node group for data-plane + # state_database, inner_storage, task_queue + state_database = { + name = "mongodb" + launch_template_description = "Node group for MongoDB" + ami_type = "AL2_x86_64" + instance_types = ["c5.24xlarge"] + use_custom_launch_template = true + block_device_mappings = { + xvda = { + device_name = "/dev/xvda" + ebs = { + volume_size = 75 + volume_type = "gp3" + iops = 3000 + throughput = 150 + encrypted = null + kms_key_id = null + delete_on_termination = true + } + } + } + capacity_type = "ON_DEMAND" + min_size = 1 + desired_size = 1 + max_size = 10 + labels = { + service = "state-database" + "node.kubernetes.io/lifecycle" = "ondemand" + } + taints = { + dedicated = { + key = "service" + value = "state-database" + effect = "NO_SCHEDULE" + } + } + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } +} + +# List of self managed node groups +self_managed_node_groups = { + others = { + name = "others" + launch_template_description = "Node group for others" + instance_type = "c5.24xlarge" + min_size = 0 + desired_size = 0 + max_size = 5 + force_delete = true + force_delete_warm_pool = true + instance_market_options = { + market_type = "spot" + } + bootstrap_extra_args = "--kubelet-extra-args '--node-labels=node.kubernetes.io/lifecycle=spot'" + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } + others_mixed = { + name = "others-mixed" + launch_template_description = "Mixed On demand and SPOT instances for other pods" + min_size = 0 + desired_size = 0 + max_size = 5 + use_mixed_instances_policy = true + mixed_instances_policy = { + on_demand_allocation_strategy = "lowest-price" + on_demand_base_capacity = 0 + on_demand_percentage_above_base_capacity = 20 # 20% On-Demand Instances, 80% Spot Instances + spot_allocation_strategy = "price-capacity-optimized" + spot_instance_pools = null + spot_max_price = null + } + override = [ + { + instance_type = "c5.4xlarge" + weighted_capacity = "1" + }, + { + instance_type = "c5.2xlarge" + weighted_capacity = "2" + }, + ] + iam_role_use_name_prefix = false + iam_role_additional_policies = { + AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" + } + } +} + +# List of fargate profiles +fargate_profiles = {} + +metrics_server = { + node_selector = { service = "monitoring" } +} + +keda = { + node_selector = { service = "monitoring" } +} + +# Object storage +# Uncomment either the `elasticache` or the `s3_os` parameter +elasticache = { + engine = "redis" + engine_version = "6.x" + node_type = "cache.r4.large" + num_cache_clusters = 2 +} + +#s3_os = {} + +mq = { + engine_type = "ActiveMQ" + engine_version = "5.16.4" + host_instance_type = "mq.m5.xlarge" +} + +mongodb = { + node_selector = { service = "state-database" } + #persistent_volume = { + # storage_provisioner = "efs.csi.aws.com" + # resources = { + # requests = { + # storage = "5Gi" + # } + # } + #} +} + +pv_efs = { + csi_driver = { + node_selector = { service = "state-database" } + } +} + +seq = { + node_selector = { service = "monitoring" } +} + +grafana = { + node_selector = { service = "monitoring" } +} + +node_exporter = { + node_selector = {} +} + +prometheus = { + node_selector = { service = "metrics" } +} + +metrics_exporter = { + node_selector = { service = "metrics" } + extra_conf = { + MongoDB__AllowInsecureTls = true + Serilog__MinimumLevel = "Information" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + } +} + +/*parition_metrics_exporter = { + node_selector = { service = "metrics" } + extra_conf = { + MongoDB__AllowInsecureTls = true + Serilog__MinimumLevel = "Information" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + } +}*/ + +fluent_bit = { + is_daemonset = true + node_selector = {} +} + +# Logging level +logging_level = "Information" + +# Parameters of control plane +control_plane = { + limits = { + cpu = "1000m" + memory = "2048Mi" + } + requests = { + cpu = "200m" + memory = "500Mi" + } + default_partition = "default" + node_selector = { service = "control-plane" } +} + +# Parameters of admin GUI +admin_gui = { + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + node_selector = { service = "monitoring" } +} + +# Parameters of old admin GUI +admin_old_gui = { + api = { + name = "admin-api" + port = 3333 + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + } + old = { + name = "admin-old-gui" + port = 1080 + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "100m" + memory = "128Mi" + } + } + service_type = "ClusterIP" + replicas = 1 + image_pull_policy = "IfNotPresent" + image_pull_secrets = "" + node_selector = { service = "monitoring" } +} + +# Parameters of the compute plane +compute_plane = { + # Default partition that uses the C# extension for the worker + default = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 1 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_worker_dll" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 1 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + # Partition for the stream worker + stream = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 1 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_core_stream_test_worker" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 1 + max_replica_count = 100 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + # Partition for the htcmock worker + htcmock = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 1000 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_core_htcmock_test_worker" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 1000 + max_replica_count = 1000 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, + # Partition for the bench worker + bench = { + node_selector = { service = "workers" } + # number of replicas for each deployment of compute plane + replicas = 1000 + # ArmoniK polling agent + polling_agent = { + limits = { + cpu = "2000m" + memory = "2048Mi" + } + requests = { + cpu = "500m" + memory = "256Mi" + } + } + # ArmoniK workers + worker = [ + { + image = "dockerhubaneo/armonik_core_bench_test_worker" + limits = { + cpu = "1000m" + memory = "1024Mi" + } + requests = { + cpu = "500m" + memory = "512Mi" + } + } + ] + hpa = { + type = "prometheus" + polling_interval = 15 + cooldown_period = 300 + min_replica_count = 1000 + max_replica_count = 1000 + behavior = { + restore_to_original_replica_count = true + stabilization_window_seconds = 300 + type = "Percent" + value = 100 + period_seconds = 15 + } + triggers = [ + { + type = "prometheus" + threshold = 2 + }, + ] + } + }, +} + +# Deploy ingress +# PS: to not deploy ingress put: "ingress=null" +ingress = { + tls = false + mtls = false + generate_client_cert = false + node_selector = { service = "control-plane" } +} + +# Job to insert partitions in the database +job_partitions_in_database = { + node_selector = { service = "control-plane" } +} + +# Authentication behavior +authentication = { + node_selector = { service = "control-plane" } +} + +extra_conf = { + core = { + Amqp__AllowHostMismatch = false + Amqp__MaxPriority = "10" + Amqp__MaxRetries = "5" + Amqp__QueueStorage__LockRefreshPeriodicity = "00:00:45" + Amqp__QueueStorage__PollPeriodicity = "00:00:10" + Amqp__QueueStorage__LockRefreshExtension = "00:02:00" + MongoDB__TableStorage__PollingDelayMin = "00:00:01" + MongoDB__TableStorage__PollingDelayMax = "00:00:10" + MongoDB__TableStorage__PollingDelay = "00:00:01" + MongoDB__DataRetention = "10.00:00:00" + MongoDB__AllowInsecureTls = true + Redis__Timeout = 3000 + Redis__SslHost = "" + } + control = { + Submitter__MaxErrorAllowed = 50 + } +} diff --git a/infrastructure/quick-deploy/aws-benchmark/parameters.tfvars b/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars similarity index 100% rename from infrastructure/quick-deploy/aws-benchmark/parameters.tfvars rename to infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars diff --git a/test/README.md b/test/README.md index 8086e9c15..e602b432a 100644 --- a/test/README.md +++ b/test/README.md @@ -3,8 +3,7 @@ This document describes how to use the benchmarking scripts. Those tests are an example of benchmarking tests using bench and htcmock to measure the performances of ArmoniK. -We have to deploy [ArmoniK(aws-benchmark)](https://github.com/aneoconsulting/ArmoniK/tree/yk/benchmarking_scripts/infrastructure/quick-deploy/aws-benchmark) on aws with two partitions (bench and htcmock) with 100 pods for each partition -using redis as storage. +We have to deploy ArmoniK on aws using the parameters file in aws-benchmark folder to deploy ArmoniK with two partitions (bench and htcmock) with 100 pods for each partition.
 .  

From 13dbda81489cb8f9e7b4da33a9d848962a1038b4 Mon Sep 17 00:00:00 2001
From: YKharouni 
Date: Mon, 10 Jul 2023 11:19:59 +0200
Subject: [PATCH 23/38] reorgnize folders

---
 .../{100_pods/redis => }/python_scripts/cleaner.py  |  0
 .../redis => }/python_scripts/merge_jsons.py        |  0
 .../{100_pods/redis => }/python_scripts/wjson.py    |  0
 test/bench/stats/10k.json                           |  4 ++++
 test/bench/stats/1k.json                            | 13 +++++++++++++
 test/bench/stats/5k.json                            | 13 +++++++++++++
 test/bench/{100_pods/redis => }/stats/test_env.json |  0
 .../{100_pods/redis => }/test_scripts/bench_100k.sh |  4 ++--
 .../{100_pods/redis => }/test_scripts/bench_10k.sh  |  4 ++--
 .../{100_pods/redis => }/test_scripts/bench_1k.sh   |  4 ++--
 .../{100_pods/redis => }/test_scripts/bench_5k.sh   |  4 ++--
 .../bench/{100_pods/redis => }/test_scripts/test.sh |  0
 .../{100_pods/redis => }/python_scripts/cleaner.py  |  0
 .../redis => }/python_scripts/merge_jsons.py        |  0
 .../{100_pods/redis => }/stats/test_env.json        |  0
 .../{100_pods/redis => }/test_scripts/htcmock_5k.sh |  4 ++--
 .../{100_pods/redis => }/test_scripts/test.sh       |  0
 17 files changed, 40 insertions(+), 10 deletions(-)
 rename test/bench/{100_pods/redis => }/python_scripts/cleaner.py (100%)
 rename test/bench/{100_pods/redis => }/python_scripts/merge_jsons.py (100%)
 rename test/bench/{100_pods/redis => }/python_scripts/wjson.py (100%)
 create mode 100644 test/bench/stats/10k.json
 create mode 100644 test/bench/stats/1k.json
 create mode 100644 test/bench/stats/5k.json
 rename test/bench/{100_pods/redis => }/stats/test_env.json (100%)
 rename test/bench/{100_pods/redis => }/test_scripts/bench_100k.sh (61%)
 rename test/bench/{100_pods/redis => }/test_scripts/bench_10k.sh (61%)
 rename test/bench/{100_pods/redis => }/test_scripts/bench_1k.sh (61%)
 rename test/bench/{100_pods/redis => }/test_scripts/bench_5k.sh (61%)
 rename test/bench/{100_pods/redis => }/test_scripts/test.sh (100%)
 rename test/htcmock/{100_pods/redis => }/python_scripts/cleaner.py (100%)
 rename test/htcmock/{100_pods/redis => }/python_scripts/merge_jsons.py (100%)
 rename test/htcmock/{100_pods/redis => }/stats/test_env.json (100%)
 rename test/htcmock/{100_pods/redis => }/test_scripts/htcmock_5k.sh (72%)
 rename test/htcmock/{100_pods/redis => }/test_scripts/test.sh (100%)

diff --git a/test/bench/100_pods/redis/python_scripts/cleaner.py b/test/bench/python_scripts/cleaner.py
similarity index 100%
rename from test/bench/100_pods/redis/python_scripts/cleaner.py
rename to test/bench/python_scripts/cleaner.py
diff --git a/test/bench/100_pods/redis/python_scripts/merge_jsons.py b/test/bench/python_scripts/merge_jsons.py
similarity index 100%
rename from test/bench/100_pods/redis/python_scripts/merge_jsons.py
rename to test/bench/python_scripts/merge_jsons.py
diff --git a/test/bench/100_pods/redis/python_scripts/wjson.py b/test/bench/python_scripts/wjson.py
similarity index 100%
rename from test/bench/100_pods/redis/python_scripts/wjson.py
rename to test/bench/python_scripts/wjson.py
diff --git a/test/bench/stats/10k.json b/test/bench/stats/10k.json
new file mode 100644
index 000000000..b9ae276f4
--- /dev/null
+++ b/test/bench/stats/10k.json
@@ -0,0 +1,4 @@
+{"@t":"2023-07-10T09:19:26.7521593Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://a161bf35ed9104e8c95c5052a0421e1b-293666451.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","CertP12":"","CaCert":"","OverrideTargetName":"","HasClientCertificate":false,"KeepAliveTime":"00:00:30","KeepAliveTimeInterval":"00:00:30","MaxIdleTime":"00:05:00","MaxAttempts":5,"BackoffMultiplier":1.5,"InitialBackOff":"00:00:01","MaxBackOff":"00:00:05","RequestTimeout":"-00:00:00.0010000","$type":"GrpcClient"},"SourceContext":"Bench Program"}
+{"@t":"2023-07-10T09:19:26.7597975Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":10000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"}
+{"@t":"2023-07-10T09:19:27.0201114Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"stream","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"htcmock","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"default","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":4,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":10000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:27.0465964Z","@mt":"Session Id : {sessionId}","sessionId":"a99157d5-e06c-4ccc-a79f-3a557c49927d","SourceContext":"Bench Program","benchOptions":{"NTasks":10000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
diff --git a/test/bench/stats/1k.json b/test/bench/stats/1k.json
new file mode 100644
index 000000000..de70e5984
--- /dev/null
+++ b/test/bench/stats/1k.json
@@ -0,0 +1,13 @@
+{"@t":"2023-07-10T09:17:50.5489542Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://a161bf35ed9104e8c95c5052a0421e1b-293666451.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","CertP12":"","CaCert":"","OverrideTargetName":"","HasClientCertificate":false,"KeepAliveTime":"00:00:30","KeepAliveTimeInterval":"00:00:30","MaxIdleTime":"00:05:00","MaxAttempts":5,"BackoffMultiplier":1.5,"InitialBackOff":"00:00:01","MaxBackOff":"00:00:05","RequestTimeout":"-00:00:00.0010000","$type":"GrpcClient"},"SourceContext":"Bench Program"}
+{"@t":"2023-07-10T09:17:50.5567241Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"}
+{"@t":"2023-07-10T09:17:50.8350578Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"stream","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"htcmock","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"default","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":4,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:17:50.8658629Z","@mt":"Session Id : {sessionId}","sessionId":"27ee21d8-204e-4b4f-a871-8f74b8ee3969","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:08.6917574Z","@mt":"Results retrieved {number}","number":1000,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:08.7144003Z","@mt":"executions stats {@stats}","stats":{"ElapsedTime":"00:00:17.8554461","SubmissionTime":"00:00:03.2074546","TasksExecutionTime":"00:00:12.6777546","ResultRetrievingTime":"00:00:01.9411673","CountExecutionTime":"00:00:00.0207408","TotalTasks":1000,"ErrorTasks":0,"CompletedTasks":1000,"CancelledTasks":0,"$type":"ExecutionStats"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:09.2498304Z","@mt":"Ratio between time spent on a task and processing time {min}, {max}, {avg}","min":0.4318181818181818,"max":0.6829268292682927,"avg":0.6093851654479362,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:09.2539518Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Creating","status2":"Submitted","min":0.07,"max":0.105,"avg":0.07523999999999999,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:09.2545102Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Processing","min":0.006,"max":0.046,"avg":0.011500000000000005,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:09.2547624Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Processing","status2":"Completed","min":0.016,"max":0.053,"avg":0.022920000000000006,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:09.2549578Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Completed","min":0.023,"max":0.098,"avg":0.03442000000000001,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:09.2568208Z","@mt":"Throughput for session {session} : {sessionThroughput} task/s (completed {nTasks}, total {total} tasks in {timespan})","session":"27ee21d8-204e-4b4f-a871-8f74b8ee3969","sessionThroughput":19.14241960183767,"nTasks":50,"total":50,"timespan":"00:00:02.6120000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:09.7527975Z","@mt":"Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})","session":"27ee21d8-204e-4b4f-a871-8f74b8ee3969","throughput":19.14241960183767,"nTasks":50,"timespan":"00:00:02.6120000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
diff --git a/test/bench/stats/5k.json b/test/bench/stats/5k.json
new file mode 100644
index 000000000..dc130b47f
--- /dev/null
+++ b/test/bench/stats/5k.json
@@ -0,0 +1,13 @@
+{"@t":"2023-07-10T09:18:11.4337898Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://a161bf35ed9104e8c95c5052a0421e1b-293666451.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","CertP12":"","CaCert":"","OverrideTargetName":"","HasClientCertificate":false,"KeepAliveTime":"00:00:30","KeepAliveTimeInterval":"00:00:30","MaxIdleTime":"00:05:00","MaxAttempts":5,"BackoffMultiplier":1.5,"InitialBackOff":"00:00:01","MaxBackOff":"00:00:05","RequestTimeout":"-00:00:00.0010000","$type":"GrpcClient"},"SourceContext":"Bench Program"}
+{"@t":"2023-07-10T09:18:11.4418299Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"}
+{"@t":"2023-07-10T09:18:11.6536165Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"stream","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"htcmock","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"default","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":4,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:18:11.6835356Z","@mt":"Session Id : {sessionId}","sessionId":"99b011c1-fe6b-460a-a91b-0ad07f96c2c3","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:23.6990978Z","@mt":"Results retrieved {number}","number":5000,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:23.7310077Z","@mt":"executions stats {@stats}","stats":{"ElapsedTime":"00:01:12.0439095","SubmissionTime":"00:00:12.4182442","TasksExecutionTime":"00:00:46.1106839","ResultRetrievingTime":"00:00:13.4870304","CountExecutionTime":"00:00:00.0304402","TotalTasks":5000,"ErrorTasks":0,"CompletedTasks":5000,"CancelledTasks":0,"$type":"ExecutionStats"},"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:24.2191248Z","@mt":"Ratio between time spent on a task and processing time {min}, {max}, {avg}","min":0.3793103448275862,"max":0.6764705882352942,"avg":0.621100069976184,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:24.2231912Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Creating","status2":"Submitted","min":0.07,"max":0.084,"avg":0.07484,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:24.2236946Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Processing","min":0.006,"max":0.032,"avg":0.010040000000000004,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:24.2238927Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Processing","status2":"Completed","min":0.017,"max":0.026,"avg":0.022500000000000013,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:24.2240359Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Completed","min":0.025,"max":0.054,"avg":0.032540000000000006,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:24.2256817Z","@mt":"Throughput for session {session} : {sessionThroughput} task/s (completed {nTasks}, total {total} tasks in {timespan})","session":"99b011c1-fe6b-460a-a91b-0ad07f96c2c3","sessionThroughput":4.687353520202494,"nTasks":50,"total":50,"timespan":"00:00:10.6670000","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
+{"@t":"2023-07-10T09:19:24.7135091Z","@mt":"Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})","session":"99b011c1-fe6b-460a-a91b-0ad07f96c2c3","throughput":4.687353520202494,"nTasks":50,"timespan":"00:00:10.6670000","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}}
diff --git a/test/bench/100_pods/redis/stats/test_env.json b/test/bench/stats/test_env.json
similarity index 100%
rename from test/bench/100_pods/redis/stats/test_env.json
rename to test/bench/stats/test_env.json
diff --git a/test/bench/100_pods/redis/test_scripts/bench_100k.sh b/test/bench/test_scripts/bench_100k.sh
similarity index 61%
rename from test/bench/100_pods/redis/test_scripts/bench_100k.sh
rename to test/bench/test_scripts/bench_100k.sh
index d9a0a8499..9e0849fac 100755
--- a/test/bench/100_pods/redis/test_scripts/bench_100k.sh
+++ b/test/bench/test_scripts/bench_100k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
 #run  10000 tasks on 100 pods
 docker run --rm \
@@ -14,4 +14,4 @@ docker run --rm \
 	-e BenchOptions__BatchSize=50 \
 	-e BenchOptions__MaxRetries=5 \
 	-e BenchOptions__DegreeOfParallelism=5 \
-	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core')
+	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core')
diff --git a/test/bench/100_pods/redis/test_scripts/bench_10k.sh b/test/bench/test_scripts/bench_10k.sh
similarity index 61%
rename from test/bench/100_pods/redis/test_scripts/bench_10k.sh
rename to test/bench/test_scripts/bench_10k.sh
index 4c4ff7f19..2d8ce7bf5 100755
--- a/test/bench/100_pods/redis/test_scripts/bench_10k.sh
+++ b/test/bench/test_scripts/bench_10k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
 #run  10000 tasks on 100 pods
 docker run --rm \
@@ -14,4 +14,4 @@ docker run --rm \
 	-e BenchOptions__BatchSize=50 \
 	-e BenchOptions__MaxRetries=5 \
 	-e BenchOptions__DegreeOfParallelism=5 \
-	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core')
+	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core')
diff --git a/test/bench/100_pods/redis/test_scripts/bench_1k.sh b/test/bench/test_scripts/bench_1k.sh
similarity index 61%
rename from test/bench/100_pods/redis/test_scripts/bench_1k.sh
rename to test/bench/test_scripts/bench_1k.sh
index e736e2361..f5e25fb53 100755
--- a/test/bench/100_pods/redis/test_scripts/bench_1k.sh
+++ b/test/bench/test_scripts/bench_1k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
 #run  1000 tasks on 100 pods
 docker run --rm \
@@ -14,4 +14,4 @@ docker run --rm \
 	-e BenchOptions__BatchSize=50 \
 	-e BenchOptions__MaxRetries=5 \
 	-e BenchOptions__DegreeOfParallelism=5 \
-	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core')
+	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core')
diff --git a/test/bench/100_pods/redis/test_scripts/bench_5k.sh b/test/bench/test_scripts/bench_5k.sh
similarity index 61%
rename from test/bench/100_pods/redis/test_scripts/bench_5k.sh
rename to test/bench/test_scripts/bench_5k.sh
index a704d4b6c..653f0e045 100755
--- a/test/bench/100_pods/redis/test_scripts/bench_5k.sh
+++ b/test/bench/test_scripts/bench_5k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
 #run  5000 tasks on 100 pods
 docker run --rm \
@@ -14,4 +14,4 @@ docker run --rm \
 	-e BenchOptions__BatchSize=50 \
 	-e BenchOptions__MaxRetries=5 \
 	-e BenchOptions__DegreeOfParallelism=5 \
-	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core')
+	dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core')
diff --git a/test/bench/100_pods/redis/test_scripts/test.sh b/test/bench/test_scripts/test.sh
similarity index 100%
rename from test/bench/100_pods/redis/test_scripts/test.sh
rename to test/bench/test_scripts/test.sh
diff --git a/test/htcmock/100_pods/redis/python_scripts/cleaner.py b/test/htcmock/python_scripts/cleaner.py
similarity index 100%
rename from test/htcmock/100_pods/redis/python_scripts/cleaner.py
rename to test/htcmock/python_scripts/cleaner.py
diff --git a/test/htcmock/100_pods/redis/python_scripts/merge_jsons.py b/test/htcmock/python_scripts/merge_jsons.py
similarity index 100%
rename from test/htcmock/100_pods/redis/python_scripts/merge_jsons.py
rename to test/htcmock/python_scripts/merge_jsons.py
diff --git a/test/htcmock/100_pods/redis/stats/test_env.json b/test/htcmock/stats/test_env.json
similarity index 100%
rename from test/htcmock/100_pods/redis/stats/test_env.json
rename to test/htcmock/stats/test_env.json
diff --git a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh b/test/htcmock/test_scripts/htcmock_5k.sh
similarity index 72%
rename from test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh
rename to test/htcmock/test_scripts/htcmock_5k.sh
index 4f9cb02f5..6432b2e4a 100755
--- a/test/htcmock/100_pods/redis/test_scripts/htcmock_5k.sh
+++ b/test/htcmock/test_scripts/htcmock_5k.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
+export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url')
 
  docker run --rm \
               -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \
@@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../../../infrastructure/quick-deploy/aws/al
               -e HtcMock__EnableSmallOutput=true \
               -e HtcMock__EnableFastCompute=true \
               -e HtcMock__Partition="htcmock" \
-              dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../../../versions.tfvars.json | jq -r '.armonik_versions.core')
\ No newline at end of file
+              dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core')
\ No newline at end of file
diff --git a/test/htcmock/100_pods/redis/test_scripts/test.sh b/test/htcmock/test_scripts/test.sh
similarity index 100%
rename from test/htcmock/100_pods/redis/test_scripts/test.sh
rename to test/htcmock/test_scripts/test.sh

From 36855180f560e4e585b31aa8ca860630dc7fd587 Mon Sep 17 00:00:00 2001
From: YKharouni 
Date: Mon, 10 Jul 2023 11:26:41 +0200
Subject: [PATCH 24/38] update tree in doc

---
 test/README.md | 55 +++++++++++++++++++++++++-------------------------
 1 file changed, 28 insertions(+), 27 deletions(-)

diff --git a/test/README.md b/test/README.md
index e602b432a..67923b09c 100644
--- a/test/README.md
+++ b/test/README.md
@@ -6,33 +6,34 @@ Those tests are an example of benchmarking tests using bench and htcmock to meas
 We have to deploy ArmoniK on aws using the parameters file in aws-benchmark folder to deploy ArmoniK with two partitions (bench and htcmock) with 100 pods for each partition.
 
 
-.  
-├── bench    
-|  └── 100_pods  
-|        └── redis  
-|            ├── python_scripts  
-|            |   ├── cleaner.py  
-|            |   ├── merge_jsons.py  
-|            |   └── wjson.py  
-|            ├── stats  
-|            |   └── test_env.json  
-|            └── test_scripts  
-|                ├── bench_1k.sh  
-|                ├── bench_5k.sh  
-|                └── test.sh  
-├── htcmock  
-|   └── 100_pods  
-|        └── redis  
-|            ├── python_scripts  
-|            |   ├── cleaner.py  
-|            |   └── merge_jsons.py  
-|            |     
-|            ├── stats  
-|            |   └── test_env.json  
-|            └── test_scripts  
-|                ├── htcmock_5k.sh  
-|                └── test.sh  
-├── README.md  
+.
+├── bench
+│   ├── python_scripts
+│   │   ├── cleaner.py
+│   │   ├── merge_jsons.py
+│   │   └── wjson.py
+│   ├── stats
+│   │   ├── 10k.json
+│   │   ├── 1k.json
+│   │   ├── 5k.json
+│   │   └── test_env.json
+│   └── test_scripts
+│       ├── bench_100k.sh
+│       ├── bench_10k.sh
+│       ├── bench_1k.sh
+│       ├── bench_5k.sh
+│       └── test.sh
+├── htcmock
+│   ├── python_scripts
+│   │   ├── cleaner.py
+│   │   └── merge_jsons.py
+│   ├── stats
+│   │   └── test_env.json
+│   └── test_scripts
+│       ├── htcmock_5k.sh
+│       └── test.sh
+└── README.md
+
 
 
From 519e6d7328c35c045792e5e9b54aab9faebbba3e Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 11:53:13 +0200 Subject: [PATCH 25/38] remove results files --- test/bench/stats/10k.json | 4 ---- test/bench/stats/1k.json | 13 ------------- test/bench/stats/5k.json | 13 ------------- 3 files changed, 30 deletions(-) delete mode 100644 test/bench/stats/10k.json delete mode 100644 test/bench/stats/1k.json delete mode 100644 test/bench/stats/5k.json diff --git a/test/bench/stats/10k.json b/test/bench/stats/10k.json deleted file mode 100644 index b9ae276f4..000000000 --- a/test/bench/stats/10k.json +++ /dev/null @@ -1,4 +0,0 @@ -{"@t":"2023-07-10T09:19:26.7521593Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://a161bf35ed9104e8c95c5052a0421e1b-293666451.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","CertP12":"","CaCert":"","OverrideTargetName":"","HasClientCertificate":false,"KeepAliveTime":"00:00:30","KeepAliveTimeInterval":"00:00:30","MaxIdleTime":"00:05:00","MaxAttempts":5,"BackoffMultiplier":1.5,"InitialBackOff":"00:00:01","MaxBackOff":"00:00:05","RequestTimeout":"-00:00:00.0010000","$type":"GrpcClient"},"SourceContext":"Bench Program"} -{"@t":"2023-07-10T09:19:26.7597975Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":10000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"} -{"@t":"2023-07-10T09:19:27.0201114Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"stream","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"htcmock","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"default","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":4,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":10000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:27.0465964Z","@mt":"Session Id : {sessionId}","sessionId":"a99157d5-e06c-4ccc-a79f-3a557c49927d","SourceContext":"Bench Program","benchOptions":{"NTasks":10000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} diff --git a/test/bench/stats/1k.json b/test/bench/stats/1k.json deleted file mode 100644 index de70e5984..000000000 --- a/test/bench/stats/1k.json +++ /dev/null @@ -1,13 +0,0 @@ -{"@t":"2023-07-10T09:17:50.5489542Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://a161bf35ed9104e8c95c5052a0421e1b-293666451.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","CertP12":"","CaCert":"","OverrideTargetName":"","HasClientCertificate":false,"KeepAliveTime":"00:00:30","KeepAliveTimeInterval":"00:00:30","MaxIdleTime":"00:05:00","MaxAttempts":5,"BackoffMultiplier":1.5,"InitialBackOff":"00:00:01","MaxBackOff":"00:00:05","RequestTimeout":"-00:00:00.0010000","$type":"GrpcClient"},"SourceContext":"Bench Program"} -{"@t":"2023-07-10T09:17:50.5567241Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"} -{"@t":"2023-07-10T09:17:50.8350578Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"stream","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"htcmock","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"default","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":4,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:17:50.8658629Z","@mt":"Session Id : {sessionId}","sessionId":"27ee21d8-204e-4b4f-a871-8f74b8ee3969","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:08.6917574Z","@mt":"Results retrieved {number}","number":1000,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:08.7144003Z","@mt":"executions stats {@stats}","stats":{"ElapsedTime":"00:00:17.8554461","SubmissionTime":"00:00:03.2074546","TasksExecutionTime":"00:00:12.6777546","ResultRetrievingTime":"00:00:01.9411673","CountExecutionTime":"00:00:00.0207408","TotalTasks":1000,"ErrorTasks":0,"CompletedTasks":1000,"CancelledTasks":0,"$type":"ExecutionStats"},"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:09.2498304Z","@mt":"Ratio between time spent on a task and processing time {min}, {max}, {avg}","min":0.4318181818181818,"max":0.6829268292682927,"avg":0.6093851654479362,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:09.2539518Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Creating","status2":"Submitted","min":0.07,"max":0.105,"avg":0.07523999999999999,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:09.2545102Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Processing","min":0.006,"max":0.046,"avg":0.011500000000000005,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:09.2547624Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Processing","status2":"Completed","min":0.016,"max":0.053,"avg":0.022920000000000006,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:09.2549578Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Completed","min":0.023,"max":0.098,"avg":0.03442000000000001,"SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:09.2568208Z","@mt":"Throughput for session {session} : {sessionThroughput} task/s (completed {nTasks}, total {total} tasks in {timespan})","session":"27ee21d8-204e-4b4f-a871-8f74b8ee3969","sessionThroughput":19.14241960183767,"nTasks":50,"total":50,"timespan":"00:00:02.6120000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:09.7527975Z","@mt":"Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})","session":"27ee21d8-204e-4b4f-a871-8f74b8ee3969","throughput":19.14241960183767,"nTasks":50,"timespan":"00:00:02.6120000","SourceContext":"Bench Program","benchOptions":{"NTasks":1000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} diff --git a/test/bench/stats/5k.json b/test/bench/stats/5k.json deleted file mode 100644 index dc130b47f..000000000 --- a/test/bench/stats/5k.json +++ /dev/null @@ -1,13 +0,0 @@ -{"@t":"2023-07-10T09:18:11.4337898Z","@mt":"gRPC options : {@grpcOptions}","grpcOptions":{"Endpoint":"http://a161bf35ed9104e8c95c5052a0421e1b-293666451.eu-west-3.elb.amazonaws.com:5001","AllowUnsafeConnection":false,"CertPem":"","KeyPem":"","CertP12":"","CaCert":"","OverrideTargetName":"","HasClientCertificate":false,"KeepAliveTime":"00:00:30","KeepAliveTimeInterval":"00:00:30","MaxIdleTime":"00:05:00","MaxAttempts":5,"BackoffMultiplier":1.5,"InitialBackOff":"00:00:01","MaxBackOff":"00:00:05","RequestTimeout":"-00:00:00.0010000","$type":"GrpcClient"},"SourceContext":"Bench Program"} -{"@t":"2023-07-10T09:18:11.4418299Z","@mt":"bench options : {@benchOptions}","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"},"SourceContext":"Bench Program"} -{"@t":"2023-07-10T09:18:11.6536165Z","@mt":"{@partitions}","partitions":{"Partitions":[{"Id":"stream","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"htcmock","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"default","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"},{"Id":"bench","ParentPartitionIds":[],"PodReserved":1,"PodMax":100,"PodConfiguration":[],"PreemptionPercentage":50,"Priority":1,"$type":"PartitionRaw"}],"Page":0,"PageSize":10,"Total":4,"$type":"ListPartitionsResponse"},"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:18:11.6835356Z","@mt":"Session Id : {sessionId}","sessionId":"99b011c1-fe6b-460a-a91b-0ad07f96c2c3","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:23.6990978Z","@mt":"Results retrieved {number}","number":5000,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:23.7310077Z","@mt":"executions stats {@stats}","stats":{"ElapsedTime":"00:01:12.0439095","SubmissionTime":"00:00:12.4182442","TasksExecutionTime":"00:00:46.1106839","ResultRetrievingTime":"00:00:13.4870304","CountExecutionTime":"00:00:00.0304402","TotalTasks":5000,"ErrorTasks":0,"CompletedTasks":5000,"CancelledTasks":0,"$type":"ExecutionStats"},"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:24.2191248Z","@mt":"Ratio between time spent on a task and processing time {min}, {max}, {avg}","min":0.3793103448275862,"max":0.6764705882352942,"avg":0.621100069976184,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:24.2231912Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Creating","status2":"Submitted","min":0.07,"max":0.084,"avg":0.07484,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:24.2236946Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Processing","min":0.006,"max":0.032,"avg":0.010040000000000004,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:24.2238927Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Processing","status2":"Completed","min":0.017,"max":0.026,"avg":0.022500000000000013,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:24.2240359Z","@mt":"Time spent between {status1} and {status2} : {min}s, {max}s, {avg}s","status1":"Dispatched","status2":"Completed","min":0.025,"max":0.054,"avg":0.032540000000000006,"SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:24.2256817Z","@mt":"Throughput for session {session} : {sessionThroughput} task/s (completed {nTasks}, total {total} tasks in {timespan})","session":"99b011c1-fe6b-460a-a91b-0ad07f96c2c3","sessionThroughput":4.687353520202494,"nTasks":50,"total":50,"timespan":"00:00:10.6670000","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} -{"@t":"2023-07-10T09:19:24.7135091Z","@mt":"Throughput during session {session} : {throughput} task/s ({nTasks} tasks in {timespan})","session":"99b011c1-fe6b-460a-a91b-0ad07f96c2c3","throughput":4.687353520202494,"nTasks":50,"timespan":"00:00:10.6670000","SourceContext":"Bench Program","benchOptions":{"NTasks":5000,"TaskDurationMs":1,"PayloadSize":1,"ResultSize":1,"BatchSize":50,"TaskRpcException":"","TaskError":"","Partition":"bench","ShowEvents":false,"MaxRetries":5,"DegreeOfParallelism":5,"$type":"BenchOptions"}} From 7308540a67cb6f5d227e7af4ac562d446c8b531e Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 14:41:09 +0200 Subject: [PATCH 26/38] variabilize nb pods --- test/bench/python_scripts/cleaner.py | 5 ++++- test/bench/python_scripts/merge_jsons.py | 2 +- test/htcmock/python_scripts/cleaner.py | 5 ++++- test/htcmock/python_scripts/merge_jsons.py | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/bench/python_scripts/cleaner.py b/test/bench/python_scripts/cleaner.py index 550c151b4..e2fd499dd 100755 --- a/test/bench/python_scripts/cleaner.py +++ b/test/bench/python_scripts/cleaner.py @@ -2,7 +2,10 @@ import json import re +import subprocess +nb_pods = subprocess.run("kubectl get pod -n armonik | grep htcmock | wc -l",shell=True, stdout=subprocess.PIPE).stdout.decode('utf-8') +nb_pods = int(nb_pods) def clean_file(file): lines = [] @@ -23,7 +26,7 @@ def clean_file(file): keep_options.append(jline["benchOptions"]) if "sessionThroughput" in jline: keep_tput.append(jline["sessionThroughput"]) - dic_json = [{"Test": "bench"} | stats | options | {"throughput": tput, "nb_pods": 100} for stats, tput, options in + dic_json = [{"Test": "bench"} | stats | options | {"throughput": tput, "nb_pods": nb_pods} for stats, tput, options in zip(keep_stats, keep_tput, keep_options)] # write a clean json file with needed data diff --git a/test/bench/python_scripts/merge_jsons.py b/test/bench/python_scripts/merge_jsons.py index cafd2dfaa..fc6ecfbf7 100755 --- a/test/bench/python_scripts/merge_jsons.py +++ b/test/bench/python_scripts/merge_jsons.py @@ -4,7 +4,7 @@ import re from jsonmerge import merge -with open("../../../../../versions.tfvars.json", "r") as versions: +with open("../../../versions.tfvars.json", "r") as versions: infra = json.load(versions) with open("../stats/test_env.json", "r") as test_env: env = (json.load(test_env)) diff --git a/test/htcmock/python_scripts/cleaner.py b/test/htcmock/python_scripts/cleaner.py index 1ba63fed1..d1e0282bf 100755 --- a/test/htcmock/python_scripts/cleaner.py +++ b/test/htcmock/python_scripts/cleaner.py @@ -2,7 +2,10 @@ import json import re +import subprocess +nb_pods = subprocess.run("kubectl get pod -n armonik | grep htcmock | wc -l",shell=True, stdout=subprocess.PIPE).stdout.decode('utf-8') +nb_pods = int(nb_pods) def clean_file(file): lines = [] @@ -24,7 +27,7 @@ def clean_file(file): keep_stats.append(jline) if "throughput" in jline: keep_tput.append(jline) - dic_json = [{"Test": "htcmock"} | stats | {"configuration": conf, "throughput": tput, "nb_pods": 100} for + dic_json = [{"Test": "htcmock"} | stats | {"configuration": conf, "throughput": tput, "nb_pods": nb_pods} for stats, conf, tput in zip(keep_stats, keep_config, keep_tput)] # write a clean json file with needed data diff --git a/test/htcmock/python_scripts/merge_jsons.py b/test/htcmock/python_scripts/merge_jsons.py index 6089868b7..339d59679 100755 --- a/test/htcmock/python_scripts/merge_jsons.py +++ b/test/htcmock/python_scripts/merge_jsons.py @@ -4,7 +4,7 @@ import re from jsonmerge import merge -with open("../../../../../versions.tfvars.json", "r") as versions: +with open("../../../versions.tfvars.json", "r") as versions: infra = json.load(versions) with open("../stats/test_env.json", "r") as test_env: env = json.load(test_env) From a8ce0b4cf98bb0e363f0e72a938eb225d46a6ba1 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 15:13:25 +0200 Subject: [PATCH 27/38] rename files and folders --- .../cleaner.py | 0 .../merge-jsons.py} | 2 +- .../wjson.py | 0 .../stats/{test_env.json => test-env.json} | 0 .../bench-100k.sh} | 0 .../bench-10k.sh} | 0 .../bench_1k.sh => test-scripts/bench-1k.sh} | 0 .../bench_5k.sh => test-scripts/bench-5k.sh} | 0 test/bench/test-scripts/test.sh | 20 +++++++++++++++++++ test/bench/test_scripts/test.sh | 20 ------------------- .../cleaner.py | 0 .../merge-jsons.py} | 2 +- .../stats/{test_env.json => test-env.json} | 0 .../htcmock-5k.sh} | 0 test/htcmock/test-scripts/test.sh | 19 ++++++++++++++++++ test/htcmock/test_scripts/test.sh | 19 ------------------ 16 files changed, 41 insertions(+), 41 deletions(-) rename test/bench/{python_scripts => python-scripts}/cleaner.py (100%) rename test/bench/{python_scripts/merge_jsons.py => python-scripts/merge-jsons.py} (92%) rename test/bench/{python_scripts => python-scripts}/wjson.py (100%) rename test/bench/stats/{test_env.json => test-env.json} (100%) rename test/bench/{test_scripts/bench_100k.sh => test-scripts/bench-100k.sh} (100%) rename test/bench/{test_scripts/bench_10k.sh => test-scripts/bench-10k.sh} (100%) rename test/bench/{test_scripts/bench_1k.sh => test-scripts/bench-1k.sh} (100%) rename test/bench/{test_scripts/bench_5k.sh => test-scripts/bench-5k.sh} (100%) create mode 100755 test/bench/test-scripts/test.sh delete mode 100755 test/bench/test_scripts/test.sh rename test/htcmock/{python_scripts => python-scripts}/cleaner.py (100%) rename test/htcmock/{python_scripts/merge_jsons.py => python-scripts/merge-jsons.py} (88%) rename test/htcmock/stats/{test_env.json => test-env.json} (100%) rename test/htcmock/{test_scripts/htcmock_5k.sh => test-scripts/htcmock-5k.sh} (100%) create mode 100755 test/htcmock/test-scripts/test.sh delete mode 100755 test/htcmock/test_scripts/test.sh diff --git a/test/bench/python_scripts/cleaner.py b/test/bench/python-scripts/cleaner.py similarity index 100% rename from test/bench/python_scripts/cleaner.py rename to test/bench/python-scripts/cleaner.py diff --git a/test/bench/python_scripts/merge_jsons.py b/test/bench/python-scripts/merge-jsons.py similarity index 92% rename from test/bench/python_scripts/merge_jsons.py rename to test/bench/python-scripts/merge-jsons.py index fc6ecfbf7..2a1c9c9a7 100755 --- a/test/bench/python_scripts/merge_jsons.py +++ b/test/bench/python-scripts/merge-jsons.py @@ -6,7 +6,7 @@ with open("../../../versions.tfvars.json", "r") as versions: infra = json.load(versions) -with open("../stats/test_env.json", "r") as test_env: +with open("../stats/test-env.json", "r") as test_env: env = (json.load(test_env)) with open("../stats/1k.json", "r") as stats: result_1k = json.load(stats) diff --git a/test/bench/python_scripts/wjson.py b/test/bench/python-scripts/wjson.py similarity index 100% rename from test/bench/python_scripts/wjson.py rename to test/bench/python-scripts/wjson.py diff --git a/test/bench/stats/test_env.json b/test/bench/stats/test-env.json similarity index 100% rename from test/bench/stats/test_env.json rename to test/bench/stats/test-env.json diff --git a/test/bench/test_scripts/bench_100k.sh b/test/bench/test-scripts/bench-100k.sh similarity index 100% rename from test/bench/test_scripts/bench_100k.sh rename to test/bench/test-scripts/bench-100k.sh diff --git a/test/bench/test_scripts/bench_10k.sh b/test/bench/test-scripts/bench-10k.sh similarity index 100% rename from test/bench/test_scripts/bench_10k.sh rename to test/bench/test-scripts/bench-10k.sh diff --git a/test/bench/test_scripts/bench_1k.sh b/test/bench/test-scripts/bench-1k.sh similarity index 100% rename from test/bench/test_scripts/bench_1k.sh rename to test/bench/test-scripts/bench-1k.sh diff --git a/test/bench/test_scripts/bench_5k.sh b/test/bench/test-scripts/bench-5k.sh similarity index 100% rename from test/bench/test_scripts/bench_5k.sh rename to test/bench/test-scripts/bench-5k.sh diff --git a/test/bench/test-scripts/test.sh b/test/bench/test-scripts/test.sh new file mode 100755 index 000000000..1171874fd --- /dev/null +++ b/test/bench/test-scripts/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# warm up run +./bench-1k.sh + +#clearmeasured runs +./bench-1k.sh >> ../stats/1k.json && ./bench-5k.sh >> ../stats/5k.json && ./bench-10k.sh >> ../stats/10k.json && ./bench-100k.sh >> ../stats/100k.json +#clean the output file +../python-scripts/cleaner.py + +#merge json files +../python-scripts/merge-jsons.py + +# save and print pretty json file +jq . ../stats/results.json > ../stats/pretty-results.json +jq . ../stats/pretty-results.json + +#print the test stats and plot graphs +#../python-scripts/wjson.py + diff --git a/test/bench/test_scripts/test.sh b/test/bench/test_scripts/test.sh deleted file mode 100755 index 23bc4cd7d..000000000 --- a/test/bench/test_scripts/test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# warm up run -./bench_1k.sh - -#clearmeasured runs -./bench_1k.sh >> ../stats/1k.json && ./bench_5k.sh >> ../stats/5k.json && ./bench_10k.sh >> ../stats/10k.json && ./bench_100k.sh >> ../stats/100k.json -#clean the output file -../python_scripts/cleaner.py - -#merge json files -../python_scripts/merge_jsons.py - -# save and print pretty json file -jq . ../stats/results.json > ../stats/pretty_results.json -jq . ../stats/pretty_results.json - -#print the test stats and plot graphs -#../python_scripts/wjson.py - diff --git a/test/htcmock/python_scripts/cleaner.py b/test/htcmock/python-scripts/cleaner.py similarity index 100% rename from test/htcmock/python_scripts/cleaner.py rename to test/htcmock/python-scripts/cleaner.py diff --git a/test/htcmock/python_scripts/merge_jsons.py b/test/htcmock/python-scripts/merge-jsons.py similarity index 88% rename from test/htcmock/python_scripts/merge_jsons.py rename to test/htcmock/python-scripts/merge-jsons.py index 339d59679..d5f884c8c 100755 --- a/test/htcmock/python_scripts/merge_jsons.py +++ b/test/htcmock/python-scripts/merge-jsons.py @@ -6,7 +6,7 @@ with open("../../../versions.tfvars.json", "r") as versions: infra = json.load(versions) -with open("../stats/test_env.json", "r") as test_env: +with open("../stats/test-env.json", "r") as test_env: env = json.load(test_env) with open("../stats/5k.json", "r") as stats: result_5k = json.load(stats) diff --git a/test/htcmock/stats/test_env.json b/test/htcmock/stats/test-env.json similarity index 100% rename from test/htcmock/stats/test_env.json rename to test/htcmock/stats/test-env.json diff --git a/test/htcmock/test_scripts/htcmock_5k.sh b/test/htcmock/test-scripts/htcmock-5k.sh similarity index 100% rename from test/htcmock/test_scripts/htcmock_5k.sh rename to test/htcmock/test-scripts/htcmock-5k.sh diff --git a/test/htcmock/test-scripts/test.sh b/test/htcmock/test-scripts/test.sh new file mode 100755 index 000000000..a1fce4911 --- /dev/null +++ b/test/htcmock/test-scripts/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# warm up run +./htcmock-5k.sh + +#clearmeasured runs +./htcmock-5k.sh >> ../stats/5k.json +#clean the output file +../python-scripts/cleaner.py + +#merge json files +../python-scripts/merge-jsons.py + +# save and print pretty json file +jq . ../stats/results.json > ../stats/pretty-results.json +jq . ../stats/pretty-results.json + +#print the test stats and plot graphs +#../python-scripts/wjson.py \ No newline at end of file diff --git a/test/htcmock/test_scripts/test.sh b/test/htcmock/test_scripts/test.sh deleted file mode 100755 index 6a76cbcd7..000000000 --- a/test/htcmock/test_scripts/test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# warm up run -./htcmock_5k.sh - -#clearmeasured runs -./htcmock_5k.sh >> ../stats/5k.json -#clean the output file -../python_scripts/cleaner.py - -#merge json files -../python_scripts/merge_jsons.py - -# save and print pretty json file -jq . ../stats/results.json > ../stats/pretty_results.json -jq . ../stats/pretty_results.json - -#print the test stats and plot graphs -#../python_scripts/wjson.py From 72ecd1c335952dbc1b3b583438c8c666fd2c5bfa Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 15:39:33 +0200 Subject: [PATCH 28/38] update doc --- test/README.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/test/README.md b/test/README.md index 67923b09c..3f2eefb5c 100644 --- a/test/README.md +++ b/test/README.md @@ -3,34 +3,37 @@ This document describes how to use the benchmarking scripts. Those tests are an example of benchmarking tests using bench and htcmock to measure the performances of ArmoniK. -We have to deploy ArmoniK on aws using the parameters file in aws-benchmark folder to deploy ArmoniK with two partitions (bench and htcmock) with 100 pods for each partition. +We have to deploy ArmoniK on aws using the parameters file in aws-benchmark folder to deploy ArmoniK with two partitions (bench and htcmock) with 100 pods or 1000 pods for each partition. + +Example : ArmoniK with 100 pods of bench and htcmock partitions +in quickdeploy/aws/all repository, execute this command : +```console +user@user:~$ make deploy PARAMETERS_FILE=/ArmoniK/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars +```
 .
 ├── bench
-│   ├── python_scripts
+│   ├── python-scripts
 │   │   ├── cleaner.py
-│   │   ├── merge_jsons.py
+│   │   ├── merge-jsons.py
 │   │   └── wjson.py
 │   ├── stats
-│   │   ├── 10k.json
-│   │   ├── 1k.json
-│   │   ├── 5k.json
-│   │   └── test_env.json
+│   │   └── test-env.json
 │   └── test_scripts
-│       ├── bench_100k.sh
-│       ├── bench_10k.sh
-│       ├── bench_1k.sh
-│       ├── bench_5k.sh
+│       ├── bench-100k.sh
+│       ├── bench-10k.sh
+│       ├── bench-1k.sh
+│       ├── bench-5k.sh
 │       └── test.sh
 ├── htcmock
-│   ├── python_scripts
+│   ├── python-scripts
 │   │   ├── cleaner.py
-│   │   └── merge_jsons.py
+│   │   └── merge-jsons.py
 │   ├── stats
-│   │   └── test_env.json
-│   └── test_scripts
-│       ├── htcmock_5k.sh
+│   │   └── test-env.json
+│   └── test-scripts
+│       ├── htcmock-5k.sh
 │       └── test.sh
 └── README.md
 

From aad332acb47aa4f649dfa1f6e646a13f07e1abd7 Mon Sep 17 00:00:00 2001
From: YKharouni 
Date: Mon, 10 Jul 2023 15:42:14 +0200
Subject: [PATCH 29/38] move tests folder

---
 {test => benchmarking/tests}/README.md                            | 0
 {test => benchmarking/tests}/bench/python-scripts/cleaner.py      | 0
 {test => benchmarking/tests}/bench/python-scripts/merge-jsons.py  | 0
 {test => benchmarking/tests}/bench/python-scripts/wjson.py        | 0
 {test => benchmarking/tests}/bench/stats/test-env.json            | 0
 {test => benchmarking/tests}/bench/test-scripts/bench-100k.sh     | 0
 {test => benchmarking/tests}/bench/test-scripts/bench-10k.sh      | 0
 {test => benchmarking/tests}/bench/test-scripts/bench-1k.sh       | 0
 {test => benchmarking/tests}/bench/test-scripts/bench-5k.sh       | 0
 {test => benchmarking/tests}/bench/test-scripts/test.sh           | 0
 {test => benchmarking/tests}/htcmock/python-scripts/cleaner.py    | 0
 .../tests}/htcmock/python-scripts/merge-jsons.py                  | 0
 {test => benchmarking/tests}/htcmock/stats/test-env.json          | 0
 {test => benchmarking/tests}/htcmock/test-scripts/htcmock-5k.sh   | 0
 {test => benchmarking/tests}/htcmock/test-scripts/test.sh         | 0
 15 files changed, 0 insertions(+), 0 deletions(-)
 rename {test => benchmarking/tests}/README.md (100%)
 rename {test => benchmarking/tests}/bench/python-scripts/cleaner.py (100%)
 rename {test => benchmarking/tests}/bench/python-scripts/merge-jsons.py (100%)
 rename {test => benchmarking/tests}/bench/python-scripts/wjson.py (100%)
 rename {test => benchmarking/tests}/bench/stats/test-env.json (100%)
 rename {test => benchmarking/tests}/bench/test-scripts/bench-100k.sh (100%)
 rename {test => benchmarking/tests}/bench/test-scripts/bench-10k.sh (100%)
 rename {test => benchmarking/tests}/bench/test-scripts/bench-1k.sh (100%)
 rename {test => benchmarking/tests}/bench/test-scripts/bench-5k.sh (100%)
 rename {test => benchmarking/tests}/bench/test-scripts/test.sh (100%)
 rename {test => benchmarking/tests}/htcmock/python-scripts/cleaner.py (100%)
 rename {test => benchmarking/tests}/htcmock/python-scripts/merge-jsons.py (100%)
 rename {test => benchmarking/tests}/htcmock/stats/test-env.json (100%)
 rename {test => benchmarking/tests}/htcmock/test-scripts/htcmock-5k.sh (100%)
 rename {test => benchmarking/tests}/htcmock/test-scripts/test.sh (100%)

diff --git a/test/README.md b/benchmarking/tests/README.md
similarity index 100%
rename from test/README.md
rename to benchmarking/tests/README.md
diff --git a/test/bench/python-scripts/cleaner.py b/benchmarking/tests/bench/python-scripts/cleaner.py
similarity index 100%
rename from test/bench/python-scripts/cleaner.py
rename to benchmarking/tests/bench/python-scripts/cleaner.py
diff --git a/test/bench/python-scripts/merge-jsons.py b/benchmarking/tests/bench/python-scripts/merge-jsons.py
similarity index 100%
rename from test/bench/python-scripts/merge-jsons.py
rename to benchmarking/tests/bench/python-scripts/merge-jsons.py
diff --git a/test/bench/python-scripts/wjson.py b/benchmarking/tests/bench/python-scripts/wjson.py
similarity index 100%
rename from test/bench/python-scripts/wjson.py
rename to benchmarking/tests/bench/python-scripts/wjson.py
diff --git a/test/bench/stats/test-env.json b/benchmarking/tests/bench/stats/test-env.json
similarity index 100%
rename from test/bench/stats/test-env.json
rename to benchmarking/tests/bench/stats/test-env.json
diff --git a/test/bench/test-scripts/bench-100k.sh b/benchmarking/tests/bench/test-scripts/bench-100k.sh
similarity index 100%
rename from test/bench/test-scripts/bench-100k.sh
rename to benchmarking/tests/bench/test-scripts/bench-100k.sh
diff --git a/test/bench/test-scripts/bench-10k.sh b/benchmarking/tests/bench/test-scripts/bench-10k.sh
similarity index 100%
rename from test/bench/test-scripts/bench-10k.sh
rename to benchmarking/tests/bench/test-scripts/bench-10k.sh
diff --git a/test/bench/test-scripts/bench-1k.sh b/benchmarking/tests/bench/test-scripts/bench-1k.sh
similarity index 100%
rename from test/bench/test-scripts/bench-1k.sh
rename to benchmarking/tests/bench/test-scripts/bench-1k.sh
diff --git a/test/bench/test-scripts/bench-5k.sh b/benchmarking/tests/bench/test-scripts/bench-5k.sh
similarity index 100%
rename from test/bench/test-scripts/bench-5k.sh
rename to benchmarking/tests/bench/test-scripts/bench-5k.sh
diff --git a/test/bench/test-scripts/test.sh b/benchmarking/tests/bench/test-scripts/test.sh
similarity index 100%
rename from test/bench/test-scripts/test.sh
rename to benchmarking/tests/bench/test-scripts/test.sh
diff --git a/test/htcmock/python-scripts/cleaner.py b/benchmarking/tests/htcmock/python-scripts/cleaner.py
similarity index 100%
rename from test/htcmock/python-scripts/cleaner.py
rename to benchmarking/tests/htcmock/python-scripts/cleaner.py
diff --git a/test/htcmock/python-scripts/merge-jsons.py b/benchmarking/tests/htcmock/python-scripts/merge-jsons.py
similarity index 100%
rename from test/htcmock/python-scripts/merge-jsons.py
rename to benchmarking/tests/htcmock/python-scripts/merge-jsons.py
diff --git a/test/htcmock/stats/test-env.json b/benchmarking/tests/htcmock/stats/test-env.json
similarity index 100%
rename from test/htcmock/stats/test-env.json
rename to benchmarking/tests/htcmock/stats/test-env.json
diff --git a/test/htcmock/test-scripts/htcmock-5k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-5k.sh
similarity index 100%
rename from test/htcmock/test-scripts/htcmock-5k.sh
rename to benchmarking/tests/htcmock/test-scripts/htcmock-5k.sh
diff --git a/test/htcmock/test-scripts/test.sh b/benchmarking/tests/htcmock/test-scripts/test.sh
similarity index 100%
rename from test/htcmock/test-scripts/test.sh
rename to benchmarking/tests/htcmock/test-scripts/test.sh

From 1d139b81df72ee2ca12b248b9840350f93301c5a Mon Sep 17 00:00:00 2001
From: YKharouni 
Date: Mon, 10 Jul 2023 16:36:58 +0200
Subject: [PATCH 30/38] add tests scripts

---
 benchmarking/tests/README.md                  | 44 ++++++++++++-------
 .../tests/bench/python-scripts/cleaner.py     | 11 +++--
 .../tests/bench/python-scripts/merge-jsons.py |  4 +-
 .../tests/bench/python-scripts/wjson.py       |  3 +-
 .../tests/bench/test-scripts/bench-1m.sh      | 17 +++++++
 benchmarking/tests/bench/test-scripts/test.sh |  2 +-
 .../tests/htcmock/python-scripts/cleaner.py   | 13 +++++-
 .../htcmock/python-scripts/merge-jsons.py     | 12 ++++-
 .../htcmock/test-scripts/htcmock-100k.sh      | 16 +++++++
 .../tests/htcmock/test-scripts/htcmock-10k.sh | 16 +++++++
 .../tests/htcmock/test-scripts/htcmock-1k.sh  | 16 +++++++
 .../tests/htcmock/test-scripts/htcmock-1m.sh  | 16 +++++++
 .../tests/htcmock/test-scripts/test.sh        |  4 +-
 13 files changed, 146 insertions(+), 28 deletions(-)
 create mode 100755 benchmarking/tests/bench/test-scripts/bench-1m.sh
 create mode 100755 benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh
 create mode 100755 benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh
 create mode 100755 benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh
 create mode 100755 benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh

diff --git a/benchmarking/tests/README.md b/benchmarking/tests/README.md
index 3f2eefb5c..cff1b3f22 100644
--- a/benchmarking/tests/README.md
+++ b/benchmarking/tests/README.md
@@ -2,14 +2,23 @@
 
 This document describes how to use the benchmarking scripts.
 
-Those tests are an example of benchmarking tests using bench and htcmock to measure the performances of ArmoniK.  
-We have to deploy ArmoniK on aws using the parameters file in aws-benchmark folder to deploy ArmoniK with two partitions (bench and htcmock) with 100 pods or 1000 pods for each partition.
-
-Example : ArmoniK with 100 pods of bench and htcmock partitions  
-in quickdeploy/aws/all repository, execute this command :  
-```console
-user@user:~$ make deploy PARAMETERS_FILE=/ArmoniK/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars
+These tests are examples of benchmarking based on  Bench and HtcMock tests to measure the performances of ArmoniK.   
+We have to deploy ArmoniK on AWS cloud using the parameters files saved in folder [aws-benchmark](https://github.com/aneoconsulting/ArmoniK/tree/main/benchmarking_scripts/infrastructure/quick-deploy/aws-benchmark) to deploy ArmoniK with two partitions (bench and htcmock) with 100 pods or 1000 pods for each partition.
+
+# Deploy ArmoniK on AWS cloud  
+To deploy ArmoniK on AWS cloud with 100 pods of compute plane, from the root of the repository : 
+```bash
+cd infrastructure/quick-deploy/aws/all  
+make deploy PARAMETERS_FILE=/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars
 ```
+To deploy ArmoniK on AWS cloud with 1000 pods of compute plane, from the root of the repository : 
+```bash
+cd infrastructure/quick-deploy/aws/all  
+make deploy PARAMETERS_FILE=/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars
+```
+# Global view test scripts tree
+
+From the root of the repository, the scripts of bench and htcmock tests are in [benchmarking/tests](https://github.com/aneoconsulting/ArmoniK/tree/main/benchmarking/tests) as follows : 
 
 
 .
@@ -25,6 +34,7 @@ user@user:~$ make deploy PARAMETERS_FILE=/ArmoniK/infrastructur
 │       ├── bench-10k.sh
 │       ├── bench-1k.sh
 │       ├── bench-5k.sh
+│       ├── htcmock-1m.sh
 │       └── test.sh
 ├── htcmock
 │   ├── python-scripts
@@ -33,19 +43,21 @@ user@user:~$ make deploy PARAMETERS_FILE=/ArmoniK/infrastructur
 │   ├── stats
 │   │   └── test-env.json
 │   └── test-scripts
+│       ├── htcmock-1k.sh
 │       ├── htcmock-5k.sh
+│       ├── htcmock-10k.sh
+│       ├── htcmock-100k.sh
+│       ├── htcmock-1m.sh
 │       └── test.sh
 └── README.md
-
-
 
-# Bench & Htcmock +# Bench & HtcMock -### Run the tests +## Run the tests -* bench_1k.sh & bench_5k.sh : scripts for each test where we set the parameters of the test to run. -* test.sh : script to run all the tests cases and store the results in Json files. +* `bench-1k.sh`, `bench-5k.sh`, `bench-10k.sh`, `bench-100k.sh` and `bench-1m.sh`: bash scripts to launch bench tests with 1000 tasks, 5000 tasks, 10000 tasks and 100000 tasks, respectively. In addition, you can modify in the scripts other parameters like workload time, io size, ... +* `test.sh` : script to run all the tests cases and store the results in Json files. ### Clean the output @@ -54,8 +66,8 @@ user@user:~$ make deploy PARAMETERS_FILE=/ArmoniK/infrastructur * merge_jsons.py : merges the cleaned results files with the parameters json file of the tested version of ArmoniK and est_env.json file (third party components of ArmoniK). * prerequisites: install jsonmerge -```console -user@user:~$ pip install jsonmerge +```bash +pip install jsonmerge ``` @@ -73,7 +85,7 @@ user@user:~$ pip install jsonmerge the outputs, clean them and merge them with the environment and infrastructure description files. ```console -user@user:~$ ./test.sh +./test.sh ``` # Stresstest : diff --git a/benchmarking/tests/bench/python-scripts/cleaner.py b/benchmarking/tests/bench/python-scripts/cleaner.py index e2fd499dd..fbb906f37 100755 --- a/benchmarking/tests/bench/python-scripts/cleaner.py +++ b/benchmarking/tests/bench/python-scripts/cleaner.py @@ -4,9 +4,11 @@ import re import subprocess -nb_pods = subprocess.run("kubectl get pod -n armonik | grep htcmock | wc -l",shell=True, stdout=subprocess.PIPE).stdout.decode('utf-8') +nb_pods = subprocess.run("kubectl get pod -n armonik | grep htcmock | wc -l", shell=True, + stdout=subprocess.PIPE).stdout.decode('utf-8') nb_pods = int(nb_pods) + def clean_file(file): lines = [] keep_stats = [] @@ -26,7 +28,8 @@ def clean_file(file): keep_options.append(jline["benchOptions"]) if "sessionThroughput" in jline: keep_tput.append(jline["sessionThroughput"]) - dic_json = [{"Test": "bench"} | stats | options | {"throughput": tput, "nb_pods": nb_pods} for stats, tput, options in + dic_json = [{"Test": "bench"} | stats | options | {"throughput": tput, "nb_pods": nb_pods} for stats, tput, options + in zip(keep_stats, keep_tput, keep_options)] # write a clean json file with needed data @@ -42,4 +45,6 @@ def clean_file(file): file = "../stats/10k.json" clean_file(file) file = "../stats/100k.json" -clean_file(file) \ No newline at end of file +clean_file(file) +file = "../stats/1m.json" +clean_file(file) diff --git a/benchmarking/tests/bench/python-scripts/merge-jsons.py b/benchmarking/tests/bench/python-scripts/merge-jsons.py index 2a1c9c9a7..eb5198ff3 100755 --- a/benchmarking/tests/bench/python-scripts/merge-jsons.py +++ b/benchmarking/tests/bench/python-scripts/merge-jsons.py @@ -16,7 +16,9 @@ result_10k = json.load(stats) with open("../stats/100k.json", "r") as stats: result_100k = json.load(stats) +with open("../stats/1m.json", "r") as stats: + result_1m = json.load(stats) # print(merged) with open("../stats/results.json", "w") as r: - dict_json = [merge(infra, env), result_1k, result_5k, result_10k, result_100k] + dict_json = [merge(infra, env), result_1k, result_5k, result_10k, result_100k, result_1m] json.dump(dict_json, r) diff --git a/benchmarking/tests/bench/python-scripts/wjson.py b/benchmarking/tests/bench/python-scripts/wjson.py index c5774fc4e..de2e4ae41 100755 --- a/benchmarking/tests/bench/python-scripts/wjson.py +++ b/benchmarking/tests/bench/python-scripts/wjson.py @@ -38,7 +38,7 @@ def __init__(self, file): if __name__ == "__main__": - files = ['../stats/1k.json', '../stats/5k.json', '../stats/10k.json', '../stats/100k.json'] + files = ['../stats/1k.json', '../stats/5k.json', '../stats/10k.json', '../stats/100k.json', '../stats/1m.json'] JsonFiles = [x for x in files if x.endswith(".json")] # dictionary to store the stats of each test case @@ -48,6 +48,7 @@ def __init__(self, file): cases["5k"] = TestCase(JsonFiles[1]) cases["10k"] = TestCase(JsonFiles[2]) cases["100k"] = TestCase(JsonFiles[3]) + cases["1m"] = TestCase(JsonFiles[4]) # Dictionary to store the mean of each test case mean = { diff --git a/benchmarking/tests/bench/test-scripts/bench-1m.sh b/benchmarking/tests/bench/test-scripts/bench-1m.sh new file mode 100755 index 000000000..321ba18a7 --- /dev/null +++ b/benchmarking/tests/bench/test-scripts/bench-1m.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + +#run 10000 tasks on 100 pods +docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e BenchOptions__nTasks=1000000 \ + -e BenchOptions__TaskDurationMs=1 \ + -e BenchOptions__PayloadSize=1 \ + -e BenchOptions__ResultSize=1 \ + -e BenchOptions__Partition=bench \ + -e BenchOptions__ShowEvents=false \ + -e BenchOptions__BatchSize=50 \ + -e BenchOptions__MaxRetries=5 \ + -e BenchOptions__DegreeOfParallelism=5 \ + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/benchmarking/tests/bench/test-scripts/test.sh b/benchmarking/tests/bench/test-scripts/test.sh index 1171874fd..6d572144e 100755 --- a/benchmarking/tests/bench/test-scripts/test.sh +++ b/benchmarking/tests/bench/test-scripts/test.sh @@ -4,7 +4,7 @@ ./bench-1k.sh #clearmeasured runs -./bench-1k.sh >> ../stats/1k.json && ./bench-5k.sh >> ../stats/5k.json && ./bench-10k.sh >> ../stats/10k.json && ./bench-100k.sh >> ../stats/100k.json +./bench-1k.sh >> ../stats/1k.json && ./bench-5k.sh >> ../stats/5k.json && ./bench-10k.sh >> ../stats/10k.json && ./bench-100k.sh >> ../stats/100k.json && ./bench-1m.sh >> ../stats/1m.json #clean the output file ../python-scripts/cleaner.py diff --git a/benchmarking/tests/htcmock/python-scripts/cleaner.py b/benchmarking/tests/htcmock/python-scripts/cleaner.py index d1e0282bf..582edb55e 100755 --- a/benchmarking/tests/htcmock/python-scripts/cleaner.py +++ b/benchmarking/tests/htcmock/python-scripts/cleaner.py @@ -4,9 +4,11 @@ import re import subprocess -nb_pods = subprocess.run("kubectl get pod -n armonik | grep htcmock | wc -l",shell=True, stdout=subprocess.PIPE).stdout.decode('utf-8') +nb_pods = subprocess.run("kubectl get pod -n armonik | grep htcmock | wc -l", shell=True, + stdout=subprocess.PIPE).stdout.decode('utf-8') nb_pods = int(nb_pods) + def clean_file(file): lines = [] keep_stats = [] @@ -35,7 +37,14 @@ def clean_file(file): json.dump(dic_json, f) - # clean_file(file) +file = "../stats/1k.json" +clean_file(file) file = "../stats/5k.json" clean_file(file) +file = "../stats/10k.json" +clean_file(file) +file = "../stats/100k.json" +clean_file(file) +file = "../stats/1m.json" +clean_file(file) diff --git a/benchmarking/tests/htcmock/python-scripts/merge-jsons.py b/benchmarking/tests/htcmock/python-scripts/merge-jsons.py index d5f884c8c..47f0d7d8e 100755 --- a/benchmarking/tests/htcmock/python-scripts/merge-jsons.py +++ b/benchmarking/tests/htcmock/python-scripts/merge-jsons.py @@ -8,9 +8,17 @@ infra = json.load(versions) with open("../stats/test-env.json", "r") as test_env: env = json.load(test_env) +with open("../stats/1k.json", "r") as stats: + result_1k = json.load(stats) with open("../stats/5k.json", "r") as stats: result_5k = json.load(stats) -with open("../stats/results.json", "w") as r: +with open("../stats/10k.json", "r") as stats: + result_10k = json.load(stats) +with open("../stats/100k.json", "r") as stats: + result_100k = json.load(stats) +with open("../stats/1m.json", "r") as stats: + result_1m = json.load(stats) - dict_json = [merge(infra, env), result_5k] +with open("../stats/results.json", "w") as r: + dict_json = [merge(infra, env), result_1k, result_5k, result_10k, result_100k, result_1m] json.dump(dict_json, r) diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh new file mode 100755 index 000000000..713add5ed --- /dev/null +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + + docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e HtcMock__NTasks=100000 \ + -e HtcMock__TotalCalculationTime=01:00:00.00 \ + -e HtcMock__DataSize=1 \ + -e HtcMock__MemorySize=1 \ + -e HtcMock__SubTasksLevels=4 \ + -e HtcMock__EnableUseLowMem=true \ + -e HtcMock__EnableSmallOutput=true \ + -e HtcMock__EnableFastCompute=true \ + -e HtcMock__Partition="htcmock" \ + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh new file mode 100755 index 000000000..80a0c2982 --- /dev/null +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + + docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e HtcMock__NTasks=10000 \ + -e HtcMock__TotalCalculationTime=01:00:00.00 \ + -e HtcMock__DataSize=1 \ + -e HtcMock__MemorySize=1 \ + -e HtcMock__SubTasksLevels=4 \ + -e HtcMock__EnableUseLowMem=true \ + -e HtcMock__EnableSmallOutput=true \ + -e HtcMock__EnableFastCompute=true \ + -e HtcMock__Partition="htcmock" \ + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh new file mode 100755 index 000000000..73705d20a --- /dev/null +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + + docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e HtcMock__NTasks=1000 \ + -e HtcMock__TotalCalculationTime=01:00:00.00 \ + -e HtcMock__DataSize=1 \ + -e HtcMock__MemorySize=1 \ + -e HtcMock__SubTasksLevels=4 \ + -e HtcMock__EnableUseLowMem=true \ + -e HtcMock__EnableSmallOutput=true \ + -e HtcMock__EnableFastCompute=true \ + -e HtcMock__Partition="htcmock" \ + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh new file mode 100755 index 000000000..8298a88af --- /dev/null +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') + + docker run --rm \ + -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ + -e HtcMock__NTasks=1000000 \ + -e HtcMock__TotalCalculationTime=01:00:00.00 \ + -e HtcMock__DataSize=1 \ + -e HtcMock__MemorySize=1 \ + -e HtcMock__SubTasksLevels=4 \ + -e HtcMock__EnableUseLowMem=true \ + -e HtcMock__EnableSmallOutput=true \ + -e HtcMock__EnableFastCompute=true \ + -e HtcMock__Partition="htcmock" \ + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/test.sh b/benchmarking/tests/htcmock/test-scripts/test.sh index a1fce4911..1e25b6e0f 100755 --- a/benchmarking/tests/htcmock/test-scripts/test.sh +++ b/benchmarking/tests/htcmock/test-scripts/test.sh @@ -1,10 +1,10 @@ #!/bin/bash # warm up run -./htcmock-5k.sh +./htcmock-1k.sh #clearmeasured runs -./htcmock-5k.sh >> ../stats/5k.json +./htcmock-1k.sh >> ../stats/1k.json && ./htcmock-5k.sh >> ../stats/5k.json && ./htcmock-10k.sh >> ../stats/10k.json && ./htcmock-100k.sh >> ../stats/100k.json && ./htcmock-1m.sh >> ../stats/1m.json #clean the output file ../python-scripts/cleaner.py From 64e81982809b5dbfe6f7868deb26c09708998ac6 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 17:58:05 +0200 Subject: [PATCH 31/38] update doc --- benchmarking/tests/README.md | 4 ++-- benchmarking/tests/bench/python-scripts/wjson.py | 10 +++++----- benchmarking/tests/bench/stats/test-env.json | 2 +- benchmarking/tests/htcmock/stats/test-env.json | 2 +- .../aws-benchmark/parameters_1000pods.tfvars | 12 ++++++------ .../aws-benchmark/parameters_100pods.tfvars | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/benchmarking/tests/README.md b/benchmarking/tests/README.md index cff1b3f22..cee4b4c2e 100644 --- a/benchmarking/tests/README.md +++ b/benchmarking/tests/README.md @@ -56,8 +56,8 @@ From the root of the repository, the scripts of bench and htcmock tests are in [ ## Run the tests -* `bench-1k.sh`, `bench-5k.sh`, `bench-10k.sh`, `bench-100k.sh` and `bench-1m.sh`: bash scripts to launch bench tests with 1000 tasks, 5000 tasks, 10000 tasks and 100000 tasks, respectively. In addition, you can modify in the scripts other parameters like workload time, io size, ... -* `test.sh` : script to run all the tests cases and store the results in Json files. +* * `bench-1k.sh`, `bench-5k.sh`, `bench-10k.sh`, `bench-100k.sh` and `bench-1m.sh`: bash scripts to launch bench tests with 1000 tasks, 5000 tasks, 10000 tasks, 100000 tasks and 1000000 tasks, respectively. In addition, you can modify in the scripts other parameters like workload time, io size, ... +* `test.sh` : script to run all the tests cases listed above and store the results in JSON files. ### Clean the output diff --git a/benchmarking/tests/bench/python-scripts/wjson.py b/benchmarking/tests/bench/python-scripts/wjson.py index de2e4ae41..0fdb24fb8 100755 --- a/benchmarking/tests/bench/python-scripts/wjson.py +++ b/benchmarking/tests/bench/python-scripts/wjson.py @@ -72,13 +72,13 @@ def __init__(self, file): for file in files: filename = file.split(".")[0] print('Degree of parallelism of retrieving time is : ' + str(cases[filename].d_parallel[0])) - print('mean total time for treatement of ' + filename + ' tasks on 100 pods is : ' + str( + print('mean total time for treatement of ' + filename + ' tasks is : ' + str( mean["time"][filename]) + ' s') - print('mean time of the execution of ' + filename + ' tasks on 100 pods is : ' + str( + print('mean time of the execution of ' + filename + ' tasks is : ' + str( mean["exec_time"][filename]) + ' s') - print('mean time of the submission of ' + filename + ' tasks on 100 pods is : ' + str( + print('mean time of the submission of ' + filename + ' tasks is : ' + str( mean["sub_time"][filename]) + ' s') - print('mean time of the retrieving of ' + filename + ' tasks on 100 pods is : ' + str( + print('mean time of the retrieving of ' + filename + ' tasks is : ' + str( mean["retrv_time"][filename]) + ' s') - print('mean throughput for ' + filename + ' tasks on 100 pods is : ' + str( + print('mean throughput for ' + filename + ' tasks is : ' + str( mean["throughput"][filename]) + " tasks/s \n") diff --git a/benchmarking/tests/bench/stats/test-env.json b/benchmarking/tests/bench/stats/test-env.json index 681e378d2..38ad19db5 100644 --- a/benchmarking/tests/bench/stats/test-env.json +++ b/benchmarking/tests/bench/stats/test-env.json @@ -8,7 +8,7 @@ "Network_bandwidth" : "25", "EBS_bandwidth" : "19000", "Kubernetes" : "AWS EKS 1.25", - "Object_object_type" : "AWS S3", + "Object_object_type" : "Redis", "Storage_queue_storage" : "Amazon MQ, broker : ActiveMQ 5.16.4", "Storage_table_type" : "MongoDB 6.0.1", "OS" : "Linux" diff --git a/benchmarking/tests/htcmock/stats/test-env.json b/benchmarking/tests/htcmock/stats/test-env.json index 26e6981a5..e906df484 100644 --- a/benchmarking/tests/htcmock/stats/test-env.json +++ b/benchmarking/tests/htcmock/stats/test-env.json @@ -8,7 +8,7 @@ "Network_bandwidth" : "25", "EBS_bandwidth" : "19000", "Kubernetes" : "AWS EKS 1.25", - "Object_object_type" : "AWS S3", + "Object_object_type" : "Redis", "Storage_queue_storage" : "Amazon MQ, broker : ActiveMQ 5.17.0", "Storage_table_type" : "MongoDB 6.0.1", "OS" : "Linux" diff --git a/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars b/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars index 5bd858462..3fe1355a0 100644 --- a/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars +++ b/infrastructure/quick-deploy/aws-benchmark/parameters_1000pods.tfvars @@ -398,7 +398,7 @@ compute_plane = { default = { node_selector = { service = "workers" } # number of replicas for each deployment of compute plane - replicas = 1 + replicas = 1000 # ArmoniK polling agent polling_agent = { limits = { @@ -428,8 +428,8 @@ compute_plane = { type = "prometheus" polling_interval = 15 cooldown_period = 300 - min_replica_count = 1 - max_replica_count = 100 + min_replica_count = 1000 + max_replica_count = 1000 behavior = { restore_to_original_replica_count = true stabilization_window_seconds = 300 @@ -449,7 +449,7 @@ compute_plane = { stream = { node_selector = { service = "workers" } # number of replicas for each deployment of compute plane - replicas = 1 + replicas = 1000 # ArmoniK polling agent polling_agent = { limits = { @@ -479,8 +479,8 @@ compute_plane = { type = "prometheus" polling_interval = 15 cooldown_period = 300 - min_replica_count = 1 - max_replica_count = 100 + min_replica_count = 1000 + max_replica_count = 1000 behavior = { restore_to_original_replica_count = true stabilization_window_seconds = 300 diff --git a/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars b/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars index f2e324e69..aae071fdd 100644 --- a/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars +++ b/infrastructure/quick-deploy/aws-benchmark/parameters_100pods.tfvars @@ -398,7 +398,7 @@ compute_plane = { default = { node_selector = { service = "workers" } # number of replicas for each deployment of compute plane - replicas = 1 + replicas = 100 # ArmoniK polling agent polling_agent = { limits = { @@ -428,7 +428,7 @@ compute_plane = { type = "prometheus" polling_interval = 15 cooldown_period = 300 - min_replica_count = 1 + min_replica_count = 100 max_replica_count = 100 behavior = { restore_to_original_replica_count = true @@ -449,7 +449,7 @@ compute_plane = { stream = { node_selector = { service = "workers" } # number of replicas for each deployment of compute plane - replicas = 1 + replicas = 100 # ArmoniK polling agent polling_agent = { limits = { @@ -479,7 +479,7 @@ compute_plane = { type = "prometheus" polling_interval = 15 cooldown_period = 300 - min_replica_count = 1 + min_replica_count = 100 max_replica_count = 100 behavior = { restore_to_original_replica_count = true From 59c591b147f3dc3154d81415ccecdcffa4679974 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 18:15:38 +0200 Subject: [PATCH 32/38] Update doc --- benchmarking/tests/README.md | 46 +++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/benchmarking/tests/README.md b/benchmarking/tests/README.md index cee4b4c2e..c0e0faa94 100644 --- a/benchmarking/tests/README.md +++ b/benchmarking/tests/README.md @@ -53,41 +53,43 @@ From the root of the repository, the scripts of bench and htcmock tests are in [
# Bench & HtcMock +## Prerequisites +Install `jsonmerge : +```bash +pip install jsonmerge +``` ## Run the tests - -* * `bench-1k.sh`, `bench-5k.sh`, `bench-10k.sh`, `bench-100k.sh` and `bench-1m.sh`: bash scripts to launch bench tests with 1000 tasks, 5000 tasks, 10000 tasks, 100000 tasks and 1000000 tasks, respectively. In addition, you can modify in the scripts other parameters like workload time, io size, ... +* `bench-1k.sh`, `bench-5k.sh`, `bench-10k.sh`, `bench-100k.sh` and `bench-1m.sh`: bash scripts to launch bench tests with 1000 tasks, 5000 tasks, 10000 tasks, 100000 tasks and 1000000 tasks, respectively. In addition, you can modify in the scripts other parameters like workload time, io size, ... +* `htcmock-1k.sh`, `htcmock-5k.sh`, `htcmock-10k.sh`, `htcmock-100k.sh` and `htcmock-1m.sh`: bash scripts to launch htcmock tests with 1000 tasks, 5000 tasks, 10000 tasks, 100000 tasks and 1000000 tasks, respectively. In addition, you can modify in the scripts other parameters like workload time, io size, ... * `test.sh` : script to run all the tests cases listed above and store the results in JSON files. -### Clean the output +## Clean-up the outputs -* cleaner.py : will clean the json output files. +* `cleaner.py` : Python script to clean the JSON output files. -* merge_jsons.py : merges the cleaned results files with the parameters json file of the tested version of ArmoniK and - est_env.json file (third party components of ArmoniK). -* prerequisites: install jsonmerge -```bash -pip install jsonmerge -``` +* `merge_jsons.py` : Python script to merge the cleaned results files with the [versions.tfvars.json file](https://github.com/aneoconsulting/ArmoniK/tree/main/versions.tfvars.json) of the tested version of ArmoniK and `test-env.json` file (third party components of ArmoniK). -### Analyse the results -* wjson.py : will read the clean stats files, so we can manipulate the data of bench tests. +## Analyze the results -### How to run the tests : +* `wjson.py` : Python script to read the clean stats files, so we can manipulate the data of bench tests. -#### Linux : +## How to run the tests : -* Run the script test.sh in the directory /test/bench/100_pods/redis/test_scripts to run the tests of bench, store the - outputs, clean them and merge them with the environment and infrastructure description files. -* Run the script test.sh in the directory /test/htcmock/100_pods/redis/test_scripts to run the tests of htcmock, store - the outputs, clean them and merge them with the environment and infrastructure description files. +### Linux : -```console +* Run the script `test.sh` in the directory benchmarking/tests/bench/test-scripts to run the tests of Bench, store the + outputs, clean them and merge them with the environment and infrastructure description files. +```bash +cd benchmarking/tests/bench/test-scripts/ ./test.sh ``` -# Stresstest : - -TODO: +* Run the script test.sh in the directory benchmarking/tests/htcmock/test-scripts to run the tests of HtcMock, store + the outputs, clean them and merge them with the environment and infrastructure description files. +```bash +cd benchmarking/tests/htcmock/test-scripts/ +./test.sh +``` From 8d5de95090bf900feb1b82f0e594ba91ac9a191a Mon Sep 17 00:00:00 2001 From: YKharouni Date: Mon, 10 Jul 2023 18:24:58 +0200 Subject: [PATCH 33/38] update doc --- benchmarking/tests/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarking/tests/README.md b/benchmarking/tests/README.md index c0e0faa94..66434aaaa 100644 --- a/benchmarking/tests/README.md +++ b/benchmarking/tests/README.md @@ -80,14 +80,14 @@ pip install jsonmerge ### Linux : -* Run the script `test.sh` in the directory benchmarking/tests/bench/test-scripts to run the tests of Bench, store the +* Run the script `test.sh` in the directory `benchmarking/tests/bench/test-scripts` to run the tests of Bench, store the outputs, clean them and merge them with the environment and infrastructure description files. ```bash cd benchmarking/tests/bench/test-scripts/ ./test.sh ``` -* Run the script test.sh in the directory benchmarking/tests/htcmock/test-scripts to run the tests of HtcMock, store +* Run the script `test.sh` in the directory `benchmarking/tests/htcmock/test-scripts` to run the tests of HtcMock, store the outputs, clean them and merge them with the environment and infrastructure description files. ```bash cd benchmarking/tests/htcmock/test-scripts/ From f8f8124b0217c628641497fdc54111fc830b3fdd Mon Sep 17 00:00:00 2001 From: YKharouni Date: Tue, 11 Jul 2023 09:46:28 +0200 Subject: [PATCH 34/38] rename wjson.py to reader.py --- benchmarking/tests/README.md | 4 ++-- .../tests/bench/python-scripts/{wjson.py => reader.py} | 0 benchmarking/tests/bench/test-scripts/test.sh | 2 +- benchmarking/tests/htcmock/test-scripts/test.sh | 5 +---- 4 files changed, 4 insertions(+), 7 deletions(-) rename benchmarking/tests/bench/python-scripts/{wjson.py => reader.py} (100%) diff --git a/benchmarking/tests/README.md b/benchmarking/tests/README.md index 66434aaaa..58ef551b1 100644 --- a/benchmarking/tests/README.md +++ b/benchmarking/tests/README.md @@ -26,7 +26,7 @@ From the root of the repository, the scripts of bench and htcmock tests are in [ │ ├── python-scripts │ │ ├── cleaner.py │ │ ├── merge-jsons.py -│ │ └── wjson.py +│ │ └── reader.py │ ├── stats │ │ └── test-env.json │ └── test_scripts @@ -74,7 +74,7 @@ pip install jsonmerge ## Analyze the results -* `wjson.py` : Python script to read the clean stats files, so we can manipulate the data of bench tests. +* `reader.py` : Python script to read the clean stats files, so we can manipulate the data of bench tests. ## How to run the tests : diff --git a/benchmarking/tests/bench/python-scripts/wjson.py b/benchmarking/tests/bench/python-scripts/reader.py similarity index 100% rename from benchmarking/tests/bench/python-scripts/wjson.py rename to benchmarking/tests/bench/python-scripts/reader.py diff --git a/benchmarking/tests/bench/test-scripts/test.sh b/benchmarking/tests/bench/test-scripts/test.sh index 6d572144e..b51341635 100755 --- a/benchmarking/tests/bench/test-scripts/test.sh +++ b/benchmarking/tests/bench/test-scripts/test.sh @@ -16,5 +16,5 @@ jq . ../stats/results.json > ../stats/pretty-results.json jq . ../stats/pretty-results.json #print the test stats and plot graphs -#../python-scripts/wjson.py +#../python-scripts/reader.py diff --git a/benchmarking/tests/htcmock/test-scripts/test.sh b/benchmarking/tests/htcmock/test-scripts/test.sh index 1e25b6e0f..a673b1ab6 100755 --- a/benchmarking/tests/htcmock/test-scripts/test.sh +++ b/benchmarking/tests/htcmock/test-scripts/test.sh @@ -13,7 +13,4 @@ # save and print pretty json file jq . ../stats/results.json > ../stats/pretty-results.json -jq . ../stats/pretty-results.json - -#print the test stats and plot graphs -#../python-scripts/wjson.py \ No newline at end of file +jq . ../stats/pretty-results.json \ No newline at end of file From cb1d8e943ea2a272f38ad6dc9f5c93832da6e108 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Tue, 11 Jul 2023 09:48:35 +0200 Subject: [PATCH 35/38] clean code --- benchmarking/tests/bench/python-scripts/reader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarking/tests/bench/python-scripts/reader.py b/benchmarking/tests/bench/python-scripts/reader.py index 0fdb24fb8..b77bb0456 100755 --- a/benchmarking/tests/bench/python-scripts/reader.py +++ b/benchmarking/tests/bench/python-scripts/reader.py @@ -26,7 +26,7 @@ def __init__(self, file): runs = json.loads(data) for run in runs: - if (run["nb_pods"] == 100): + if run["nb_pods"] == 100: self.nbtasks.append(run["TotalTasks"]) self.time.append(float(parse(run["ElapsedTime"]))) self.exec_time.append(float(parse(run["TasksExecutionTime"]))) @@ -59,7 +59,7 @@ def __init__(self, file): "throughput": {} } - # calculte the mean of each test case + # calculate the mean of each test case for file in files: filename = file.split(".")[0] mean["time"][filename] = np.mean(cases[filename].time) @@ -72,7 +72,7 @@ def __init__(self, file): for file in files: filename = file.split(".")[0] print('Degree of parallelism of retrieving time is : ' + str(cases[filename].d_parallel[0])) - print('mean total time for treatement of ' + filename + ' tasks is : ' + str( + print('mean total time for treatment of ' + filename + ' tasks is : ' + str( mean["time"][filename]) + ' s') print('mean time of the execution of ' + filename + ' tasks is : ' + str( mean["exec_time"][filename]) + ' s') From 46d40c5165cd520a7c7ce0fd4e4247d488b765ba Mon Sep 17 00:00:00 2001 From: YKharouni Date: Thu, 13 Jul 2023 10:37:52 +0200 Subject: [PATCH 36/38] correct versions file path in test scripts --- benchmarking/tests/bench/test-scripts/bench-100k.sh | 2 +- benchmarking/tests/bench/test-scripts/bench-10k.sh | 4 ++-- benchmarking/tests/bench/test-scripts/bench-1k.sh | 4 ++-- benchmarking/tests/bench/test-scripts/bench-1m.sh | 4 ++-- benchmarking/tests/bench/test-scripts/bench-5k.sh | 4 ++-- benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh | 4 ++-- benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh | 4 ++-- benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh | 4 ++-- benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh | 4 ++-- benchmarking/tests/htcmock/test-scripts/htcmock-5k.sh | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/benchmarking/tests/bench/test-scripts/bench-100k.sh b/benchmarking/tests/bench/test-scripts/bench-100k.sh index 9e0849fac..f51a02cd8 100755 --- a/benchmarking/tests/bench/test-scripts/bench-100k.sh +++ b/benchmarking/tests/bench/test-scripts/bench-100k.sh @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/benchmarking/tests/bench/test-scripts/bench-10k.sh b/benchmarking/tests/bench/test-scripts/bench-10k.sh index 2d8ce7bf5..1e0b5f965 100755 --- a/benchmarking/tests/bench/test-scripts/bench-10k.sh +++ b/benchmarking/tests/bench/test-scripts/bench-10k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 10000 tasks on 100 pods docker run --rm \ @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/benchmarking/tests/bench/test-scripts/bench-1k.sh b/benchmarking/tests/bench/test-scripts/bench-1k.sh index f5e25fb53..3dc864f01 100755 --- a/benchmarking/tests/bench/test-scripts/bench-1k.sh +++ b/benchmarking/tests/bench/test-scripts/bench-1k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 1000 tasks on 100 pods docker run --rm \ @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/benchmarking/tests/bench/test-scripts/bench-1m.sh b/benchmarking/tests/bench/test-scripts/bench-1m.sh index 321ba18a7..37bb434de 100755 --- a/benchmarking/tests/bench/test-scripts/bench-1m.sh +++ b/benchmarking/tests/bench/test-scripts/bench-1m.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 10000 tasks on 100 pods docker run --rm \ @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/benchmarking/tests/bench/test-scripts/bench-5k.sh b/benchmarking/tests/bench/test-scripts/bench-5k.sh index 653f0e045..490f5365e 100755 --- a/benchmarking/tests/bench/test-scripts/bench-5k.sh +++ b/benchmarking/tests/bench/test-scripts/bench-5k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') #run 5000 tasks on 100 pods docker run --rm \ @@ -14,4 +14,4 @@ docker run --rm \ -e BenchOptions__BatchSize=50 \ -e BenchOptions__MaxRetries=5 \ -e BenchOptions__DegreeOfParallelism=5 \ - dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') + dockerhubaneo/armonik_core_bench_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh index 713add5ed..9fa804524 100755 --- a/benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-100k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ @@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/gene -e HtcMock__EnableSmallOutput=true \ -e HtcMock__EnableFastCompute=true \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh index 80a0c2982..377a48bc4 100755 --- a/benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-10k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ @@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/gene -e HtcMock__EnableSmallOutput=true \ -e HtcMock__EnableFastCompute=true \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh index 73705d20a..ddf06d7bd 100755 --- a/benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-1k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ @@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/gene -e HtcMock__EnableSmallOutput=true \ -e HtcMock__EnableFastCompute=true \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh index 8298a88af..c96f87d39 100755 --- a/benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-1m.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ @@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/gene -e HtcMock__EnableSmallOutput=true \ -e HtcMock__EnableFastCompute=true \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file diff --git a/benchmarking/tests/htcmock/test-scripts/htcmock-5k.sh b/benchmarking/tests/htcmock/test-scripts/htcmock-5k.sh index 6432b2e4a..16cac6675 100755 --- a/benchmarking/tests/htcmock/test-scripts/htcmock-5k.sh +++ b/benchmarking/tests/htcmock/test-scripts/htcmock-5k.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') +export CONTROL_PLANE_URL=$(cat ../../../../infrastructure/quick-deploy/aws/all/generated/armonik-output.json | jq -r '.armonik.control_plane_url') docker run --rm \ -e GrpcClient__Endpoint="${CONTROL_PLANE_URL}" \ @@ -13,4 +13,4 @@ export CONTROL_PLANE_URL=$(cat ../../../infrastructure/quick-deploy/aws/all/gene -e HtcMock__EnableSmallOutput=true \ -e HtcMock__EnableFastCompute=true \ -e HtcMock__Partition="htcmock" \ - dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file + dockerhubaneo/armonik_core_htcmock_test_client:$(cat ../../../../versions.tfvars.json | jq -r '.armonik_versions.core') \ No newline at end of file From 2982798f4b8d891c0097c6ac3604f0a7dfb0cd8a Mon Sep 17 00:00:00 2001 From: YKharouni Date: Thu, 13 Jul 2023 14:20:14 +0200 Subject: [PATCH 37/38] correct versions file path in merger --- benchmarking/tests/bench/python-scripts/merge-jsons.py | 2 +- benchmarking/tests/htcmock/python-scripts/merge-jsons.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarking/tests/bench/python-scripts/merge-jsons.py b/benchmarking/tests/bench/python-scripts/merge-jsons.py index eb5198ff3..0e52d1db3 100755 --- a/benchmarking/tests/bench/python-scripts/merge-jsons.py +++ b/benchmarking/tests/bench/python-scripts/merge-jsons.py @@ -4,7 +4,7 @@ import re from jsonmerge import merge -with open("../../../versions.tfvars.json", "r") as versions: +with open("../../../../versions.tfvars.json", "r") as versions: infra = json.load(versions) with open("../stats/test-env.json", "r") as test_env: env = (json.load(test_env)) diff --git a/benchmarking/tests/htcmock/python-scripts/merge-jsons.py b/benchmarking/tests/htcmock/python-scripts/merge-jsons.py index 47f0d7d8e..79f35a8fe 100755 --- a/benchmarking/tests/htcmock/python-scripts/merge-jsons.py +++ b/benchmarking/tests/htcmock/python-scripts/merge-jsons.py @@ -4,7 +4,7 @@ import re from jsonmerge import merge -with open("../../../versions.tfvars.json", "r") as versions: +with open("../../../../versions.tfvars.json", "r") as versions: infra = json.load(versions) with open("../stats/test-env.json", "r") as test_env: env = json.load(test_env) From 100c8adc7684bf90ec6192220fc9f554108eb080 Mon Sep 17 00:00:00 2001 From: YKharouni Date: Wed, 19 Jul 2023 15:27:37 +0200 Subject: [PATCH 38/38] update doc --- benchmarking/tests/bench/stats/test-env.json | 2 +- benchmarking/tests/htcmock/stats/test-env.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarking/tests/bench/stats/test-env.json b/benchmarking/tests/bench/stats/test-env.json index 38ad19db5..2ce240057 100644 --- a/benchmarking/tests/bench/stats/test-env.json +++ b/benchmarking/tests/bench/stats/test-env.json @@ -8,7 +8,7 @@ "Network_bandwidth" : "25", "EBS_bandwidth" : "19000", "Kubernetes" : "AWS EKS 1.25", - "Object_object_type" : "Redis", + "Object_object_type" : "AWS Elasticache for Redis", "Storage_queue_storage" : "Amazon MQ, broker : ActiveMQ 5.16.4", "Storage_table_type" : "MongoDB 6.0.1", "OS" : "Linux" diff --git a/benchmarking/tests/htcmock/stats/test-env.json b/benchmarking/tests/htcmock/stats/test-env.json index e906df484..ebfd607d0 100644 --- a/benchmarking/tests/htcmock/stats/test-env.json +++ b/benchmarking/tests/htcmock/stats/test-env.json @@ -8,7 +8,7 @@ "Network_bandwidth" : "25", "EBS_bandwidth" : "19000", "Kubernetes" : "AWS EKS 1.25", - "Object_object_type" : "Redis", + "Object_object_type" : "AWS Elasticache for Redis", "Storage_queue_storage" : "Amazon MQ, broker : ActiveMQ 5.17.0", "Storage_table_type" : "MongoDB 6.0.1", "OS" : "Linux"