2023-11-19 01:11:49 +00:00
|
|
|
{
|
2023-11-19 22:05:42 +00:00
|
|
|
builders,
|
2023-11-19 01:11:49 +00:00
|
|
|
charts,
|
2023-11-19 03:01:30 +00:00
|
|
|
pkgs,
|
2023-11-23 18:34:53 +00:00
|
|
|
}: rec {
|
2023-11-26 08:39:15 +00:00
|
|
|
mkImageAttrs = image:
|
2023-11-19 06:38:06 +00:00
|
|
|
with builtins; let
|
2023-11-26 08:39:15 +00:00
|
|
|
vals = pkgs.lib.strings.splitString ":" image;
|
|
|
|
|
|
|
|
# Tag may contain ":", such as `rolling@sha256:...`.
|
2023-11-26 19:28:10 +00:00
|
|
|
# Or it may not. So this contortion deals with both scenarios
|
2023-11-26 08:39:15 +00:00
|
|
|
# using `sublist`.
|
|
|
|
tag = with builtins;
|
|
|
|
concatStringsSep ":"
|
|
|
|
(filter (x: typeOf x != "list")
|
|
|
|
(pkgs.lib.lists.sublist 1 2 vals));
|
2023-11-19 06:38:06 +00:00
|
|
|
in {
|
|
|
|
repository = elemAt vals 0;
|
2023-11-26 08:39:15 +00:00
|
|
|
inherit tag;
|
2023-11-19 06:38:06 +00:00
|
|
|
};
|
|
|
|
|
2023-11-26 09:19:00 +00:00
|
|
|
mkExistingClaim = {
|
|
|
|
mountPath,
|
|
|
|
pvc,
|
|
|
|
subPath,
|
|
|
|
readOnly ? true,
|
|
|
|
}: {
|
|
|
|
enabled = true;
|
2023-11-19 06:38:06 +00:00
|
|
|
existingClaim = pvc;
|
2023-11-26 09:19:00 +00:00
|
|
|
advancedMounts.main.main = [
|
|
|
|
{
|
|
|
|
path = mountPath;
|
|
|
|
inherit readOnly subPath;
|
|
|
|
}
|
|
|
|
];
|
2023-11-19 06:38:06 +00:00
|
|
|
};
|
2023-11-19 01:11:49 +00:00
|
|
|
|
2023-11-19 06:38:06 +00:00
|
|
|
build = {
|
2023-11-19 01:11:49 +00:00
|
|
|
namespace,
|
|
|
|
name,
|
|
|
|
mainImage,
|
2023-11-19 19:35:35 +00:00
|
|
|
values ? {},
|
2023-11-21 03:30:55 +00:00
|
|
|
apiVersions ? [],
|
2023-11-21 07:31:11 +00:00
|
|
|
kubeVersion ? pkgs.kubernetes.version,
|
2023-11-19 19:35:35 +00:00
|
|
|
}:
|
2023-11-19 22:05:42 +00:00
|
|
|
builders.helmChart {
|
2023-11-21 03:30:55 +00:00
|
|
|
inherit name namespace apiVersions;
|
2023-11-19 01:11:49 +00:00
|
|
|
chart = charts.bjw-s.app-template;
|
|
|
|
values =
|
2023-11-19 03:01:30 +00:00
|
|
|
pkgs.lib.attrsets.recursiveUpdate
|
2023-11-19 19:35:35 +00:00
|
|
|
{
|
|
|
|
controllers.main.containers.main.image =
|
2023-11-23 18:34:53 +00:00
|
|
|
mkImageAttrs mainImage;
|
2023-11-19 19:35:35 +00:00
|
|
|
}
|
2023-11-19 19:46:27 +00:00
|
|
|
values;
|
2023-11-19 01:11:49 +00:00
|
|
|
};
|
2023-11-18 10:08:23 +00:00
|
|
|
}
|