spec — think of it as a concise request form that declares the desired state. For this WebApp operator, the first API version keeps the spec intentionally small with just two fields.
The first field is image. It is a string that tells the Deployment which container image to run.
The second field is replicas. It is an int32 (the conventional small integer type Kubernetes uses for replica counts). replicas tells the Deployment how many Pods should exist.

spec. There is no service type, no custom port, no nested configuration object, and no status field — those are left out so the initial API remains focused and easy to reason about.

spec doesn’t expose these options yet, the operator will still create a Service and a ConfigMap for the application. The operator uses clear, fixed defaults for those child resources so the reconciliation loop can be validated end to end without extra user configuration.

- Service default:
ClusterIPon port80. - ConfigMap default: a simple static welcome page.
spec fields later (for example port), but start small so the first reconciler remains readable and testable.
Start with a narrow API surface. Small, opinionated defaults let you validate reconciliation behavior quickly; expand the
spec only when you need to expose additional user-configurable options.
spec as fields on the WebAppSpec struct. The JSON struct tags determine the YAML/JSON field names users write in their manifests:
controller-gen) can add API-server behavior such as defaults and validation. Running make manifests converts those markers into the CRD OpenAPI schema that the API server enforces.
Remember to add kubebuilder validation and default markers if you expect defaults or input validation. Without them, the API server won’t enforce constraints and invalid manifests could reach your controller.
Next step: translate this design into controller and reconcile logic that instantiates the Deployment, Service, and ConfigMap. Implement the reconcile loop to:
- Read the
WebAppinstance and itsspec. - Construct desired child resources (Deployment, Service, ConfigMap) using the
specvalues and operator defaults. - Create or update child resources, set owner references, and ensure labels/selector consistency.
- Requeue and reconcile until observed state matches desired state.