Overview
Kittyhawk uses cdk8s to synthesize Kubernetes YAML files from your TypeScript deployment configuration. This process is called “synthesis” or “synth”.How cdk8s Synth Works
The synthesis process transforms your TypeScript constructs into Kubernetes YAML manifests:- Compilation: TypeScript code is compiled to JavaScript
- Synthesis: The cdk8s framework executes your code and generates YAML
- Output: YAML files are written to the
distdirectory
Required Environment Variables
For YAML generation to work properly, you must set the following environment variables:The name of the application being deployed. This should be set to your repository name.
The SHA of the latest commit. Used for image tagging and versioning.
Output Structure
After running the synthesis command, the generated YAML file will be located at:- Deployments
- Services
- Ingresses
- CronJobs
- ConfigMaps and Secrets
- Any other Kubernetes resources you’ve defined
Local Testing Commands
Step 1: Navigate to k8s Directory
First, change to yourk8s directory:
Step 2: Set Environment Variables
Set the required environment variables:Step 3: Generate YAML
Run the compile and synthesis commands:Step 4: Verify Output
Check the generated YAML file:Testing in Development
When running tests locally, you can use placeholder values for the environment variables:package.json scripts).
Troubleshooting
Missing Environment Variables
If you see errors about missing environment variables, ensure bothRELEASE_NAME and GIT_SHA are set before running synthesis.
Synthesis Errors
If synthesis fails:- Check your TypeScript code for errors:
yarn compile - Verify all constructs are properly imported
- Ensure your chart extends
PennLabsChart
Next Steps
- Learn about GitHub Actions integration
- Explore Kittyhawk constructs like DjangoApplication and CronJobs
- Read the cdk8s documentation