Skip to content

Getting Started

Chant is a TypeScript-to-YAML compiler. You write typed TypeScript declarations, and chant outputs Config Connector YAML manifests that can be applied to a GKE cluster with Config Connector installed.

  1. A GKE cluster with Config Connector installed
  2. A ConfigConnectorContext resource configured per namespace
  3. A GCP Service Account bound to the Config Connector controller
Terminal window
npm install --save-dev @intentius/chant @intentius/chant-lexicon-gcp

The fastest path is the GcsBucket composite — one function call that produces a properly configured Storage bucket:

src/infra.gcp.ts
import { GcsBucket } from "@intentius/chant-lexicon-gcp";
import { defaultAnnotations, GCP } from "@intentius/chant-lexicon-gcp";
export const annotations = defaultAnnotations({
"cnrm.cloud.google.com/project-id": GCP.ProjectId,
});
const { bucket } = GcsBucket({
name: "my-data-bucket",
location: "US",
versioning: true,
});
export { bucket };
Terminal window
# Generate Config Connector YAML
chant build --output dist/manifests.yaml
# Validate against the cluster API (no changes applied)
kubectl apply -f dist/manifests.yaml --dry-run=server
# Apply
kubectl apply -f dist/manifests.yaml
import { StorageBucket, IAMPolicyMember, GCP } from "@intentius/chant-lexicon-gcp";
export const bucket = new StorageBucket({
location: "US",
storageClass: "STANDARD",
uniformBucketLevelAccess: true,
versioning: { enabled: true },
});
export const reader = new IAMPolicyMember({
member: "serviceAccount:app@my-project.iam.gserviceaccount.com",
role: "roles/storage.objectViewer",
resourceRef: {
apiVersion: "storage.cnrm.cloud.google.com/v1beta1",
kind: "StorageBucket",
name: bucket,
},
});