Show HN: TypeKro – TypeScript infra-as-code for Kubernetes built on KRO
typekro.runHi all,
I've been building yet another tool to let people build on Kubernetes and escape the pain of YAML. I've open sourced it under the Apache-2.0 license and would love some feedback.
The tool was inspired by KRO (https://kro.run) (a project recently released by Amazon) and builds on top of it. TypeKro is aimed at providing a declarative type-safe user experience to orchestrating complex kubernetes dependencies with TypeScript, so you get your intelli-sense and all the other benefits of a modern programming language.
It is differentiated in a few ways:
1. TypeKro provides a seamless development experience where you can access status fields that will exist at runtime like as though they're already populated to make the development experience seamless. TypeKro or KRO will be able to handle orchestration seamlessly in the javascript runtime or in the operator in the kubernetes cluster respectively.
As a illustrative example: ```typescript const database = StatefulSet({ ... }); const webapp = Deployment({ name: 'my-app', image: 'my-app:latest', env: { // This looks like a normal property access, but it's // a type-safe reference that resolves after deployment! DATABASE_HOST: database.status.host, }, }); ```
2. TypeKro has 3 deployment modes to give you flexibility including rendering gitops ready yaml, deploying directly to your kubernetes cluster with a topological sorted DAG, and deploying your infrastructure as a KRO resource graph definition.
These three deployment approaches let you develop with a short-feedback loop and give you flexibility in deployment.
3. TypeKro is Kubernetes control-plane aware and will even stream relevant kubernetes events to your terminal while you're deploying resources.
4. TypeKro is smart enough to delay Custom Resource deployments until their CRDs are ready since the Kubernetes API won't accept CRs until their CRDs are ready.
5. TypeKro tries to expose everything with a very simple API integrated with arktype so you can build and consume kubernetesComposition() using tools familiar to typescript developers, and it has built in ability to integrate with your existing tool stack. You can use it to deploy your helm charts or your yaml manifests along with your new resources.
If you're interested, a good place to start is the docs site: https://typekro.run/
You can access the source code here (all stars appreciated): https://github.com/yehudacohen/typekro
And if you want my very long winded thoughts about TypeKro's software architecture and its place in the ecosystem, you can read my very long blog post here. Fair warning it's long: https://yehudacohen.substack.com/p/introducing-typekro
And I created a discord which currently has 0 users. So if you'd like to be first, pop on in!
It's still early days, so while I hope this provides a good experience I'm sure there are still bugs that aren't captured by my test suite. I've also only tested it against my local kind cluster so far.
I'd love to improve this and make it the easiest way to deploy to kubernetes. There are many things I'd love to do with TypeKro, including integrating resources from Crossplane and cloud controllers and other 3rd party resources with their intricate composition dependencies. I'd also love to try it out with and extend it to support multi-cluster deployments where resources span infrastructure boundaries.
All contributions are most welcome!