1
0
Fork 0
mirror of https://git.sr.ht/~goorzhel/turboprop synced 2024-12-15 17:50:52 +00:00
Commit graph

70 commits

Author SHA1 Message Date
Antonio Gurgel
84b62768b4 Add flake-builder input for user data
I stowed my particularities in lib.eureka, but exporting
`packages.*.flakeBuilders` with a pre-pressed `lib` left no way to put
the Eureka module back in. After further consideration, I decided
it's wise to keep `lib`	that way instead of commingling it with
homelab data.
2023-11-27 00:13:06 -08:00
Antonio Gurgel
e3b6f47d1e Export built charts as well 2023-11-27 00:01:47 -08:00
Antonio Gurgel
bc64f70610 Remove everything specific to my cluster 2023-11-26 23:41:14 -08:00
Antonio Gurgel
ffc18857a5 Export lib.rake 2023-11-26 22:38:11 -08:00
Antonio Gurgel
c4bb826b2a Rename project to turboprop
Getting away from manually pressing Helm charts (while, importantly, retaining
integrity checking and determinism) is something I liken to the
transition from sail to flight as the primary mode of intercontinental
travel. As it were, ditching the helm for a yoke.
2023-11-26 22:23:18 -08:00
Antonio Gurgel
0529bdf6a2 Update my charts; yoke others to nixhelm
By overlaying nixhelm's charts with those I use for myself, be they
behind nixhelm's or simply absent, I get the best of both worlds.
2023-11-25 00:33:44 -08:00
Antonio Gurgel
1444cb9b18 s/release/service/g
"Helm releases" is what I'd been terming individual services, but
it makes no sense outside of the internal context of the Helm builder.

I also didn't want to call them "apps", however shorter that term is.
These are not apps.
2023-11-24 17:35:15 -08:00
Antonio Gurgel
dbb65668ee Add Longhorn 2023-11-24 12:27:52 -08:00
Antonio Gurgel
c53071ef67 Tidy up 2023-11-23 10:34:53 -08:00
Antonio Gurgel
61c040df2c Revert silly name for import flake-builders
Also, clean out unused variables.
2023-11-23 10:22:34 -08:00
Antonio Gurgel
ef94817a55 Stop relying on ns/name in derivation path
I've changed release modules' signatures from:
`{lib} -> ... -> <drv>`
to:
`{lib} -> ... -> {out=<drv>; extra=<drv>;}`
Which makes individual derivations more easily findable.

Now, instead of picking them out from a soup of paths in `output.sh`
with a specially-crafted needle (`${ns}-${name}`), I map derivations
directly to paths and use the result as a sort of index. In other words,
I spent some ingenuity in `flake-builders.sh` to save a _lot_ of
ingenuity in `output.sh`.

This affords me the extra convenience, previously spurned because of
the very limitation I've overcome, of symlinking derivations in the
output flake.
2023-11-23 10:07:19 -08:00
Antonio Gurgel
e8016e5bc5 Reflow comments
I try to insert line breaks where a thought fragment ends (a habit
learnt from writing subtitles), but in comments and Git commit
messages it doesn't make as much sense.
2023-11-22 17:54:27 -08:00
Antonio Gurgel
05a3f2bef0 Build extras from system releases too 2023-11-21 23:19:46 -08:00
Antonio Gurgel
6aff849da7 Add kyverno
I have my answer to 2638113, and it's what I was suspecting: the
flake-builder was never using clusterData until I added a release
that needs it, at which point I got the dreaded "error: attribute
'apiVersions' missing".

Remediation was simple: realize the wrongheadedness of passing
an empty attrset when the values are already well-known.
2023-11-21 20:58:13 -08:00
Antonio Gurgel
dc3060aa30 Pass charts into releases, and restore variadity
It doesn't pay to be strict about release module arity.
2023-11-21 20:46:32 -08:00
Antonio Gurgel
1a44fbafd5 Refactor output script to deal with both trees 2023-11-20 23:49:01 -08:00
Antonio Gurgel
b4deb0b258 Implement clusterData
kubelib.buildHelmChart can take the target Kubernetes version and
a list of custom APIs, so I'll bind them both up in an attrset
and pass them to `flake-builder.releases`.

Accordingly, the other release-builders will have to become variadic.
2023-11-20 23:31:11 -08:00
Antonio Gurgel
aa1ec7d842 Don't do readFile twice
Also, I had a brief temptation to move `gatherApis` to `flake-builders`,
but apart from being used in the flake's let-in, it has little in common
with the other builders. I need to lose a direct dependency on kubelib
to try the concept out, though (`flake-builders` doesn't take `kubelib`),
and I ended up keeping the result.
2023-11-20 23:02:54 -08:00
Antonio Gurgel
3e7a376329 Start messy refactor
Release trees are now split into API-producing and API-using ones.
Namespace rake must now take a list of roots of release trees.
2023-11-20 22:46:06 -08:00
Antonio Gurgel
5ec509e3b6 Add packages.*.lib as output (useful for debugging) 2023-11-20 21:52:23 -08:00
Antonio Gurgel
3b5168fdc0 Identify another messy refactor on the horizon
Packages can either output new APIs or expect them in the cluster.

Examples of packages which
- output APIs: Gateway API, which installs various versions of
  gateway.networking.k8s.io resources.
- take APIs as input: app-template, which queries the cluster to
  choose v1a2, v1b1, or v1 for its HTTPRoute (etc.) objects.

("Packages" here collectively refers to Helm charts and YAML bundles.)

I will have to impose strict ordering on them, i.e., build the former
before the latter.
2023-11-20 21:46:44 -08:00
Antonio Gurgel
e5ff9ec805 Factor out pname from main derivation 2023-11-19 14:24:35 -08:00
Antonio Gurgel
708e537c7c Remove verbs from lib.{build,fetch}ers.*
Reading things like `lib.builders.buildHelmChart` got exhausting.
2023-11-19 14:24:24 -08:00
Antonio Gurgel
d0f61ec7de Add Makefile and helper for decrypting SOPS secrets 2023-11-19 13:44:34 -08:00
Antonio Gurgel
33433a953e Build namespaces
I initially thought this would be just another release in
`releases/common/namespaces`, but there's a lot more potential
than that.
2023-11-19 13:21:41 -08:00
Antonio Gurgel
6e09298a02 Tidy up 2023-11-19 11:46:27 -08:00
Antonio Gurgel
408befb503 Decouple homelab idiosyncrasies
My long-term vision for this flake is to use it as a control flake:
plug it into your homelab ("data-plane") flake and avail yourself
of its `lib.builders`, et cetera.

In short, I want this flake to be useful to many people, and that
means not shipping my homelab with it.
2023-11-19 11:35:35 -08:00
Antonio Gurgel
a74676d5f8 Factor out derivation-collecting 2023-11-18 23:22:51 -08:00
Antonio Gurgel
2c213d6222 Factor out (and document exhaustively) flake-builders 2023-11-18 23:13:11 -08:00
Antonio Gurgel
f62420754a Lower all of lib's imports into named attrs
The namespace was getting a bit crowded.
2023-11-18 22:38:17 -08:00
Antonio Gurgel
18b3cbfe84 Remove kubelib as release input; rm buildYAMLStream synonym
Everything I need directly from nix-kube-generators is now
handled in `lib/`. Additionally, now that I know buildYAMLStream always
takes a namespace and name, there's no need for the longer-winded name.
2023-11-18 22:21:08 -08:00
Antonio Gurgel
367851267f Split fetchers and builders; create NamespacedYAML builder
The reason I struggled with genericBuilders, and again when I replaced
`remoteYAML`'s NS-name `pname` with `url`, is that I was confusing the
following two things:
1. Things that fetch a resource (a Helm chart, a YAML stream, etc.)
without naming or namespacing it.
2. Things that create a release _by_ giving it a name and namespace
so that lib/output.sh can sort the resultant files into directories.

Additionally, I was questioning the good sense of releases/svc/gateway:
a release with no release, but only extra objects? Turns out I
needlessly bound the concept of JIT namespace injection to that
`extraObjects` feature. Once I abstracted that builder, the more general
solution became clear.
2023-11-18 22:01:43 -08:00
Antonio Gurgel
b97c0cd007 Don't use dir name in .#packages.*.default
https://nix.dev/guides/best-practices#reproducible-source-paths
2023-11-18 19:22:25 -08:00
Antonio Gurgel
8d355af50d Convert releases/svc/gateway to extraObjects
Now that I have the auto-namespace thing I can skip passing `namespace`
into this module too.
2023-11-18 19:22:25 -08:00
Antonio Gurgel
b51bcafdaf Implement attaching extra k8s objects to releases
No more tossing YAMLs into release dirs. All is Nix.
2023-11-18 19:22:25 -08:00
Antonio Gurgel
11a3fcb002 Refactor modules
By declaring builders at the module level, only to call them in
flake.nix, I give myself the opportunity to inject `{name, namespace}`
there and need no longer pass these args into every module myself.
2023-11-18 19:22:25 -08:00
Antonio Gurgel
05604660ea Factor out app-template HTTPRoutes 2023-11-18 02:09:30 -08:00
Antonio Gurgel
f5b9d92e0f Devise way to retrieve Helm values as YAML
Even though I've refactored the values into Nix, I'd like them easily
available as YAML. This is impossible to do inside the flake, because
it requires `nix derivation show`, so I made do with a helper script.
2023-11-18 00:52:31 -08:00
Antonio Gurgel
8a53be1d9f Have devshell follow root nixpkgs; update deps 2023-11-17 23:22:32 -08:00
Antonio Gurgel
1ab0281d9d Build top- and namespace-level Kustomizations
For `kubectl apply -k result`.
2023-11-17 23:09:06 -08:00
Antonio Gurgel
430b576766 Withdraw releases from output
I only needed it for debugging before I finished the default output.
Charts are still available for anyone using this flake as an input.
2023-11-16 22:11:43 -08:00
Antonio Gurgel
afb5aeea36 Truck in dev niceties from previous k8s repo 2023-11-16 21:29:59 -08:00
Antonio Gurgel
7d912d6ba4 Add Kustomizations for each release in output 2023-11-16 20:34:15 -08:00
Antonio Gurgel
1ade63a493 Pull packages.*.default's installPhase out into lib/ 2023-11-16 20:11:09 -08:00
Antonio Gurgel
60cab327ed Finally build the envisioned output 2023-11-16 19:50:44 -08:00
Antonio Gurgel
a90896c0b9 Finally build the whole flake 2023-11-16 18:16:27 -08:00
Antonio Gurgel
46b20e720d Fumble more with gathering releases for .#default 2023-11-15 18:36:31 -08:00
Antonio Gurgel
1826882c13 Factor out values-gathering 2023-11-15 18:34:32 -08:00
Antonio Gurgel
59116a7f13 Flail at creating default output
I envision the derivation output to be a directory with nested namespace
directories with each release as a single YAML inside.

But I'm currently stuck at the `nix build` part.
2023-11-15 17:36:29 -08:00
Antonio Gurgel
bef2c80e9f Make release tree itself an output
I was puzzling over how to cobble all these derivations into one
mega-derivation, but I might not have to.
2023-11-15 16:44:34 -08:00