mirror of
https://git.sr.ht/~goorzhel/turboprop
synced 2024-12-14 11:37:37 +00:00
Move services/longhorn-system to extraObjects
It doesn't make sense to separate extraObjects; the `apiVersions` argument doesn't affect them.
This commit is contained in:
parent
8a6a781575
commit
5fc62f2d1b
2 changed files with 62 additions and 65 deletions
|
@ -1,65 +0,0 @@
|
|||
{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;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
|
@ -8,4 +8,66 @@
|
|||
chart = charts.longhorn.longhorn;
|
||||
values.lognhornUI.replicas = 1;
|
||||
};
|
||||
extraObjects = [
|
||||
(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;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue