From efe4b9bbe3c9cb950378de9697eed2030ac49ca2 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 6 Oct 2019 04:55:40 +0200 Subject: Optimize ADEI template: mini-containers for cron-jobs, adjust scheduling intervals to reduce load spikes --- .../adei/templates/10-adei-mini-build.yml.j2 | 46 ++++++++++++++++++++++ setup/projects/adei/templates/60-adei.yml.j2 | 8 ++-- setup/projects/adei/vars/globals.yml | 8 +++- 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 setup/projects/adei/templates/10-adei-mini-build.yml.j2 (limited to 'setup') diff --git a/setup/projects/adei/templates/10-adei-mini-build.yml.j2 b/setup/projects/adei/templates/10-adei-mini-build.yml.j2 new file mode 100644 index 0000000..19024bd --- /dev/null +++ b/setup/projects/adei/templates/10-adei-mini-build.yml.j2 @@ -0,0 +1,46 @@ +apiVersion: v1 +kind: Template +metadata: + name: adei-mini-build + labels: + app: adei + annotations: + descriptions: "ADEI/Mini Build" +objects: + - kind: ImageStream + apiVersion: v1 + metadata: + name: adei-mini + - kind: "BuildConfig" + apiVersion: "v1" + metadata: + name: "adei-mini" + spec: +# runPolicy: "Serial" + successfulBuildsHistoryLimit: "{{ adei_pod_history_limit }}" + failedBuildsHistoryLimit: "{{ adei_pod_history_limit }}" + triggers: + - type: "ConfigChange" + - type: "ImageChange" + imageChange: {} + source: + type: "Git" + git: + uri: "http://adei.info/git/csa/devops/docker/adei.git" + contextDir: "adei" + strategy: + dockerStrategy: + forcePull: true + dockerfilePath: Dockerfile.mini + output: + to: + kind: "ImageStreamTag" + name: "adei-mini:latest" + imageLabels: + - name: "vendor" + value: "KIT" + - name: "author" + value: "Suren A. Chilingaryan" + - name: "authoritative-source-url" + value: "adei.info" + diff --git a/setup/projects/adei/templates/60-adei.yml.j2 b/setup/projects/adei/templates/60-adei.yml.j2 index 6d0ccae..5e508bc 100644 --- a/setup/projects/adei/templates/60-adei.yml.j2 +++ b/setup/projects/adei/templates/60-adei.yml.j2 @@ -12,7 +12,7 @@ metadata: labels: app: "adei" objects: -{% for name, cfg in adei_frontends.iteritems() %} +{% for name, cfg in adei_frontends.items() %} {% if (cfg.enabled | default(true)) %} {% if (cfg.cron is defined) %} {% set pod_type = "cron" %} @@ -152,7 +152,7 @@ objects: {% endif %} containers: - name: "{{ cfg.name }}" - image: adei + image: "{{ cfg.image | default('adei:latest') }}" imagePullPolicy: {{ pull_policy }} {% if (cfg.node is defined) %} command: @@ -259,10 +259,10 @@ parameters: value: "sources" description: "Type of caching parallelism by a cacher replica: (sources or groups)" - name: update_schedule - value: "*/5 * * * *" + value: "*/13 * * * *" description: "Schedule of caching group updates" - name: maintain_schedule - value: "*/15 * * * *" + value: "*/31 * * * *" description: "Schedule of maintain tasks" - name: clean_schedule value: "9 3 * * *" diff --git a/setup/projects/adei/vars/globals.yml b/setup/projects/adei/vars/globals.yml index 8f67572..120f880 100644 --- a/setup/projects/adei/vars/globals.yml +++ b/setup/projects/adei/vars/globals.yml @@ -106,6 +106,8 @@ adei_cron_env: value: "${setup}" - name: "ADEI_SCHEDULER" value: "${sched_parallel}" + - name: "LC_ALL" + value: "C" adei_update_env: - name: "ADEI_CONTINUOUS_CACHING" @@ -199,7 +201,7 @@ adei_pod_mounts: mountPath: /adei/tmp - name: adei-log subPath: "${setup}/apache2" - mountPath: /var/log/apache2 + mountPath: /adei/log/ - name: adei-data subPath: "${data_path}" mountPath: "/adei/data/${setup}" @@ -278,6 +280,7 @@ adei_frontends: enabled: true update: name: "adei-${setup}-update" + image: "adei-mini:latest" cron: "${update_schedule}" cmd: [ "/openshift-entrypoint.sh", "/adei/src/scripts/cron/adei.cron.sh" ] env: "{{ adei_pod_env | union(adei_cron_env) | union(adei_update_env) }}" @@ -287,6 +290,7 @@ adei_frontends: enabled: true maintain: name: "adei-${setup}-maintain" + image: "adei-mini:latest" cron: "${maintain_schedule}" cmd: [ "/openshift-entrypoint.sh", "/adei/src/scripts/cron/adei_manager.cron.sh" ] env: "{{ adei_pod_env | union(adei_cron_env) }}" @@ -296,12 +300,14 @@ adei_frontends: enabled: true clean: name: "adei-${setup}-clean" + image: "adei-mini:latest" cron: "${clean_schedule}" cmd: [ "/openshift-entrypoint.sh", "/adei/src/scripts/cron/adei_clean.cron.sh" ] env: "{{ adei_pod_env | union(adei_cron_env) }}" vols: "{{ adei_pod_vols }}" mounts: "{{ adei_prod_mounts | union(adei_pod_mounts) }}" groups: [ "adei", "${{ '{{' }}data_group{{ '}}' }}" ] + max_run_time: 14400 enabled: true admin: name: "adei-${setup}-admin" -- cgit v1.2.3