A platform API developers can use

A CRD gives a platform team a Kubernetes API for describing what a developer needs. Pair it with a controller that provisions the environment, validates requests, and reports readiness, and a team can ask for a service through a familiar declarative workflow.

A CustomResourceDefinition (CRD) extends the Kubernetes API with a resource type. A custom resource stores an instance of that type. A controller watches those objects and reconciles the requested state with the resources that actually exist. The API object is the contract; the controller is the automation that acts on it.

Design the controller reconciliation loop

Choose a request that fits a resource

This model fits small declarative objects that configure infrastructure or applications and change at a moderate pace. It is a poor place to store end-user data, large payloads, or high-volume event streams. Kubernetes itself cautions against using custom resources as application data storage.

Start with a repeated request that currently needs a ticket or a runbook: a preview environment, a managed database, or an application deployment with standard access. Model the desired outcome as a small object. If the workflow depends on synchronous transactions across many services or handles high-rate records, a dedicated service API may fit better.

Define the developer-facing contract

Keep spec focused on choices the requesting team can understand and is allowed to make. A ServiceEnvironment might accept an application name, a size from an approved set, and a reference to a team-owned source. Keep provider credentials and operator-only details out of this interface.

Provide defaults for routine choices, validate values before reconciliation, and document examples developers can copy. A good platform API makes the safe path the short path while leaving room for teams with a real need to request a different supported option.

Connect the request to automation

The controller watches the custom resource, checks current state, and creates or updates the underlying Kubernetes resources. Give each child a stable identity and ownership reference so retries can find it. Reconciliation should tolerate partial completion: a retry after a temporary API error continues from what exists instead of starting a second environment.

Separate provisioning steps when they have different failure and readiness meanings. Update status as the controller learns more, and make external effects retryable. For deletion, define which objects and external resources the platform removes and how the controller recovers when cleanup fails.

Read the reconciliation design checklist

Make the outcome visible

A successful kubectl apply only confirms that the API server accepted the object. It does not mean the requested environment is ready. Use status conditions to report meaningful states such as accepted, ready, or blocked, with a short reason and a useful message. Expose the endpoint or next action when that information is safe to share.

A developer should be able to answer three questions from the resource: did the platform accept my request, what is happening now, and what should I do if it is blocked? Avoid putting secrets or internal-only diagnostics in status.

Ship a narrow first version

Start with one workflow and a small set of supported options. Test schema rejection, duplicate reconciliation, partial failures, configuration changes and deletion. Ask a few developers to complete the task using only the API documentation; unclear field names and missing feedback show up quickly in that review.

Measure the workflow using signals the team already trusts: time from request to ready, failed requests, retries, and support escalations. Define a baseline before rollout and report the actual observation window; do not infer developer productivity from the presence of a CRD.

Common design mistakes

An API with dozens of infrastructure knobs transfers platform complexity to every product team. Offer a small set of supported choices and expand it in response to real requests.

A status field that says only “failed” leaves the developer guessing. Report a stable reason, whether retry is expected, and an actionable next step.

A controller that works only on the clean first attempt creates manual recovery work. Exercise retries and partial state as part of the initial design.

Creating a CRD for every configuration file adds API and lifecycle overhead. Use a custom resource when Kubernetes-style declarative automation adds value to the workflow.

Start with the request developers repeat

Write down the desired outcome, the allowed choices, the readiness signal, and the cleanup behavior for one repeated task. Use that contract to decide whether a CRD fits, then build the smallest controller that can converge safely.

References & further reading

Need help with your Go backend?

I work with engineering teams on focused Go and Kubernetes platform engagements, with limited consulting availability.

Explore Go consulting services