Common workflows¶
Use these recipes to weave babyctl into your day-to-day operations.
Bring existing infrastructure under control¶
- Export the current definition using whatever tooling is available (Terraform state, cloud console export, etc.).
- Convert it to YAML if needed:
babyctl convert -f terraform.tfstate -oyaml > imported.yaml - Review the manifest, trim any drift you want babyctl to own, and run:
babyctl apply -f imported.yaml - Repeat with
babyctl diffuntil the declarative state matches reality.
Manage everything through overlays¶
Use your existing Kustomize/Helm/ytt pipelines and pipe the rendered output into babyctl:
kustomize build overlays/prod | babyctl apply -f-
Pair babyctl diff -f- with the same pipeline to preview changes in CI before you deploy.
Emergency edits¶
When latency matters more than automation:
BABYCTL_EDITOR="vim" babyctl edit --path examples/api-definitions/apis widget cli-demo
babyctl downloads the resource, opens $BABYCTL_EDITOR (falling back through $KUBE_EDITOR, $VISUAL, $EDITOR, and finally vi), and applies the diff. Use babyctl get <resource> -oyaml afterwards to confirm
that the update landed as expected. The initial implementation focuses on the bundled babyctl.dev/v1alpha1 Widget resource when you run against the local API definitions.
Convert formats for hybrid teams¶
# HCL -> YAML
babyctl convert -f terraform.tf -oyaml > infra.yaml
# YAML -> HCL
babyctl convert -f infra.yaml -ohcl > terraform.tf
This enables GitOps teams that prefer YAML while still producing Terraform-friendly configuration.
Expose discovery data to kubectl¶
- Install the sample API definitions under
~/.babyctl/apisas described in the getting started guide. - Start the discovery server:
babyctl api-server --port 8080 - Point kubectl at it:
kubectl config set-cluster babyctl-api --server=http://localhost:8080 kubectl config set-context babyctl-api --cluster=babyctl-api kubectl config use-context babyctl-api kubectl api-resources
See the kubectl integration guide for more detail.
Automate with CI/CD¶
- Run
babyctl diffin pull requests to show proposed infrastructure changes. - Use
babyctl applyin a controlled environment (e.g. GitHub Actions job) once changes are approved. - Leverage the release automation to ship binaries for consumers.