1
0
Fork 0
mirror of https://git.sr.ht/~goorzhel/turboprop synced 2024-12-14 11:37:37 +00:00
Commit graph

278 commits

Author SHA1 Message Date
Antonio Gurgel
d6c9c75891 Parametrize, exhaustively document flattenTree 2024-08-10 12:45:51 -07:00
Antonio Gurgel
4956f2f769 Fix some comment typos and misphrasings 2024-08-10 12:43:30 -07:00
Antonio Gurgel
813e933d96 Move liftDefault closer to place of use 2024-08-07 20:20:48 -07:00
Antonio Gurgel
f8e2703225 s/user/userData
"user" alone is too ambiguous for a variable name.
2024-07-24 21:11:51 -07:00
Antonio Gurgel
a107476ca1 Don't set Kustomization ns if >1 of them present
Cleaner resolution for the problem mentioned last commit.
Fixes mono-namespace charts while assuming multi-namespace charts
have the diligence to set `.metadata.namespace` everywhere necessary.
2024-07-21 19:59:21 -07:00
Antonio Gurgel
961f215e50 Don't set namespaces in Kustomization
It breaks charts like Cilium, to whose resources Turboprop forcibly
assigns the namespace `kube-system` -- including resources meant
for `ns/cilium-secrets`.
2024-07-01 23:07:03 -07:00
Antonio Gurgel
71fcfe16a4 Set resource ns in Kustomization, not chart itself
This restores the derivation ancestry lost when forcing the chart
through `yamlStream`.
2024-05-21 18:55:18 -07:00
Antonio Gurgel
4dbc752a6f Stop formatting with Alejandra 2024-05-21 18:25:49 -07:00
Antonio Gurgel
daeece467f Update code examples 2024-05-21 18:14:06 -07:00
Antonio Gurgel
7ffed36d0b Use AT2 in template
Otherwise the template will be broken out of the box, as AT3 is
impossible to build without network access:
https://github.com/farcaller/nixhelm/issues/18
2024-05-21 17:58:01 -07:00
Antonio Gurgel
f5b5c9a57b Lift default.nixes in template 2024-05-21 17:58:01 -07:00
Antonio Gurgel
109d6debf8 Don't assume service modules are default.nix
Otherwise turboprop will think the namespace and name are, e.g.,
"2-main" and "default" (instead of "default" and "breezewiki").
2024-05-21 17:57:57 -07:00
Antonio Gurgel
f8d8120e40 Support extraOpts in lib.app-template.build 2024-04-09 21:36:33 -07:00
Antonio Gurgel
b90ffcace4 Use nixhelm as input; rework AT and lib interface
In 0fb8e4d I forgot that flake input-following exists. I don't _have_ to
ship nixhelm myself, but I do need to include it so I can stop bundling
data for an oudated AT version.

In fact, I need not bundle _anything_ for the AT library to be useful;
it's better to make the builder's `chart` arg mandatory and let the user
supply their own (usually taken from nixhelm). If they get bored of
supplying the chart to every AT instance they can factor it out,
as I have in my own deployment.

In fact, my deployment relies on the AT library, which I used to provide
as a flake output -- but it didn't make sense to have one version of the
turboprop library available inside service definitions and another
available outside. So I've made the whole library a flake output.
This may bite me in the future.
2024-02-18 20:56:48 -08:00
Antonio Gurgel
ac32bb76ca Build top-level kustomization
I broke the `k diff -k result` premise in fdb3f5b and never noticed.
2024-02-17 12:16:38 -08:00
Antonio Gurgel
e21a3f037f Give into recursion 2024-02-17 01:23:07 -08:00
Antonio Gurgel
7a65452d54 Remember ${var} exists 2024-02-17 01:23:07 -08:00
Antonio Gurgel
1b7efaabde Fix typos 2024-02-17 01:22:57 -08:00
Antonio Gurgel
104cc71f0e Parametrize app-template chart
I was unwisely locking downstream flakes into a specific version of AT.
2024-02-17 01:22:57 -08:00
Antonio Gurgel
4764e1a452 Fix bug from switching to gatherNamespaces
namespaceFromDir needs to exist as a backstop in an obscure case:
a service built with lib.builders.derivation consisting entirely of CRDs
whose output will register nothing in `lib.gatherNamespaces`.

I refer, of course, to the Gateway API and `ns/gateway-system`.
2024-02-17 01:22:29 -08:00
Antonio Gurgel
b215d1ca5d Update kubelib
https://github.com/farcaller/nix-kube-generators/pull/9
2024-02-17 01:22:29 -08:00
Antonio Gurgel
948e4aaf8a Clean up comments 2024-02-17 01:22:29 -08:00
Antonio Gurgel
3923fc5494 gitignore README.html 2023-12-09 14:06:43 -08:00
Antonio Gurgel
254bab7ceb Fix README 2023-12-07 20:04:27 -08:00
Antonio Gurgel
27b06c5798 Implement lib.gatherNamespaces
The documentation for pkgs.lib.lists.unique warned me that the function
is O(n^2). So I conducted some rather unscientific tests using my own
Kubernetes flake and found no noticeable time penalty:
`rm result && nix-collect-garbage -d && nix build` always took
between 37 and 40 seconds, with or without gatherNamespaces.
But, well, n=10.

Also, make more obvious the flaw in mk.namespaces.
If I prefix something with "N.B." it shouldn't be hidden in the code.
2023-12-07 00:03:08 -08:00
Antonio Gurgel
5676e155cd Re-export app-template
I forgot that all of `./lib/` is hidden.
2023-12-06 23:09:27 -08:00
Antonio Gurgel
7720b14cb9 Just keep liftDefault in mkCharts
Nixhelm already established that charts are Nix modules shaped like
`dir/default.nix`. Bucking that convention would take effort.
2023-12-06 22:59:39 -08:00
Antonio Gurgel
96ab10c070 Document flattenTree better 2023-12-06 22:59:39 -08:00
Antonio Gurgel
0fb8e4d18b Don't ship nixhelm with Turboprop
Nixhelm updates daily. Why would I ship that with my flake?
This is one area where the user really must BYOB.
2023-12-06 22:59:39 -08:00
Antonio Gurgel
c33d080f5d Complete all README TODOs 2023-12-06 21:45:34 -08:00
Antonio Gurgel
9cd7d34ac5 Use pandoc instead 2023-12-06 20:51:52 -08:00
Antonio Gurgel
34c0199981 Fix reST and docutils mistakes 2023-12-06 20:23:21 -08:00
Antonio Gurgel
f97f738559 Build README automatically 2023-12-06 20:09:51 -08:00
Antonio Gurgel
d5eb89445b Leave some TODOs for tomorrow
It appears that I'm nearly finished with this README.

It's been a very productive session tonight: I fixed a lot of
indefensible architectural choices, simply by tasking myself with
explaining my own code. An invisible rubber duck, if you will.

Sourcehut supports only plaintext and Markdown for READMEs, but I'm
writing reStructuredText for the first time because I figured all
the hyperlinks would make the text nearly impossible to read.

I can publish the README using a build.sr.ht job, `docutils`, and `hut`:
https://git.xenrox.net/~xenrox/custom-readme/tree/1c4ffcd5/item/.build.yml
2023-12-06 00:00:56 -08:00
Antonio Gurgel
a4ace6bfc4 Add nsMetadata example to template 2023-12-06 00:00:36 -08:00
Antonio Gurgel
a6ab0c6960 Allow fetchers to be used as builders
Another interface oddity cut down. I shouldn't have to make
two derivations (lib.builders.derivation) for one file.
2023-12-06 00:00:05 -08:00
Antonio Gurgel
2e742a7f9b Export templates outside eachDefaultSystem 2023-12-05 23:30:54 -08:00
Antonio Gurgel
71837dd81b Document mkCharts*; receive nixhelm for mkCWNH
Easier than telling users to input nixhelm into their own flakes
and set `inputs.turboprop.inputs.nixhelm.follows`.
2023-12-05 23:25:35 -08:00
Antonio Gurgel
44cb55820a Better illustrate API ordering failure 2023-12-05 23:06:34 -08:00
Antonio Gurgel
f3f44c18ea Pass name and namespaces into modules
module.args still needs them for the builder, but I can finally put to
rest the doubts I had about writing things like `name = "breezewiki";`
in a module into which I could damn well pass that variable.
2023-12-05 22:46:47 -08:00
Antonio Gurgel
9e7bac64c8 Move app-template back to lib
This interface was getting ridiculous.

`app-template` gets released infrequently enough that keeping a static
`chart.nix` is a small tradeoff for the previous lunacy of passing a
whole derivation tree in through the flake.
2023-12-05 22:46:47 -08:00
Antonio Gurgel
805b8a1b74 Pare down example flake; document mkDerivation
`mkDerivation` doesn't have to be assigned beforehand; it can just be
passed two attrsets. I only realized this after writing out its
signature in the documentation.

Also, the example flake in the documentation doesn't use nixpkgs,
so I removed it.
2023-12-05 22:03:23 -08:00
Antonio Gurgel
2a49818159 Add quick-start section to README; tweak sentences 2023-12-05 21:35:54 -08:00
Antonio Gurgel
a942a8690b Explain service ordering; fix template accordingly 2023-12-04 23:15:38 -08:00
Antonio Gurgel
a32b24c69a Lift only modules named default
Otherwise `services/default` obliterates everything at its level.
2023-12-04 22:57:52 -08:00
Antonio Gurgel
b59c8670d2 Fix mk.namespaces bug: allow DEFAULT to be unset 2023-12-04 22:57:52 -08:00
Antonio Gurgel
a052d499df Continue writing README; add template 2023-12-04 22:57:52 -08:00
Antonio Gurgel
34e00f2b30 Fix bug in app-template.build
It was never passing `kubeVersion` on to the builder.
2023-12-04 21:31:29 -08:00
Antonio Gurgel
d9ab890072 Format
I need a pre-commit hook...
2023-12-04 19:39:28 -08:00
Antonio Gurgel
1d8bee8fe3 Clean up mk.namespaces 2023-12-04 19:37:57 -08:00