I'm working on a project that allows you to put a special "yaml shebang" at the top of any kubernetes manifest. The shebang is actually valid yaml since it's interpreted as a comment. This allows you to combine the declarative kubernetes spec (yaml) with external controller (kubectl)
after making my-app.yaml executable you can now invoke the application's config to reconcile itself
> chmod +x ./my-app.yaml
> ./my-app.yaml apply
namespace/my-namespace created
pod/my-pod created
> ./my-app.yaml get
NAME STATUS AGE
namespace/my-namespace Active 8s
NAME READY STATUS RESTARTS AGE
pod/my-pod 1/1 Running 0 7s
> ./my-app.yaml delete
namespace "my-namespace" deleted
pod "my-pod" deleted
obviously this is just a simple example but there is come really cool potential here.
To be fair, this is just how executable scripts work — it’s not a special yaml shebang, just a regular shebang for an executable that happens to take yaml files as it’s input. The underlying OS just invokes the command in the shebang and passes the file as the first parameter, exactly as it would if the shebang were for bash or python.
I never thought I would see the day when someone "discovers" the way shell scripts were intentionally designed 40 years ago. This is why perl and later python uses # for comments.
example my-app.yaml
after making my-app.yaml executable you can now invoke the application's config to reconcile itself obviously this is just a simple example but there is come really cool potential here.