Hacker News new | ask | show | jobs
by sgarland 50 days ago
I especially enjoyed where you discovered that K8s runs on string interpolation. That feeling never goes away, FYI; every time you have to play with nindent, you lose a little piece of your sanity.
4 comments

This is partially a tangent, but the whole managing of software infrastructure is a strange culture. There would of course be lots of better ways, but it's too bad the infrastructure side of the software industry lives partially in a parallel world and many of the lessons from elsewhere in the industry are not really widespread there (at least yet). Even banks seem intelligent and innovative compared to infrastructure management mainstream practices.

It's very error prone to describe a hierarchy of versioned software packages and configuration with shell scripts and yaml. Or use text files in git as a database. Or use the CI system as a bad substitute for a proper service (in order to do a simple thing, you must first create the world from scratch). And so on. Mainstream industry knows types, programming languages, relational databases, graphs and you name it, but those have not yet penetrated sufficiently into the infrastructure world. The understanding of the value of having types has been paid in sweat and blood when developing software and databases. Even a basic CRUD application with a basic SQL database will run rings around these Frankenstein monsters: in safety, speed, and extendability.

Yeah I think the difference ultimately is the API surface of infra versus app software. If you're developing software, you get to contain and abstract everything into your own vision of how things should be done with types etc. But infra is managing a whole bunch of other people's software, each with their own vision of how things should be done, which means that often things just fall back to the least common denominator, plain ASCII
> basic CRUD application with a basic SQL database

The whole problem on the infrastructure side is that the APIs are slow and you don't have exclusive access. Building the CRUD app would be a million times harder if SQL calls took 100x longer to execute and other people could randomly reach into the database and change the schema and data at will - can your basic CRUD app gracefully handle somebody shoving newlines at the end of usernames? Odds are that the first time, no, not until you put a trim() call. And then you cry in pain at needing to put trim() calls everywhere. And then you gnash your teeth at people reporting performance problems because of all the defensive checks you put in because all trust has been thrown out. And then you find out that trim() was deprecated and will now be replaced by strim() that handles Unicode a little differently, and you need to port your code before End of Life to stay compliant.

A basic CRUD application with a basic SQL database doesn't solve the problem, because you don't seem to appreciate that there already is a database - however your vendor stores configuration - and it's your job to deal with it. Adding another database on top of it would make the problem worse.

Let's have a toy example. You want to store some information about some software configuration and let users view it. Some fairly basic data.

If you are infrastructure software minded, you might store the data in files that are stored in git. For users to read the data, they can perhaps browse the repo or clone it. For some more complex questions you might have a document which tells the user how to fire a CI pipeline that runs some code over the data and the user has to read the pipeline logs to get the information. The CI pipeline will probably run in a container which will produce a large log and take a long time to start.

If you are software software minded, you store the values in a database, make a service with a REST or some other API and create a browser UI. User can browse the data in a table view and perform searches and perhaps there's some more complex business logic executed on the backend to get answers to some more complex questions.

In this case, both systems can easily do the job. But the solutions are very different.

Infra folks can absolutely build self-service UIs and I have seen it being done even before AI, for instance using low-code tools.
> It's very error prone to describe a hierarchy of versioned software packages and configuration with shell scripts and yaml.

We have a multitude of configuration/markup languages all doing the exact same thing.

We have solved this problem in the 60s: S-Expressions. Should have just used that for everything. Configuration, code, websites, you name it. Infinitely extendable, easy to parse.

I personally have dealt a lot with S-expressions, and at this point, given the amount of tooling, I think JSON is just almost always the right choice. It parses fast with SIMDJSON or doing various other approaches to parse sparsely. It's a little under-specified in terms of stuff like number precision, but you can honestly write your own JSON parser which does >600MB/s with an LLM in one shot and do whatever custom validation you want these days. And you get unambiguous maps without having to glean from adjacency list structure like in sexp.

And if you really love sexps, then writing a bunch of arrays in JSON is also viable. If you asked me 10 years ago I might've complained about JSON, but now I think we messed up by having a bunch of other formats, tbh. I have my own TUI JSON editor that can render in tree view, miller tree view, flat view, and inferred table view, and it makes editing JSON very easy too.

Oh and duckdb can query against compressed json and jsonl at GB/s

I'm a lisp nerd, but why do you say sexps are the answer here? I think the point of a lot of configuration formats is that they don't want their configuration to also be a full-fledged programming language.
> I think the point of a lot of configuration formats is that they don't want their configuration to also be a full-fledged programming language.

That seems to be everyone's initial goal, but then it inevitably gets leaky.

I think the dominant split here that forces everything into a weird mismash is that nobody really wants to have to understand arbitrary programming language configs for third-party stuff, they want to read config and know what's going on. BUT for their own stuff, they find reasons to want more power and expressibility...

> That seems to be everyone's initial goal, but then it inevitably gets leaky.

This is very much true. And until they do get leaky, you have to wrap them in all sorts of weird templates or other forms of abstraction.

This is one of the reasons I used to really like Chef's config language. It was a Ruby DSL, which meant that anything the DSL couldn't do natively, you could just use Ruby right there.

Of course, this is easily misused, but if you were careful it was as powerful as it was elegant.

> they don't want their configuration to also be a full-fledged programming language.

They say they don't want it but every configurmation format eventually ends up becoming turing complete at some point.

There has been some config languages, like Cue, that are not Turing complete. It is useful of have them always complete and have deterministic evaluation.

Cue also has a lot of schema validation which is better than dynamic languages.

Sexps, on their own, are not a programming language.
I’m aware.
How would you create a configuration file with S-expressions? Wouldn't it require defining operators and a parser?
Going in a completely different direction, Haskell could make a nice, powerful configuration language.

If it compiles, it’s almost certainly correct.

This idea exists (as in a functional language which is used for configuration), and it's called Dhall (https://dhall-lang.org/). But they made it a total language so that it has stronger guarantees of terminating and lots of other config specific stuff.
It no longer applies at all, and in retrospect might look silly, but a core principle of "infra as yaml" and "infra as piles of plain-text files in git" was that infra was supposed to be dumb.

A reliability engineer's nightmare, and a common one, is stepping into a company whose deployment pipeline is built in-house, with dynamic bespoke software. What happens when Jeff leaves to build his own startup and absolutely no one knows how that Node.js script shells out to SSH to call docker on a remote server? I can tell you what happens: everything works fine for awhile and then suddenly doesn't for awhile.

On the other hand, you join a company with K8s and plain-jane YAML and can instantly grok the entire system and fix prod on your first day while the S-team sweats behind you, watching every key stroke. The seconds I have to read some javascript or bash or perl are precious seconds the brand is suffering.

In software engineering, flexibility and abstraction is a benefit: the product must pivot and evolve. In reliability engineering we want dead simple, tried and true. You want to be able to step outside your SF office and say "Someone help me with EKS, my DevOps guy died last night in a car crash!" and have 4 people with wild hair take their weird off-brand not-air-pods out of their head and say "uhhh sure okay".

Does all of this change with AI? Yes. Did it make sense a year ago for business continuity reasons? Yes. Was it ever beautiful where the rubber hit the road? No.

Why aren't tires as complex as wiring harnesses?

> core principle of "infra as yaml" and "infra as piles of plain-text files in git" was that infra was supposed to be dumb.

The problem is that that's not true in practice. It's a myth, and always has been for all but the most trivial setups. Infrastructure is now highly dynamic and, like old cities, becomes more complex, calcified, and non-uniform with age.

Infrastructure configuration is an excellent example of the blurriness of code-vs-configuration. I'm now several decades into my career, and I'd rather have pure code generate my configurations than some Frankenstein's monster of "mostly config but lots of code in there when it gets too complicated" UX. Config file formats always evolve into this mess eventually, and a lot of my fellow practitioners don't seem to recognize this problem, leaving the cycle to continue.

Golang string interpolation, to make it even more fun and hairy. I never understood why Helm didn't treat the YAML as a tree in memory so that you didn't have to worry about whitespace.
I definitely prefer using kustomize over helm, where the mentioned interpolation takes place.
I set up a whole startup using Kustomize. It was great, except almost no-one used the inheritance feature except me - they all copy-pasted everything. Then the company grew and hired some dedicated devops people, who immediately started switching to Helm. I threw up my hands and went back to focusing on software development.

I’ve done some NGO-related work and in that context, they talk about “appropriate technology” - technology that’s suited to the local population, among other things. I’ve started to see tools like Helm and languages like Go as appropriate technology for many teams, but that doesn’t mean I’m going to switch to a pedal-powered water pump in my own house.

I also prefer Kustomize over Helm. That said, their removal of vars was a boneheaded decision without a working replacement.

https://github.com/kubernetes-sigs/kustomize/issues/4049

You can do JSON instead of YAML.

But no one does that because it is significantly uglier. So I guess we don't deserve sanity because we don't want our programs to be ugly?

The point is not how pretty the strings are. The point is there should be no strings at all. These are computer programs, so they should use normal objects. The python code `my_pod = nignx_pod()` will never throw a syntax error because the result has too many/too few spaces.
You can import the client library and work with types directly if you like. I've done that for years, it works great.
no one is stopping you from importing k8s types as protobufs and writing a program to talk to k8s api via protobuf encoding. all the types are already protos (except CRDs). it's just not the most user-friendly way so most people don't use it.
no, you don't have to resort to imperative protobuf slinging.

https://tanka.dev/

https://www.pulumi.com/

And plenty more exist today. But helm got popular first, so due to the collective action problem it's going to take the industry forever to switch off it.

most ops people just like templates bc coding wasn't their strong suit (at least before AI) and helm delivered the least friction way of using templates.
Isn't this basically crossplane? https://www.crossplane.io/
No, crossplane types are CRDs so ironically you have to use the `unstructured` package for them instead of the proper typed structs in the core client libraries. (Unless you also generate typed libraries for your CRDs).
crossplane is more about lifecycle management than just pure API
Of course it will. Just add a few spaces at the front of the line and it’ll throw an error.
> The python code `my_pod = nignx_pod()` will never throw a syntax error because the result has too many/too few spaces

Yes, but it might throw errors because the client library you're using is too old and attempts to define fields that no longer exist in your newer infrastructure API. You do not find these errors at compile-time, but rather at runtime, and only after both serialization and API request execution finish and you get an error from the API, in the best case, or a silent failure misconfiguring your infrastructure, at worst.

The only time an infra engineer would trust the types is if the vendor themself supplied them, or there's a mainstream community effort to keep them up to date, or they're maintained in-house with procedures to try to keep them up-to-date with new releases. At the end of the day, the API takes a string, not some protobuf or CORBA or God knows what binary serialized monster dujour...

> Yes, but it might throw errors because the client library you're using is too old and attempts to define fields that no longer exist in your newer infrastructure API.

Well. Don’t use a client library that is too old then? Like you do in any other kind of software deployment, where you update your client libraries together with the upstream API you talk to?

> just use up-to-date dependencies

Yeah, sure, I'll file that away with the NPM "tens of thousands of tiny dependencies is OK" thinking. Constant dependency upgrades is a nightmare. There's a reason why shell + Helm is popular - they're stable.

There's a difference between NPM package updates and backwards-incompatible API changes, which shouldn't really occur often. Even in the NPM ecosystem, major version updates are not a regular event. So I'll take that over templated YAML in a heartbeat.
> The only time an infra engineer would trust the types is if the vendor themself supplied them, or there's a mainstream community effort to keep them up to date

Good news! The Kubernetes project has a documented compatibility strategy (https://kubernetes.io/docs/concepts/overview/kubernetes-api/...) and publishes new client library versions for every release. There's endpoints in the API to interrogate the API's versions and supported fields/features for every resource. Additionally, most API types will accept old versions and automatically convert them to the newer versions, wherever this is possible.

> At the end of the day, the API takes a string, not some protobuf or CORBA or God knows what binary serialized monster dujour...

This is not necessarily correct. Kubernetes API supports JSON, YAML, protobuf or CBOR over the wire, and all become in-memory structs on the server.

Kubernetes is a decent example of vendor-supplied and/or mainstream community effort, but that's beside the point that (a) Kubernetes is the exception, not the rule, and (b) Helm is popular for other reasons that belie non-string wire options, like: value overlays (how would you overlay binary-serialized CBOR again?), type safety for the stringly-typed JSON/YAML passed over the wire powered by validating admission webhooks, remote-executed-on-the-cluster hooks for pre-/post- installs/upgrades/uninstalls (big help for database migrations, for example, which cannot be connected to from the machine running Helm), etc.
Everything you mentioned as a Helm feature is not in fact exclusive to Helm, and can be done either in code using the client libraries, or other deployment tools. For example I've written my own deployment tools that provide "value overlays" by simply merging the in-memory structs in Python or Go code - a manifest is just a data structure. I've also written code that can do ordered deployments with checks at multiple stages, which is both easier to do and more powerful when you write Python/Go code than trying to twist your dependencies to fit Helm's sync wave system.
Wait, but how does that help? Are text templates any better suited for creating JSON than they are for creating YAML? Trying to manipulate well-structured data as if it were syntax-free text seems downright deranged to me, regardless of the specifics of the format ...