Up

Update your CRDs with confidence ( schema validation with cty)

Hacker News

Update your CRDs with confidence ( schema validation with cty)

Hello everyone! Previously I wrote about cty[^1] that can be used to generate valid YAML samples from a CRD ( now, including things like, valid Pattern generated random string, enums, default values, minimum int, minimum number of items.. etc ). It also has a website that can be used to achieve the same thing here: https://crdtoyaml.com/ This update https://github.com/Skarlso/crd-to-sample-yaml/releases/tag/v... brings a feature with it, which I think is super cool. If not, well, then no. :) Basically, inspired by `helm unittest` the user can define a test like this: suite: test aws clusters infrastructure crds template: sample-tests/crds/infrastructure.cluster.x-k8s.io_awsclusters.yaml tests: - it: matches AWSCluster crds correctly asserts: - matchSnapshot: # this will generate one snapshot / CRD version and match all of them to the right version of the CRD path: sample-tests/__snapshots__ - matchSnapshot: path: sample-tests/__snapshots__ # generates a yaml file minimal: true - matchString: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AWSCluster spec: controlPlaneEndpoint: host: string port: 1 - matchString: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AWSCluster spec: controlPlaneEndpoint: # this is failing the test because the type is number and not string host: 12345 port: 1 This will take a CRD and test the CRD validates a given sample. In this case, it's a string and two snapshot values. The snapshots can be generated using `cty test sample-tests --update`. The snapshots will contain valid values, such as minimum integer, minimum number of items, defaults, enums, Patterns ( yes it generates random value that will satisfy a given pattern regex ) and more. It will only ever match the right version with the right version. Meaning it won't try `v1beta2` to match to `v1alpha1`. Since CRD files can have multiple versions in them. It can be added as a simple make target like helm unittest. This is very much an alpha feature, so please, if you do use it, report any problems. :) Thank you! Enjoy. [^1]: https://github.com/Skarlso/crd-to-sample-yaml

Share card

Actual performance

2points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: including · Missing: supports, reddit linkedin, podcasting
60%60% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
44%44% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: host · Missing: plus, platform, intuitive
38%38% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Product HuntUnlikely to reach the leaderboard · Strong signals: user, using · Missing: mac, agents, macos
37%37% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: ide, io, including · Missing: https docs, excited, just released
31%31% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
12%12% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Sc
Schema – A Golang Validation Library Inspired by Zod37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Schema – A Golang Validation Library Inspired by Zod

Hacker News2
JS
JSON storage bins with schema validation41%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

JSON storage bins with schema validation

Hacker News74
Ty
TypeSchema – Universal adapter for TypeScript schema validation38%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

TypeSchema – Universal adapter for TypeScript schema validation

Hacker News2
Un
Universal adapter for TypeScript schema validation38%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Universal adapter for TypeScript schema validation

Hacker News2
Go
Golang Schema Validation Toolkit Inspired by Zod.dev43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Golang Schema Validation Toolkit Inspired by Zod.dev

Hacker News4
Va
Validation in Python (schema, marshmallow, pydantic) – includes video32%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Validation in Python (schema, marshmallow, pydantic) – includes video

Hacker News2
Pa
Parameter Validation in Javalin (Kotlin)22%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Parameter Validation in Javalin (Kotlin)

Hacker News1
Le
Lemma Derivation/Validation Trees48%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Lemma Derivation/Validation Trees

Hacker News1
Se
SerdeV – Serde with Validation20%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

SerdeV – Serde with Validation

Hacker News2
pb
pbfish – A minimal error-tolerant schema validation library38%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

pbfish – A minimal error-tolerant schema validation library

Hacker News5