diff --git a/templates/service/locals.tf b/templates/service/locals.tf index bc295c3..acf93f4 100644 --- a/templates/service/locals.tf +++ b/templates/service/locals.tf @@ -23,6 +23,8 @@ locals { schematics_runtime_job_image = "icr.io/schematics-remote/schematics-agent-ws-job-20220704:60824f4e-276" #Schematics agent ansible image ID schematics_runtime_ansible_job_image = "us.icr.io/schematics/schematics-ansible-job:b164f614-171" + #Schematics agent adapter image ID + schematics_runtime_adapter_job_image = "us.icr.io/schematics/schematics-data-adapter:48537ed2-62" #schematics_sandbox_image schematics_sandbox_image = "icr.io/schematics-remote/schematics-sandbox:9bdc3645-283" #Schematics environment (dev|stage|prod) diff --git a/templates/service/runtime-ansible-job.tf b/templates/service/runtime-ansible-job.tf index 905bd34..57a96cb 100755 --- a/templates/service/runtime-ansible-job.tf +++ b/templates/service/runtime-ansible-job.tf @@ -78,6 +78,27 @@ resource "kubernetes_config_map" "runtime_ansible_job_configmap" { } +resource "kubernetes_config_map" "runtime_adapter_job_configmap" { + metadata { + name = "schematics-runtime-ansible-job-config" + namespace = "schematics-runtime" + } + + data = { + ADAPTER_HTTPPORT = "4001" + ADAPTER_MAXRETRIES = "" + ADAPTER_LOCATION = "us-south" + ADAPTER_LOGGERLEVEL = "-1" + ADAPTER_ATLOGGERLEVEL = "-1" + ADAPTER_EXTLOGGERLEVEL = "-1" + ADAPTER_EXTLOGPATH = "/var/log/schematics/%s.log" + ADAPTER_PLUGINHOME = "/go/src/github.ibm.com/blueprint/schematics-data-adapter/plugins" + } + + depends_on = [kubernetes_namespace.namespace] + +} + resource "kubernetes_service" "ansible_job_service" { metadata { name = "ansible-job-service" @@ -234,15 +255,63 @@ resource "kubernetes_deployment" "runtime_ansible_job" { } } + container { + name = "adapter" + image = "us.icr.io/$${CR_NAMESPACE}/schematics-data-adapter:$${ADAPTER_IMAGE_TAG}" + + env_from { + config_map_ref { + name = "schematics-runtime-adapter-job-config" + } + } + + port { + name = "http-adapter" + container_port = 4001 + } + resources { + limits = { + cpu = "500m" + memory = "1Gi" + } + + requests = { + cpu = "500m" + memory = "1Gi" + } + } + + volume_mount { + name = "at-events" + mount_path = "/var/log/at" + } + + volume_mount { + name = "ext-logs" + mount_path = "/var/log/schematics" + } + } + restart_policy = "Always" termination_grace_period_seconds = 180000 } } + strategy { + type = "RollingUpdate" + + rolling_update { + max_unavailable = "1" + max_surge = "1" + } + } + revision_history_limit = 5 } - depends_on = [kubernetes_service.job_service, kubernetes_config_map.runtime_ansible_job_configmap, kubernetes_namespace.namespace] + depends_on = [kubernetes_service.job_service, kubernetes_config_map.runtime_ansible_job_configmap,kubernetes_config_map.runtime_adapter_job_configmap, kubernetes_namespace.namespace] } + + ############################################################################## \ No newline at end of file