It's very simple actually.
... just fucking don't, generate config in your configuration management tool of choice and then serialize it to YAML. You get all of the advantages (nice to read)and none of the disadvantages (need editor or it is PITA)
Re:The YAML Document from Hell
by cocochanel on Thursday January 12, 2023 @08:29AM
(#34353166)
I checked the sample Kubernetes project in Java [0] and it looks hideous. YAML looks much better in comparison.
[0] https://www.pulumi.com/docs/get-started/kubernetes/review-pr...
Re:The YAML Document from Hell
by CipherThrowaway on Thursday January 12, 2023 @08:41AM
(#34353320)
Don't disagree there. Java support is less than a year old and the Java API is.. not great. TypeScript is the more popular and mature choice.
What, you mean you don't want to write code like
Deployment("nginx",DeploymentArgs.builder().spec(DeploymentSpecArgs.builder().selector(LabelSelectorArgs.builder().matchLabels(labels).build()).replicas(1).template(PodTemplateSpecArgs.builder().metadata(ObjectMetaArgs.builder().labels(labels).build()).spec(PodSpecArgs.builder().containers(ContainerArgs.builder().name("nginx").image("nginx").ports(ContainerPortArgs.builder().containerPort(80).build()).build()).build()).build()).build()).build());
Re:The YAML Document from Hell
by lifehasleft on Friday January 13, 2023 @09:36AM
(#34368255)
I actually laughed out loud when I looked at the example and just saw a bunch of carefully-indented “.build()”s
I would love to swap Pulumi for Ansible, but it's cloud-only for the most part.
JSON has no comments. That disqualifies it immediately.
{
“/*These are the ports we use”: “*/”,
“ports”: [22, 80, 443]
}Now, write a json-schema for that.
Can be done by either additionalProperties: true and not specifying the property, or "patternProperties": { "^/\*": { "type": "string" }}.
I'd rather have real comments than this epicycle.
"additionalProperties": true
Re:The YAML Document from Hell
by deterministic on Friday January 13, 2023 @07:13PM
(#34375745)
“Comment”: ”This is a comment that is optional and ignored by code”
"Comment": "but you can only have one per object"
Re:The YAML Document from Hell
by deterministic on Monday January 16, 2023 @02:45AM
(#34397997)
"Comment1": "This is the first comment"
"Comment2": "This is the next comment"
or
"Comments": ["Here is one", "Here is another!"]
or
"Comments": { "Name": "This is the name of the customer", "Age": "This is the age (0 to 1000) of the customer" }
or
"Values": [ {"Name":"Age", "Value":"20", "Comment":"This is the age of the customer"}, {"Name":"Name", "Value":"Mr. Foo Bar", "Comment":"This is the name of the customer"} ]
The only limit is your imagination.
Writing in YAML doesn't feel much better. YMMV but I've been on teams using Pulumi for k8s and the developer experience has been significantly better. I can automate, type check, lint, click through to definitions the same way I do with other typescript.
Pulumi is a young product with many rough edges but it's already been a game changer for me.