The problem
A customer operating under CMMC needed their own GitLab — not the SaaS one. Source code, CI runners, and artifacts all had to sit inside a boundary they controlled, in GovCloud, with evidence they could hand to an assessor. "Install the omnibus package on an EC2 instance" would have satisfied the letter of that and none of the spirit: no horizontal scale, backups nobody tests, and a machine that drifts from the day it boots.
The real constraint is subtler. In a regulated environment, the gap between what you designed and what is actually running is an audit finding. Most infrastructure tooling reconciles that gap when someone runs it. That is fine until the person who runs it is on holiday, and it is never fine when the question is "prove this control has been enforced continuously."
What it is made of
GitLab is not one service. It is a Rails application, Gitaly for repository storage, Sidekiq workers, a registry, runners, plus PostgreSQL, Redis, and object storage — each of which wants to be somebody else's problem in production. Everything stateful was pulled out of the cluster and given to a managed service, so a node can be replaced at any moment without anybody thinking about it.
Why a control plane, not a module tree
GitLab's dependency chain is genuinely ordered. The database subnet group needs the VPC. Aurora needs the subnet group and a parameter group. The application needs Aurora's endpoint, Redis' endpoint, the bucket names, an IAM role scoped to those buckets, and a certificate signed by a CA that lives in a different account. Express that as Terraform and you get a module tree plus a human who knows the apply order.
Expressed as a Crossplane composition, the order stops being tribal knowledge and becomes the program.
Nine function-pythonic steps walk the chain, each one reading what the previous step actually
produced rather than what it was supposed to produce. Python matters here: the branching in this chain
— conditional resources per environment, names derived from several inputs at once — is
miserable to express in patch-and-transform YAML and ordinary to express in a function.
plan; this one closes every reconcile interval, which is the difference between "we
configured that control" and "that control is enforced right now."
The parts that were actually hard
Cross-account private PKI
Everything internal is TLS, and the CA lives in a shared-services account so that one team owns issuance for the whole estate. That means the workload account has to be able to request certificates from a resource it does not own, and the CA account has to permit exactly that and nothing more — a resource share plus a policy narrow enough to survive review. It is a small amount of configuration guarding a large amount of blast radius, which is exactly the sort of thing that is worth getting into code where a reviewer can see it.
Reaching the corporate network without opening a door
The platform had to be usable by people on the corporate network and by nobody else. An internal NLB
fronting the Gateway, plus OKTA in the auth path, gets there without an internet-facing endpoint existing
at all. The failure mode to design against is not an attacker — it is the well-meaning change six
months later that flips a scheme to internet-facing because something was hard to reach. Being
declared in a composition is what makes that change visible in a diff.
GovCloud is not a region flag
Partition-aware ARNs (aws-us-gov, not aws), a smaller and later service catalogue,
and provider behaviour that differs in small ways from commercial. The practical rule: assume nothing about
a service's availability in GovCloud until you have seen it in that partition, and keep the composition
free of hard-coded partition strings.
Compliance, done as engineering
Alongside the build, a CMMC Level 1 / Level 2 gap analysis covering all fourteen NIST SP 800-171 Rev. 2 control families. The value of doing that work with the same hands that build the platform is that controls stop being a document. "Access is enforced" becomes a Gateway policy and an OKTA claim. "Cryptographic protection" becomes the private CA and envelope encryption. "Least privilege" becomes Pod Identity roles you can read. Each control ends up pointing at a line in a repository instead of at a paragraph in a binder.
What shipped
- Self-managed GitLab on EKS in GovCloud, stateful tiers on Aurora, ElastiCache and S3.
- A multi-account Crossplane control plane with nine
function-pythoniccomposition steps covering the full dependency chain. - Cilium Gateway API, cross-account ACM Private CA, Route 53, and an internal OKTA-backed NLB bridge.
- Pod Identity throughout — no static AWS credentials in any workload.
- A CMMC L1/L2 gap analysis against all 14 NIST SP 800-171 Rev. 2 control families.
What I would do differently
Write the composition tests before the ninth step, not after. A composition that produces the right YAML
for the happy path and something surprising for a half-deleted environment is easy to build and expensive
to debug at 2am. crossplane render against a set of fixture claims is cheap to run in CI and I
reached for it later than I should have.
Client details are deliberately absent here. Happy to go deeper on the architecture in conversation.