Skip to content

Commit 975988b

Browse files
committed
search the podspec for storepaths and add them to the volume
1 parent 020fb60 commit 975988b

3 files changed

Lines changed: 210 additions & 68 deletions

File tree

kubenix/ci/default.nix

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
pkgs,
44
lib,
55
mkNCSI,
6+
subPath,
67
inputs,
78
...
89
}:
@@ -120,6 +121,73 @@ in
120121
};
121122
};
122123
};
124+
Job.commandpath-hello = mkNCSI {
125+
spec = {
126+
template = {
127+
spec = {
128+
restartPolicy = "Never";
129+
containers = lib.recursiveUpdate containers {
130+
hello.command = [ (lib.getExe pkgs.hello) ];
131+
};
132+
volumes = lib.mkNamedList {
133+
nix-csi.csi = {
134+
driver = "nix.csi.store";
135+
readOnly = true;
136+
};
137+
};
138+
};
139+
};
140+
};
141+
};
142+
Job.env-ssl = mkNCSI {
143+
spec = {
144+
template = {
145+
spec = {
146+
restartPolicy = "Never";
147+
containers = lib.recursiveUpdate containers {
148+
hello = {
149+
command = [
150+
(lib.getExe (
151+
pkgs.writeShellApplication {
152+
name = "printer";
153+
runtimeInputs = [
154+
pkgs.coreutils
155+
pkgs.hello
156+
];
157+
text = # bash
158+
''
159+
set -x
160+
hello
161+
ls -lah /etc/ssl/certs
162+
'';
163+
}
164+
))
165+
];
166+
volumeMounts =
167+
let
168+
mkMount =
169+
package: mountPath:
170+
{
171+
mountPath = mountPath;
172+
subPath = subPath "${package}${mountPath}";
173+
readOnly = true;
174+
};
175+
in
176+
{
177+
nix-csi = mkMount pkgs.cacert "/etc/ssl/certs";
178+
};
179+
};
180+
};
181+
volumes = lib.mkNamedList {
182+
nix-csi.csi = {
183+
driver = "nix.csi.store";
184+
readOnly = true;
185+
};
186+
};
187+
};
188+
};
189+
};
190+
};
123191
};
124192
};
125193
}

kubenix/options.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ in
179179
lib.recursiveUpdate {
180180
inherit (cfg) metadata;
181181
} attrs;
182-
subPath = spath: lib.removePrefix "/" toString spath;
182+
subPath = spath: lib.removePrefix "/" (toString spath);
183183
};
184184

185185
nix-csi = { };

0 commit comments

Comments
 (0)