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

83 commits

Author SHA1 Message Date
Antonio Gurgel
dbc9ac3501 Typo 2023-11-26 11:28:10 -08:00
Antonio Gurgel
8dd5735b73 Fix mkExistingClaim
Turns out subPath isn't a top-level attribute, as it used to be.
2023-11-26 01:19:00 -08:00
Antonio Gurgel
ff01a6dcf7 Rant about namespace pitfalls
Several charts have tripped me up by lacking a namespace and therefore
dumping their resources into my default one.
2023-11-26 00:51:49 -08:00
Antonio Gurgel
9594cf686b Deal with colons in image _tags_
intel-gpu-exporter tripped me up because it's pinned to a SHA256.
(As well it should be. I should survey the rest for this possibility.)
2023-11-26 00:42:05 -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
f1332fc3ca Fix bug: include dirs in Kustomizations again
I meant to exclude `*.yaml.drv` but ended up excluding whole dirs too.
2023-11-24 17:35:00 -08:00
Antonio Gurgel
8607d8d1b1 Add Docker registries 2023-11-23 17:57:51 -08:00
Antonio Gurgel
a2f95cb53c Add cert-manager; use intermediate cert instead of CA 2023-11-23 17:04:15 -08:00
Antonio Gurgel
94615ae400 Add Argo Workflows 2023-11-23 15:37:18 -08:00
Antonio Gurgel
e9a0357fb9 Add common PV(C)s 2023-11-23 11:14:36 -08:00
Antonio Gurgel
c53071ef67 Tidy up 2023-11-23 10:34:53 -08:00
Antonio Gurgel
733868edee Document flake-builders.namespaces better 2023-11-23 10:08:38 -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
ae070c60dc Add Istio base 2023-11-21 23:13:26 -08:00
Antonio Gurgel
be077878e7 Set default metadata for namespaces 2023-11-21 22:01:01 -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
26381130e7 I don't understand this
Line 62 of this commit's flake.nix should bail with an attribute-missing
error while evaluating `buildDerivations.releases`, at the point where
Nix tries to inherit two variables from an empty `clusterData`.

...Or is it that I will have problems when I add something using
lib.builders.helmChart to `./system`? I'll only find out tomorrow.
2023-11-21 00:28:56 -08:00
Antonio Gurgel
a9490a3686 Add polish
- Clarify nature of release paths.
- Explain why I haven't bothered to wedge values.yaml files into the
  default derivation.
- Move drv_matcher to copy_drv_output, where it conceptually belongs.
2023-11-21 00:21:23 -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
0fff85f680 Refuse to strain self on specifying kubeVersion 2023-11-20 21:42:39 -08:00
Antonio Gurgel
16365ee3e5 Refine API-gatherer 2023-11-20 21:42:16 -08:00
Antonio Gurgel
f75c9aa476 Add API-gatherer 2023-11-20 20:51:34 -08:00
Antonio Gurgel
20aa7ee6d6 Make app-template builders apiVersion-aware 2023-11-20 19:31:14 -08:00
Antonio Gurgel
2d50b59e74 Write more comments
Some of these will become part of README.md later.
2023-11-20 00:18:27 -08:00
Antonio Gurgel
528e6e7fb1 Fix logic error in mkSimpleHTTPRoute
Parent ref should use svcGateway's NS, not service's.
2023-11-19 23:51:32 -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
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
46ec341d3e Make app-template lib kebab-case
To reduce collisions with lib.eureka.appTemplate, and because
bjw-s' chart and the Nix module for it are both kebab-case.
2023-11-19 11:39:39 -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
e211b78331 Document why I didn't act on the note I wrote in bed
"Flake builder for charts could also take {fetcher, args}."

Except it shouldn't, because then I'll be peppering 98% of the modules
in `charts/` with `fetcher = lib.fetchers.helmChart`. Better to spend
a constant 100..150 chars on an extra flake-builder (fetchCharts) than
n*(30..50) chars on a refactor.
2023-11-19 11:11:22 -08:00
Antonio Gurgel
7443323ebb Last bout of refactoring before bed
- Moved external ServiceEntry generator to `lib.resources`.
- Gave it some company: a generator of HTTPRoutes for gateway/svc.
- Gave `lib.vars.svcGateway` a parentRef generator, at the cost of
  another level of recursion, and some variable renaming.
2023-11-18 23:45:45 -08:00
Antonio Gurgel
7082240db6 Simplify setNsOnObjects
`objs` is passed verbatim, so just leave it implied.
2023-11-18 23:22:31 -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
666f822bc1 Get rid of genericBuilder; use URLs in drvs of fetched charts
genericBuilder didn't make much sense to begin with.
2023-11-18 20:44:45 -08:00
Antonio Gurgel
c02685125d Move gitChart back to lib/builders
I probably took it out because I struggled with fitting it into
genericBuilder, but gitChart really does belong there.
2023-11-18 20:24:13 -08:00
Antonio Gurgel
e6ef6e90ef Factor out Istio ServiceEntries
I have a handful in my cluster, and they're all lists of HTTPS domains.
2023-11-18 20:12:17 -08:00
Antonio Gurgel
1e90084158 Run Jellyfin as nfs U/GID 2023-11-18 20:00:47 -08:00
Antonio Gurgel
4b86013c58 Simplify main image argument
I'm trying to _reduce_ boilerplate, not create it.
2023-11-18 19:22:25 -08:00
Antonio Gurgel
9d888486c1 Learn recursive updates
Turns out `//` is more destructive than I thought. With it,
I was wiping `metadata` of everything but the `namespace` key.
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
0e7b254676 Rename lib.yamlFile; make stream builder
And the module still doesn't build at this comment. Things are getting
very complicated.
2023-11-18 15:32:08 -08:00