Recipes for common changes¶
Each recipe lists the files to touch, in order. Finish every one with make test-remote, the book, and a deploy.
Add a field to rendimiento.yaml¶
Example: terminationGracePeriod (seconds a pod gets to shut down).
- Type in
internal/spec/spec.go, onService, with a doc comment: - Default in
Spec.Defaultif it needs one, and validation inSpec.Validate(range, format), with a message naming the path (services[%d].terminationGracePeriod). - Tests in
internal/spec/spec_test.go: a valid value parses; an invalid one gives the message. - Rendering in
internal/render/render.go(deployment): setpod.TerminationGracePeriodSeconds. - Golden files: if the golden spec should show it, add it to the test's input; regenerate and review the diff:
- Regenerate the CRD, since the
Appresource embeds the spec:make generate. Commitdeploy/crds/. - UI, if people should set it in the wizard: the
Servicetype inweb/src/api.ts, a field inServiceForm(pages/NewApp.tsx). - Book: a row in the reference.
- Deploy:
kubectl apply -f deploy/crds/rendimiento.ai_apps.yamlbefore the new platform (otherwise the API server drops the new field), thenmake imageand restart.
Add an API endpoint and a UI page¶
Example: GET /api/apps/{app}/pods.
- Handler: a method on
*Serverininternal/api(a new file per area, likeaddons.go): Keep logic out of handlers: put it in the platform, store or controller package, and call it. - Route in
Server.Handler:auth("GET /api/apps/{app}/pods", s.appPods).authmeans a session is required;loginis the user. - Test in
internal/api/server_test.go(a real store, a fake platform where needed). - Client: the response type and a function in
web/src/api.ts. - Page or component in
web/src/pages/; a route inmain.tsx(and aNavLinkfor a top-level page). UseusePollto load and refresh. - Book: the API reference, and the guide chapter the feature belongs to.
Add an add-on to the catalog¶
- Check the chart: its repository's
index.yaml, the version, and arm64 images. - Add an entry to
Catalogininternal/addon/catalog.go:ID,Title,Category,Description,Helm(repo, chart, version),Namespace, and a fewFields(dotted value paths with a label, type and default). SetManualSyncfor anything risky, andNotesfor what users must know. - Try it for real: install it from the UI, check the preview, then uninstall.
- Book: Add-ons lists the catalog.
Add an environment check¶
- Write
func (c *Checker) checkX(ctx context.Context) Checkininternal/environment/checks.go: setID,Name,Category,Required, thenStatus(OK,Warning,Missing,Error), a one-lineSummary,Details, and aFixthat tells the reader exactly what to do. - Register it in
Checker.checks. - Test it in
environment_test.gowith a fake client.
Add a DNS provider¶
- Implement
dns.Provider(Ensure,Remove,Zones,Describe) ininternal/dns/<provider>.go.Ensuremust refuse to overwrite records it did not create (mark yours, as Cloudflare's comment does). - Select it in
cmd/rendimiento/main.gofrom new settings. - Add it to the provider options shown on the Environment page.
- Tests with
httptest.NewServerstanding in for the provider's API.
Change the database¶
- Add
internal/store/migrations/000N_what.sql. Never edit a migration that has already run anywhere. - Add store methods, each with a doc comment, plain SQL, and
ErrNotFoundfor missing rows. - Tests in
internal/store/store_test.go(they run against the test Postgres). - The migration runs automatically on the platform's next start.
Add a new kind of CI step¶
Task steps (tasks:, commands such as eas build with secrets) were added this way, so follow them as the worked example: spec.Task, KindTask, internal/pipeline/task.go, and skippedTasks in the platform.
- Spec: a way to declare it (a top-level list like
tasks:), with defaults and validation (names unique across services, jobs and tasks; references that exist; no cycles). - Plan (
internal/pipeline/plan.go): a newKind, steps with their dependencies. - Executor (
KubeExecutor.pod): the container for that kind (image, command, env from secrets, resources). - Release (
platform.release): decide whether the step's outcome affects releases. - UI: the run graph shows any kind; add an icon if you like.
- Tests: plan tests, a pod-shape test (like
TestBuildPodPicksBuilder), and a runner test.
Detect a new language or framework¶
internal/detect/detect.go: recognise the manifest, setLanguage,Framework,Port, test image and command, with aReasonsline explaining the guess.- A Dockerfile template in
templates/dockerfiles/<name>.tmpl, chosen ininternal/generate/generate.go. - Tests with an
fstest.MapFSrepository indetect_test.goandgenerate_test.go.
Manage a new kind of Kubernetes object for apps¶
- Render it (
internal/render), add it toObjectsandObjects.List. - Let the controller watch it:
Owns(&Kind{})inAppReconciler.SetupWithManager. - Prune it (
prunelists and deletes stale ones by label). - Grant the RBAC in
deploy/rbac.yaml. - Decide whether adoption should take it over (
takeover).