2023-11-19 01:11:49 +00:00
|
|
|
{
|
2023-12-06 06:18:20 +00:00
|
|
|
builders,
|
2023-11-19 03:01:30 +00:00
|
|
|
pkgs,
|
2024-02-19 04:30:57 +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;
|
|
|
|
|
2023-12-04 05:27:33 +00:00
|
|
|
# Tag may contain ":", such as `rolling@sha256:...`. Or it may not.
|
|
|
|
# This contortion deals with both scenarios using `sublist`.
|
2023-11-26 08:39:15 +00:00
|
|
|
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,
|
2024-02-19 04:30:57 +00:00
|
|
|
chart,
|
2023-11-19 19:35:35 +00:00
|
|
|
values ? {},
|
2023-11-21 07:31:11 +00:00
|
|
|
kubeVersion ? pkgs.kubernetes.version,
|
2023-12-05 05:31:29 +00:00
|
|
|
apiVersions ? [],
|
2023-11-19 19:35:35 +00:00
|
|
|
}:
|
2023-12-06 06:18:20 +00:00
|
|
|
builders.helmChart {
|
2024-02-19 04:30:57 +00:00
|
|
|
inherit name namespace chart kubeVersion apiVersions;
|
2023-11-19 01:11:49 +00:00
|
|
|
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
|
|
|
}
|