From d185c4a690f5b1085be2736919cc46d9d50fe554 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Fri, 14 Jun 2024 10:41:54 +0200 Subject: [PATCH] post - get loki-log: revert to previous command This change reverts to the previous command and also rename roles and avoid having the stack deploy steps done multiple times. Change-Id: Ia44cda1486860d30adbe449b507a84bf25e6cc07 --- playbooks/upgrade.yaml | 1 - .../defaults/main.yaml | 0 .../tasks/main.yaml | 4 ---- roles/post/get-loki-logs/tasks/main.yaml | 4 +++- roles/run-tests/tasks/main.yaml | 3 ++- .../setup-log-forwarding-stack}/defaults/main.yaml | 0 .../setup-log-forwarding-stack}/tasks/deploy-fluentbit.yaml | 0 .../setup-log-forwarding-stack}/tasks/deploy-loki.yaml | 0 .../setup-log-forwarding-stack}/tasks/install-logCLI.yaml | 0 .../setup-log-forwarding-stack}/tasks/main.yaml | 0 10 files changed, 5 insertions(+), 7 deletions(-) rename roles/health-check/{initialize-log-forwarding => enable-log-forward}/defaults/main.yaml (100%) rename roles/health-check/{initialize-log-forwarding => enable-log-forward}/tasks/main.yaml (70%) rename roles/{setup-log-forwarding => utils/setup-log-forwarding-stack}/defaults/main.yaml (100%) rename roles/{setup-log-forwarding => utils/setup-log-forwarding-stack}/tasks/deploy-fluentbit.yaml (100%) rename roles/{setup-log-forwarding => utils/setup-log-forwarding-stack}/tasks/deploy-loki.yaml (100%) rename roles/{setup-log-forwarding => utils/setup-log-forwarding-stack}/tasks/install-logCLI.yaml (100%) rename roles/{setup-log-forwarding => utils/setup-log-forwarding-stack}/tasks/main.yaml (100%) diff --git a/playbooks/upgrade.yaml b/playbooks/upgrade.yaml index c9d419d6..069f5ecd 100644 --- a/playbooks/upgrade.yaml +++ b/playbooks/upgrade.yaml @@ -5,7 +5,6 @@ - setup-env - sanity-check - sfconfig-dev-prepare - - setup-log-forwarding - role: build-operator-assets vars: build_bundle: false diff --git a/roles/health-check/initialize-log-forwarding/defaults/main.yaml b/roles/health-check/enable-log-forward/defaults/main.yaml similarity index 100% rename from roles/health-check/initialize-log-forwarding/defaults/main.yaml rename to roles/health-check/enable-log-forward/defaults/main.yaml diff --git a/roles/health-check/initialize-log-forwarding/tasks/main.yaml b/roles/health-check/enable-log-forward/tasks/main.yaml similarity index 70% rename from roles/health-check/initialize-log-forwarding/tasks/main.yaml rename to roles/health-check/enable-log-forward/tasks/main.yaml index ce052473..402810c2 100644 --- a/roles/health-check/initialize-log-forwarding/tasks/main.yaml +++ b/roles/health-check/enable-log-forward/tasks/main.yaml @@ -1,8 +1,4 @@ --- -- name: Set up log forwarding - ansible.builtin.include_role: - name: setup-log-forwarding - - name: Enable log forwarding ansible.builtin.include_role: name: "update-custom-resource" diff --git a/roles/post/get-loki-logs/tasks/main.yaml b/roles/post/get-loki-logs/tasks/main.yaml index a92883d3..6f859594 100644 --- a/roles/post/get-loki-logs/tasks/main.yaml +++ b/roles/post/get-loki-logs/tasks/main.yaml @@ -26,9 +26,11 @@ retries: 10 until: "loki_buildinfo.status == 200 and '2.9.2' in loki_buildinfo.content" +# TODO: Remove exclusion of mariadb (this was done because of the mariadb container logs everything at high rate breaking the capability of loki to wrap logs) +# Remove after the next sf-operator release (it affects only the upgrade job) - name: Get aggregated logs prefixed by service ansible.builtin.shell: > - ~/bin/logcli query --batch 200 --limit 1000 --tail --forward --since=6h --parallel-duration 15m --parallel-max-workers 4 --part-path-prefix=/tmp/all-query --merge-parts --no-labels --quiet '{namespace="sf"} | json | {{ line_format_query }}' > {{ _output_dir_realpath.stdout }}/all.log + ~/bin/logcli query --batch 2000 --forward --since=6h --parallel-duration 15m --parallel-max-workers 4 --part-path-prefix=/tmp/all-query --merge-parts --no-labels --quiet '{namespace="sf", container != "mariadb"} | json | {{ line_format_query }}' > {{ _output_dir_realpath.stdout }}/all.log - name: Change owner and group for the log dir ansible.builtin.command: chown -R {{ ansible_user }}:{{ ansible_user }} {{ _output_dir_realpath.stdout }} diff --git a/roles/run-tests/tasks/main.yaml b/roles/run-tests/tasks/main.yaml index c5c10e63..4ee1dff9 100644 --- a/roles/run-tests/tasks/main.yaml +++ b/roles/run-tests/tasks/main.yaml @@ -13,6 +13,7 @@ - name: utils/manage-hosts - name: utils/get-gerrit-admin-user-api-key - name: utils/config-repo-reset + - name: utils/setup-log-forwarding-stack loop_control: loop_var: role @@ -21,8 +22,8 @@ name: "health-check/{{ role.name }}" when: role.when | default(true) loop: - - name: initialize-log-forwarding - name: check-service-uri + - name: enable-log-forward - name: scale-resources - name: zuul-connections - name: zuul-authenticators diff --git a/roles/setup-log-forwarding/defaults/main.yaml b/roles/utils/setup-log-forwarding-stack/defaults/main.yaml similarity index 100% rename from roles/setup-log-forwarding/defaults/main.yaml rename to roles/utils/setup-log-forwarding-stack/defaults/main.yaml diff --git a/roles/setup-log-forwarding/tasks/deploy-fluentbit.yaml b/roles/utils/setup-log-forwarding-stack/tasks/deploy-fluentbit.yaml similarity index 100% rename from roles/setup-log-forwarding/tasks/deploy-fluentbit.yaml rename to roles/utils/setup-log-forwarding-stack/tasks/deploy-fluentbit.yaml diff --git a/roles/setup-log-forwarding/tasks/deploy-loki.yaml b/roles/utils/setup-log-forwarding-stack/tasks/deploy-loki.yaml similarity index 100% rename from roles/setup-log-forwarding/tasks/deploy-loki.yaml rename to roles/utils/setup-log-forwarding-stack/tasks/deploy-loki.yaml diff --git a/roles/setup-log-forwarding/tasks/install-logCLI.yaml b/roles/utils/setup-log-forwarding-stack/tasks/install-logCLI.yaml similarity index 100% rename from roles/setup-log-forwarding/tasks/install-logCLI.yaml rename to roles/utils/setup-log-forwarding-stack/tasks/install-logCLI.yaml diff --git a/roles/setup-log-forwarding/tasks/main.yaml b/roles/utils/setup-log-forwarding-stack/tasks/main.yaml similarity index 100% rename from roles/setup-log-forwarding/tasks/main.yaml rename to roles/utils/setup-log-forwarding-stack/tasks/main.yaml