Skip to content

test(functional): add gitops-backed k3s smoke workflow - #1513

Merged
BlackCelebrant merged 1 commit into
constructorfabric:mainfrom
BlackCelebrant:main
Jul 1, 2026
Merged

test(functional): add gitops-backed k3s smoke workflow#1513
BlackCelebrant merged 1 commit into
constructorfabric:mainfrom
BlackCelebrant:main

Conversation

@BlackCelebrant

@BlackCelebrant BlackCelebrant commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a functional K3s smoke workflow that validates the non-interactive GitOps deployment path in GitHub Actions.

The workflow provisions an ephemeral k3d/K3s cluster, uses the committed deploy/gitops Makefile targets to bootstrap prerequisites, seal temporary CI secrets, install L2 infra, and deploy the Insight umbrella chart.

What changed

  • Added manual Functional K3s Smoke workflow.
  • Added deploy/gitops/environments/functional-ci environment for CI smoke deployments.
  • Exercises existing GitOps Makefile targets instead of duplicating Helm deployment logic in the workflow:
    • bootstrap
    • fetch-cert
    • seal-from-file
    • system
    • deploy-app
    • status
  • Installs required L2 services:
    • MariaDB
    • ClickHouse
    • Redis
  • Deploys mandatory app services plus Identity:
    • API Gateway
    • Analytics API
    • Frontend
    • Identity
  • Uses pinned GitHub Actions and version-pinned k3d installer.
  • Adds failure diagnostics for pods, events, logs, Helm status, and GitOps deploy logs.

Summary by CodeRabbit

  • New Features

    • Added a functional GitOps smoke-test workflow that provisions an ephemeral K3s cluster, deploys the infrastructure and application, and validates rollout status.
    • Introduced a new functional CI environment configuration for controlled deployments and secret bootstrapping.
    • Added Helm configuration for MariaDB, Redis, and ClickHouse persistent storage and resource sizing.
  • Tests

    • Added end-to-end deployment checks with rollout verification and job completion handling, plus detailed diagnostics on failures.
  • Chores

    • Updated Git ignore rules to prevent CI-generated functional environment artifacts from being committed.

@BlackCelebrant
BlackCelebrant requested a review from a team as a code owner June 29, 2026 05:22
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1b40bdee-1eee-4041-a1c1-0e0f44bf15f2

📥 Commits

Reviewing files that changed from the base of the PR and between d67d2cf16841c76dbd396e6b8f8868953e528ad7 and e4f0900.

📒 Files selected for processing (7)
  • .github/workflows/functional-k3s.yml
  • deploy/gitops/.gitignore
  • deploy/gitops/environments/functional-ci/clickhouse-values.yaml
  • deploy/gitops/environments/functional-ci/inventory.yaml
  • deploy/gitops/environments/functional-ci/mariadb-values.yaml
  • deploy/gitops/environments/functional-ci/redis-values.yaml
  • deploy/gitops/environments/functional-ci/values.yaml
✅ Files skipped from review due to trivial changes (2)
  • deploy/gitops/environments/functional-ci/clickhouse-values.yaml
  • deploy/gitops/.gitignore
🚧 Files skipped from review as they are similar to previous changes (5)
  • deploy/gitops/environments/functional-ci/redis-values.yaml
  • deploy/gitops/environments/functional-ci/values.yaml
  • deploy/gitops/environments/functional-ci/mariadb-values.yaml
  • deploy/gitops/environments/functional-ci/inventory.yaml
  • .github/workflows/functional-k3s.yml

📝 Walkthrough

Walkthrough

Adds a new Functional K3s Smoke workflow plus a matching functional-ci GitOps environment. The workflow provisions K3s, seals secrets, deploys infra and the Insight app, verifies workloads, emits failure diagnostics, and cleans up the cluster.

Changes

Functional K3s Smoke CI Environment

Layer / File(s) Summary
functional-ci GitOps environment config
deploy/gitops/environments/functional-ci/inventory.yaml, deploy/gitops/environments/functional-ci/values.yaml, deploy/gitops/environments/functional-ci/mariadb-values.yaml, deploy/gitops/environments/functional-ci/clickhouse-values.yaml, deploy/gitops/environments/functional-ci/redis-values.yaml, deploy/gitops/.gitignore
Defines the functional-ci inventory, Insight app Helm values, MariaDB/ClickHouse/Redis resource and persistence settings, and .gitignore rules for generated cert and sealed-secret artifacts.
Workflow: tooling install and cluster provisioning
.github/workflows/functional-k3s.yml
Declares the workflow, installs CLI tooling, creates the ephemeral K3s cluster, and waits for cluster readiness with timeout diagnostics.
Workflow: secret sealing, infra and app deployment
.github/workflows/functional-k3s.yml
Bootstraps GitOps prerequisites, generates and seals four secrets, deploys L2 infrastructure, and deploys the Insight chart using the version read from Chart.yaml.
Workflow: rollout verification, diagnostics, and cleanup
.github/workflows/functional-k3s.yml
Waits for rollouts and jobs, captures failure diagnostics, and always deletes the ephemeral cluster.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: ktursunov, dzarlax

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: a functional K3s smoke workflow backed by GitOps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/functional-k3s.yml (2)

47-66: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Verify downloaded tools before installing or executing them.

The workflow pins versions, but it still installs unsigned/unverified remote artifacts and pipes the k3d installer directly to bash. Add checksum/signature verification for yq, kubeseal, and k3d before installing/running them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/functional-k3s.yml around lines 47 - 66, The Install
gitops CLI tools and Install k3d steps in functional-k3s.yml fetch remote
binaries/scripts and run them without verification. Update the workflow to
verify the downloaded yq, kubeseal, and k3d artifacts using published checksums
or signatures before installing or executing them, and avoid piping the k3d
installer directly into bash; use a downloaded, verified script or installer
artifact instead.

154-157: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Pass KUBE_CTX to the sealing target too.

All surrounding GitOps targets use the workflow’s explicit ${KUBE_CONTEXT} override, but these seal-from-file calls fall back to inventory-derived context. Keep sealing on the same cluster/cert path as bootstrap and deploy.

Proposed fix
-          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" NAMESPACE="${INFRA_NAMESPACE}" NAME=clickhouse-creds VALUE_FILE="${secret_dir}/clickhouse-creds.yaml"
-          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" NAMESPACE="${INFRA_NAMESPACE}" NAME=mariadb-creds VALUE_FILE="${secret_dir}/mariadb-creds.yaml"
-          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" NAMESPACE="${INFRA_NAMESPACE}" NAME=redis-creds VALUE_FILE="${secret_dir}/redis-creds.yaml"
-          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" NAMESPACE="${INSIGHT_NAMESPACE}" NAME=insight-db-creds VALUE_FILE="${secret_dir}/insight-db-creds.yaml"
+          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" KUBE_CTX="${KUBE_CONTEXT}" NAMESPACE="${INFRA_NAMESPACE}" NAME=clickhouse-creds VALUE_FILE="${secret_dir}/clickhouse-creds.yaml"
+          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" KUBE_CTX="${KUBE_CONTEXT}" NAMESPACE="${INFRA_NAMESPACE}" NAME=mariadb-creds VALUE_FILE="${secret_dir}/mariadb-creds.yaml"
+          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" KUBE_CTX="${KUBE_CONTEXT}" NAMESPACE="${INFRA_NAMESPACE}" NAME=redis-creds VALUE_FILE="${secret_dir}/redis-creds.yaml"
+          make -C deploy/gitops seal-from-file ENV="${GITOPS_ENV}" KUBE_CTX="${KUBE_CONTEXT}" NAMESPACE="${INSIGHT_NAMESPACE}" NAME=insight-db-creds VALUE_FILE="${secret_dir}/insight-db-creds.yaml"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/functional-k3s.yml around lines 154 - 157, The
seal-from-file invocations in the GitOps workflow are missing the explicit
Kubernetes context override used by the other deploy/bootstrap targets. Update
the make calls in the sealing step to pass KUBE_CTX using the workflow’s
${KUBE_CONTEXT} value so the seal-from-file target uses the same cluster and
cert path as the rest of the pipeline; keep the change localized to the repeated
seal-from-file commands.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/functional-k3s.yml:
- Around line 187-199: The rollout checks in the functional-k3s workflow
silently succeed when `kubectl get deployments -o name` returns nothing, so add
an explicit assertion before the `rollout status` loop to require at least one
Deployment in the target namespace. Update the shell logic around the deployment
`while IFS= read -r deployment` block to fail fast if the deployment list is
empty, using the existing `kubectl -n "${INSIGHT_NAMESPACE}" get deployments -o
name` command as the source of truth. Keep the subsequent deployment,
statefulset, and job checks unchanged, but ensure the smoke test now fails when
no app deployments are rendered.

---

Nitpick comments:
In @.github/workflows/functional-k3s.yml:
- Around line 47-66: The Install gitops CLI tools and Install k3d steps in
functional-k3s.yml fetch remote binaries/scripts and run them without
verification. Update the workflow to verify the downloaded yq, kubeseal, and k3d
artifacts using published checksums or signatures before installing or executing
them, and avoid piping the k3d installer directly into bash; use a downloaded,
verified script or installer artifact instead.
- Around line 154-157: The seal-from-file invocations in the GitOps workflow are
missing the explicit Kubernetes context override used by the other
deploy/bootstrap targets. Update the make calls in the sealing step to pass
KUBE_CTX using the workflow’s ${KUBE_CONTEXT} value so the seal-from-file target
uses the same cluster and cert path as the rest of the pipeline; keep the change
localized to the repeated seal-from-file commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b73d25b5-fa94-4eca-835e-e3b95e035ba8

📥 Commits

Reviewing files that changed from the base of the PR and between 95009a5 and d67d2cf16841c76dbd396e6b8f8868953e528ad7.

📒 Files selected for processing (7)
  • .github/workflows/functional-k3s.yml
  • deploy/gitops/.gitignore
  • deploy/gitops/environments/functional-ci/clickhouse-values.yaml
  • deploy/gitops/environments/functional-ci/inventory.yaml
  • deploy/gitops/environments/functional-ci/mariadb-values.yaml
  • deploy/gitops/environments/functional-ci/redis-values.yaml
  • deploy/gitops/environments/functional-ci/values.yaml

Comment on lines +187 to +199
while IFS= read -r deployment; do
kubectl -n "${INSIGHT_NAMESPACE}" rollout status "${deployment}" --timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get deployments -o name)

while IFS= read -r statefulset; do
kubectl -n "${INSIGHT_NAMESPACE}" rollout status "${statefulset}" --timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get statefulsets -o name)

while IFS= read -r job; do
kubectl -n "${INSIGHT_NAMESPACE}" wait "${job}" \
--for=condition=Complete \
--timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get jobs -o name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fail when the app renders no deployments.

These loops silently pass on empty kubectl get ... -o name output. Since this smoke test must prove the app services deployed, assert at least one Deployment before rollout checks.

Proposed fix
-          while IFS= read -r deployment; do
+          mapfile -t deployments < <(kubectl -n "${INSIGHT_NAMESPACE}" get deployments -o name)
+          if (( ${`#deployments`[@]} == 0 )); then
+            echo "No deployments found in ${INSIGHT_NAMESPACE}; Insight app did not render deployable workloads." >&2
+            exit 1
+          fi
+
+          for deployment in "${deployments[@]}"; do
             kubectl -n "${INSIGHT_NAMESPACE}" rollout status "${deployment}" --timeout=5m
-          done < <(kubectl -n "${INSIGHT_NAMESPACE}" get deployments -o name)
+          done
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
while IFS= read -r deployment; do
kubectl -n "${INSIGHT_NAMESPACE}" rollout status "${deployment}" --timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get deployments -o name)
while IFS= read -r statefulset; do
kubectl -n "${INSIGHT_NAMESPACE}" rollout status "${statefulset}" --timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get statefulsets -o name)
while IFS= read -r job; do
kubectl -n "${INSIGHT_NAMESPACE}" wait "${job}" \
--for=condition=Complete \
--timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get jobs -o name)
mapfile -t deployments < <(kubectl -n "${INSIGHT_NAMESPACE}" get deployments -o name)
if (( ${`#deployments`[@]} == 0 )); then
echo "No deployments found in ${INSIGHT_NAMESPACE}; Insight app did not render deployable workloads." >&2
exit 1
fi
for deployment in "${deployments[@]}"; do
kubectl -n "${INSIGHT_NAMESPACE}" rollout status "${deployment}" --timeout=5m
done
while IFS= read -r statefulset; do
kubectl -n "${INSIGHT_NAMESPACE}" rollout status "${statefulset}" --timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get statefulsets -o name)
while IFS= read -r job; do
kubectl -n "${INSIGHT_NAMESPACE}" wait "${job}" \
--for=condition=Complete \
--timeout=5m
done < <(kubectl -n "${INSIGHT_NAMESPACE}" get jobs -o name)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/functional-k3s.yml around lines 187 - 199, The rollout
checks in the functional-k3s workflow silently succeed when `kubectl get
deployments -o name` returns nothing, so add an explicit assertion before the
`rollout status` loop to require at least one Deployment in the target
namespace. Update the shell logic around the deployment `while IFS= read -r
deployment` block to fail fast if the deployment list is empty, using the
existing `kubectl -n "${INSIGHT_NAMESPACE}" get deployments -o name` command as
the source of truth. Keep the subsequent deployment, statefulset, and job checks
unchanged, but ensure the smoke test now fails when no app deployments are
rendered.

Signed-off-by: Valeriy.Romanov <valeriy.romanov@acronis.com>
@BlackCelebrant
BlackCelebrant merged commit 92790a1 into constructorfabric:main Jul 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants