News for hackers. Stuff that matters.
Re:Do not do in code what can be done in infrastructure (2017) by ehnto on Friday August 13, 2021 @10:02AM (#28168950)
Infrastructure is so often arbitrary and opaque configuration hell where no amount of sense can be made of the sprawling orchestration just by looking at it. It's also third party and out of your full control. Where code can often be a lot more transparent and readable, and it is yours to own faults and all. If you can code and specifically solving the problem is within scope and capability I think you should solve it in code.

But I would think that as my only experience with infrastructure is when it fails and I have to fix it.

Re:Do not do in code what can be done in infrastructure (2017) by athorax on Friday August 13, 2021 @11:53AM (#28170544)
I feel this. If you ARE going to solve your problem with infrastructure, then get ready to descend into the madness of infrastructure-as-code. One way or the other, you are going to end up having to codify it.
Re:Do not do in code what can be done in infrastructure (2017) by debarshri on Friday August 13, 2021 @10:30AM (#28169310)
Exactly. It is basically delegating problem from one place to another thing which is quite opaque and hard to debug.

But again, it depends upon whom you ask. An infrastructure engineer or ops guys are more comfortable with infrastructure scaling your app whereas a developer is more comfortable with application scaling itself.

Re:Do not do in code what can be done in infrastructure (2017) by tootie on Friday August 13, 2021 @01:08PM (#28171618)
I'm sitting here trying to make sense of how nginx parses regexes and I feel this in my bones. Any critical function buried in infrastructure is going to be inherently so much harder to debug and test in a predictable way. I lean towards putting as much as possible into application code and keeping infra as simple as possible.
Re:Do not do in code what can be done in infrastructure (2017) by robertlagrant on Friday August 13, 2021 @03:29PM (#28173433)
I agree. I think k8s virtualizing ingress, networking, monitoring, restarting, logging is brilliant; I just wish I could write code to make it happen instead of reams of YAML.
Re:Do not do in code what can be done in infrastructure (2017) by p_l on Sunday August 15, 2021 @02:03PM (#28190831)
Remember that kubernetes doesn't actually use YAML anywhere - it just makes it available as convenience, and you can just as well call the API manually or use one of the client libraries.
Re:Do not do in code what can be done in infrastructure (2017) by javagram on Friday August 13, 2021 @06:56PM (#28175843)
Generating the yaml-equivalent config files using Jsonnet can help with this, I rarely see it mentioned online though.
Re:Do not do in code what can be done in infrastructure (2017) by philipov on Friday August 13, 2021 @01:27PM (#28171833)
Infrastructure is global state, and global state is the enemy
Re:Do not do in code what can be done in infrastructure (2017) by tuldia on Friday August 13, 2021 @04:37PM (#28174198)
Infrastructure are like roads, if you have to change infrastructure every time a new car model comes out then you are doing it wrong.

Global state is global state.

The enemy is your own mind.

Re:Do not do in code what can be done in infrastructure (2017) by philipov on Friday August 13, 2021 @05:29PM (#28174791)
If you are using your roads to do gps pathfinding, then you are indeed doing it wrong. Do not do in infrastructure what can be done in code. You can't version control your infrastructure, but you can version control your code.

And with cloud instances and VMs providing abstractions that don't map 1:1 to the hardware they're running on, all your infrastructure becomes code to create reproducible deployments, or serverless execution.

You don't build your roads immediately before you start driving, and destroy them after you're done, and build only as many miles of road as you need each time you go for a ride. They're not a great analogy to what we do with computers.

Re:Do not do in code what can be done in infrastructure (2017) by TimTheTinker on Saturday August 14, 2021 @12:08PM (#28181738)
> Do not do in infrastructure what can be done in code.

While I agree, I just wanted to point out that Terraform allows defining infrastructure as code.

Re:Do not do in code what can be done in infrastructure (2017) by kazen44 on Friday August 13, 2021 @02:13PM (#28172338)
in a sense, the entire internet is one massive state machine (on the routing level anyway).