mirror of
https://git.sr.ht/~goorzhel/turboprop
synced 2024-12-14 11:37:37 +00:00
Add Longhorn
This commit is contained in:
parent
5d7691e427
commit
dbb65668ee
4 changed files with 84 additions and 1 deletions
6
charts/longhorn/longhorn/default.nix
Normal file
6
charts/longhorn/longhorn/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
repo = "https://charts.longhorn.io";
|
||||
chart = "longhorn";
|
||||
version = "1.5.3";
|
||||
chartHash = "sha256-IZ++Gzvjjp9EkDdFh4/eSQWm4zeJX6s7XA79krZ3dLI=";
|
||||
}
|
|
@ -30,7 +30,8 @@
|
|||
in
|
||||
{
|
||||
# Releases expected to provide custom APIs (e.g.: Gateway API,
|
||||
# Istio, Longhorn) go in `./system`. All others in `./releases`.
|
||||
# Istio, Longhorn) go in `./system`. All others in `./releases`,
|
||||
# including resources for the former dependent on other APIs.
|
||||
# This prevents infinite recursion when gathering APIs.
|
||||
systemReleaseData = rake.leaves ./system;
|
||||
releaseData = rake.leaves ./releases;
|
||||
|
|
65
releases/longhorn-system/longhorn/default.nix
Normal file
65
releases/longhorn-system/longhorn/default.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{lib, ...}: {
|
||||
builder = lib.builders.yamlStream;
|
||||
args.objs = [
|
||||
(lib.eureka.resources.mkSvcHTTPRoute "longhorn" "longhorn-frontend" 80)
|
||||
{
|
||||
apiVersion = "v1";
|
||||
kind = "ConfigMap";
|
||||
metadata.name = "longhorn-custom-path";
|
||||
data.PATH =
|
||||
builtins.concatStringsSep ":"
|
||||
[
|
||||
"/usr/local/sbin"
|
||||
"/usr/local/bin"
|
||||
"/usr/sbin"
|
||||
"/usr/bin"
|
||||
"/sbin"
|
||||
"/bin"
|
||||
"/run/wrappers/bin"
|
||||
"/nix/var/nix/profiles/default/bin"
|
||||
"/run/current-system/sw/bin"
|
||||
];
|
||||
}
|
||||
{
|
||||
apiVersion = "kyverno.io/v1";
|
||||
kind = "ClusterPolicy";
|
||||
metadata = {
|
||||
name = "add-host-path-to-longhorn";
|
||||
annotations = {
|
||||
"policies.kyverno.io/title" = "Add environment variables from ConfigMap";
|
||||
"policies.kyverno.io/subject" = "Pod";
|
||||
"policies.kyverno.io/category" = "Other";
|
||||
"policies.kyverno.io/description" = ''
|
||||
Longhorn invokes executables on the host system, and needs to be
|
||||
aware of the host system's PATH. This policy inserts NixOS paths
|
||||
into Longhorn pods.
|
||||
'';
|
||||
};
|
||||
};
|
||||
spec = {
|
||||
rules = [
|
||||
{
|
||||
name = "add-env-vars";
|
||||
match.resources = {
|
||||
kinds = ["Pod"];
|
||||
namespaces = ["longhorn-system"];
|
||||
};
|
||||
mutate.patchStrategicMerge = let
|
||||
refToInsert = [
|
||||
{
|
||||
"(name)" = "*";
|
||||
envFrom = [{configMapRef.name = "longhorn-custom-path";}];
|
||||
}
|
||||
];
|
||||
in {
|
||||
spec = {
|
||||
initContainers = refToInsert;
|
||||
containers = refToInsert;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
11
system/longhorn-system/longhorn/default.nix
Normal file
11
system/longhorn-system/longhorn/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
charts,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
builder = lib.builders.helmChart;
|
||||
args = {
|
||||
chart = charts.longhorn.longhorn;
|
||||
values.lognhornUI.replicas = 1;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue