Forgejo Valkey monitoring: deploying valkey exported alongside with valkey to export its metrics #3548

Merged
dkirwan merged 2 commits from amedvede/ansible:forgejo_zabbix into main 2026-07-30 14:22:06 +00:00
Member
No description provided.
Signed-off-by: Anton Medvedev <amedvede@redhat.com>
feat(forgejo): deploying redis exporter, that will export metrics from valkey and later be accessible from zabbix agent
Some checks failed
Linter / yamllint (pull_request) Failing after 31s
Differential yamllint / yamllint-job (pull_request) Successful in 43s
AI Code Review / ai-review (pull_request_target) Successful in 26s
Linter / ansible-lint (pull_request) Successful in 2m5s
615aa310aa
Signed-off-by: Anton Medvedev <amedvede@redhat.com>
amedvede 2026-07-29 13:46:57 +00:00

AI Code Review

Detailed Code Review

The implementation successfully introduces the Valkey exporter and simplifies the metrics authentication setup by removing the conditional toggle. The Kubernetes deployment template follows strong security practices (dropping all capabilities, running as non-root, and utilizing seccomp profiles) and correctly maps the existing authentication secrets for Valkey.

The removal of forgejo_metrics_zabbix_enabled is a sensible move to ensure that monitoring is consistently available across environments via the OpenShift delegate URLs without requiring extra configuration. No critical bugs or security vulnerabilities were identified.

📂 File Reviews

📄 `roles/openshift-apps/forgejo/tasks/deploy-valkey.yaml` - Adds Ansible tasks to template and apply the Valkey exporter deployment and service.
  • Minor [Suggestion]: Using ansible.builtin.command to run oc apply will cause the task to report as 'changed' on every playbook run, reducing idempotency visibility.
    • Suggestion: Consider utilizing the kubernetes.core.k8s module for resource application, or add a mechanism to track changes (e.g., changed_when: false or comparing states).

Summary

  • Overall Assessment: The changes are well-structured, follow security best practices, and correctly configure the metrics exporter and OAuth proxy. No critical issues were identified.
  • Minor Suggestions:
    • Consider using kubernetes.core.k8s Ansible module instead of shelling out to oc apply for better idempotency.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### Detailed Code Review The implementation successfully introduces the Valkey exporter and simplifies the metrics authentication setup by removing the conditional toggle. The Kubernetes deployment template follows strong security practices (dropping all capabilities, running as non-root, and utilizing seccomp profiles) and correctly maps the existing authentication secrets for Valkey. The removal of `forgejo_metrics_zabbix_enabled` is a sensible move to ensure that monitoring is consistently available across environments via the OpenShift delegate URLs without requiring extra configuration. No critical bugs or security vulnerabilities were identified. #### 📂 File Reviews <details> <summary><strong>📄 `roles/openshift-apps/forgejo/tasks/deploy-valkey.yaml`</strong> - Adds Ansible tasks to template and apply the Valkey exporter deployment and service.</summary> - **Minor** [Suggestion]: Using `ansible.builtin.command` to run `oc apply` will cause the task to report as 'changed' on every playbook run, reducing idempotency visibility. - *Suggestion:* Consider utilizing the `kubernetes.core.k8s` module for resource application, or add a mechanism to track changes (e.g., `changed_when: false` or comparing states). </details> ### ✅ Summary - **Overall Assessment:** The changes are well-structured, follow security best practices, and correctly configure the metrics exporter and OAuth proxy. No critical issues were identified. - **Minor Suggestions:** - Consider using `kubernetes.core.k8s` Ansible module instead of shelling out to `oc apply` for better idempotency. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
Author
Member

To deploy only valkey changes use
ansible-playbook playbooks/openshift-apps/forgejo.yml -t valkey

To test changes use on os_control_stg machine.
To chech if exported is deployed:

oc get deploy,pod,svc -n forgejo -l app=valkey-exporter

To check its health status:

curl -sS -w '\nHTTP %{http_code}\n' \
  http://valkey-exporter.forgejo.svc.cluster.local:9121/health

Metrics scrape test:

curl -sS http://valkey-exporter.forgejo.svc.cluster.local:9121/metrics | head -40
To deploy only valkey changes use ```ansible-playbook playbooks/openshift-apps/forgejo.yml -t valkey``` To test changes use on `os_control_stg` machine. To chech if exported is deployed: ``` oc get deploy,pod,svc -n forgejo -l app=valkey-exporter ``` To check its health status: ``` curl -sS -w '\nHTTP %{http_code}\n' \ http://valkey-exporter.forgejo.svc.cluster.local:9121/health ``` Metrics scrape test: ``` curl -sS http://valkey-exporter.forgejo.svc.cluster.local:9121/metrics | head -40 ```
amedvede force-pushed forgejo_zabbix from 615aa310aa
Some checks failed
Linter / yamllint (pull_request) Failing after 31s
Differential yamllint / yamllint-job (pull_request) Successful in 43s
AI Code Review / ai-review (pull_request_target) Successful in 26s
Linter / ansible-lint (pull_request) Successful in 2m5s
to f73bf62c2b
All checks were successful
Linter / yamllint (pull_request) Successful in 31s
Differential yamllint / yamllint-job (pull_request) Successful in 43s
AI Code Review / ai-review (pull_request_target) Successful in 20s
Linter / ansible-lint (pull_request) Successful in 1m24s
2026-07-29 13:57:51 +00:00
Compare

AI Code Review

Detailed Code Review

The implementation successfully adds the Valkey exporter and simplifies the Zabbix integration by removing a redundant boolean toggle. The Kubernetes resources are well-structured, employing proper security contexts, resource limits, and health probes. The Ansible tasks correctly use tags and templating.

However, there is a minor risk in the Ansible deploy-valkey.yaml tasks related to how resources are applied, as oc apply can occasionally fail if the object doesn't exist yet but has certain immutable field expectations depending on the cluster state. This is mitigated by the retries, but utilizing the kubernetes.core.k8s Ansible module is generally more robust and idempotent than running oc apply via command module.

📂 File Reviews

📄 `roles/openshift-apps/forgejo/tasks/deploy-valkey.yaml` - Adds tasks to template and apply the Valkey exporter deployment and service.
  • Minor [Suggestion]: Using ansible.builtin.command with oc apply is less robust than using the native kubernetes.core.k8s module, which handles idempotency and state validation better.
    • Suggestion: Consider migrating to kubernetes.core.k8s for applying Kubernetes manifests, though the current retry mechanism mitigates immediate failure risks.

Summary

  • Overall Assessment: No critical issues identified. The changes are structurally sound and follow standard deployment practices for OpenShift/Ansible.
  • Minor Suggestions:
    • Consider replacing shell oc apply commands with the native kubernetes.core.k8s Ansible module for better idempotency and error handling.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### Detailed Code Review The implementation successfully adds the Valkey exporter and simplifies the Zabbix integration by removing a redundant boolean toggle. The Kubernetes resources are well-structured, employing proper security contexts, resource limits, and health probes. The Ansible tasks correctly use tags and templating. However, there is a minor risk in the Ansible `deploy-valkey.yaml` tasks related to how resources are applied, as `oc apply` can occasionally fail if the object doesn't exist yet but has certain immutable field expectations depending on the cluster state. This is mitigated by the retries, but utilizing the `kubernetes.core.k8s` Ansible module is generally more robust and idempotent than running `oc apply` via `command` module. #### 📂 File Reviews <details> <summary><strong>📄 `roles/openshift-apps/forgejo/tasks/deploy-valkey.yaml`</strong> - Adds tasks to template and apply the Valkey exporter deployment and service.</summary> - **Minor** [Suggestion]: Using `ansible.builtin.command` with `oc apply` is less robust than using the native `kubernetes.core.k8s` module, which handles idempotency and state validation better. - *Suggestion:* Consider migrating to `kubernetes.core.k8s` for applying Kubernetes manifests, though the current retry mechanism mitigates immediate failure risks. </details> ### ✅ Summary - **Overall Assessment:** No critical issues identified. The changes are structurally sound and follow standard deployment practices for OpenShift/Ansible. - **Minor Suggestions:** - Consider replacing shell `oc apply` commands with the native `kubernetes.core.k8s` Ansible module for better idempotency and error handling. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
amedvede force-pushed forgejo_zabbix from f73bf62c2b
All checks were successful
Linter / yamllint (pull_request) Successful in 31s
Differential yamllint / yamllint-job (pull_request) Successful in 43s
AI Code Review / ai-review (pull_request_target) Successful in 20s
Linter / ansible-lint (pull_request) Successful in 1m24s
to 9ecc970f1e
All checks were successful
Differential yamllint / yamllint-job (pull_request) Successful in 44s
Linter / yamllint (pull_request) Successful in 48s
Linter / ansible-lint (pull_request) Successful in 1m45s
Differential yamllint / yamllint-job (push) Successful in 8s
2026-07-30 14:18:32 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infra/ansible!3548
No description provided.