The Simplest Way to Make Fluxcd and Gerrit Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running fluxcd and gerrit together gives your team a solid GitOps delivery loop. Developers review code in Gerrit, and FluxCD pulls approved changes into the cluster. This setup keeps cluster state matched to reviewed Git commits at all times. Your team gets strict code review rules before any change hits a live cluster. Still, pairing these two tools takes careful work around keys, roles, and webhooks. How fluxcd and gerrit handle keys, roles, and data flow Gerrit acts as the Git server and

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Running fluxcd and gerrit together gives your team a solid GitOps delivery loop. Developers review code in Gerrit, and FluxCD pulls approved changes into the cluster.

This setup keeps cluster state matched to reviewed Git commits at all times. Your team gets strict code review rules before any change hits a live cluster. Still, pairing these two tools takes careful work around keys, roles, and webhooks.

How fluxcd and gerrit handle keys, roles, and data flow

Gerrit acts as the Git server and holds the desired state of your cluster. FluxCD runs inside the cluster and watches a target branch in Gerrit. When a reviewer approves a patch in Gerrit, Gerrit merges that commit.

FluxCD checks the Gerrit repo on a set timer or awaits a webhook event. To read the repo, FluxCD needs an SSH key or an HTTP password. That credential belongs to a dedicated service user account inside Gerrit.

The Gerrit admin must grant this service user read access on the target branch. If you use image updates, FluxCD also needs write access to push commits back. In Gerrit, pushing straight to a branch skips review unless you grant special rights. Most teams let FluxCD push to a branch or create a change for review.

Common failure modes and how to scope roles and network paths

Many teams fail by sharing one broad admin account across all clusters. If one cluster gets breached, the attacker gains write access to every Gerrit project. Shared accounts also ruin your audit logs because every action looks the same.

Another common issue is long-lived SSH keys stored in plain cluster secrets. Engineers rarely rotate these keys because a mistake will break the sync loop. Broad network rules also cause risk when any pod can reach the Gerrit server.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix this by making one Gerrit service user per cluster and team. Give that user read access only to the exact repos for that cluster. If FluxCD never writes back to Git, revoke all push rights in Gerrit.

Lock down network paths so only the FluxCD source controller can reach Gerrit. Set up webhook secrets so external actors cannot send fake sync events to FluxCD. Rotate SSH keys and HTTP passwords on a strict timer to limit blast radius. Check Gerrit audit logs each week to spot strange clone or push events.

Keeping code review rules intact during automated syncs

Gerrit uses a strict change review model rather than standard branch pulls. When FluxCD updates an image tag, it wants to push a raw commit. If Gerrit blocks direct pushes, the image update controller will fail its run.

To solve this, grant the FluxCD user permission to push directly to your branch. Limit this rule to the exact path or branch that holds image tags. This keeps human code in the review queue while letting automation run on time.

You should also test how Gerrit handles high pull loads from many clusters. If dozens of clusters poll Gerrit every minute, the server can slow down. Use Gerrit event hooks to ping FluxCD only when a real merge happens. This cuts down network traffic and makes cluster updates run much faster.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Should FluxCD use SSH or HTTP to read from Gerrit?

Both protocols work well when you scope the Gerrit service account roles right. Pick SSH for simple key checks, or use HTTP if your network blocks SSH.

How do we stop FluxCD from bypassing Gerrit code review?

Give the FluxCD account read-only rights on main branches used by developers. Only allow direct pushes on isolated branches that track automated image tag updates.

Why does FluxCD fail to clone a Gerrit repo after setup?

Gerrit often needs an initial empty commit on the target branch before cloning works. Also check that the service user has read rights on the project reference.

The query runs. The emails stay hidden.