mirror of
https://github.com/Noratrieb/config-language.git
synced 2026-01-16 01:25:03 +01:00
stuff
This commit is contained in:
commit
bce268cceb
13 changed files with 672 additions and 0 deletions
45
example-configs/kubernetes/deployment-dry.nix
Normal file
45
example-configs/kubernetes/deployment-dry.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
let
|
||||
trivialWebService = { name, selectorLabel, port, extraPodLabels ? { } }:
|
||||
[
|
||||
{
|
||||
apiVersion = "apps/v1";
|
||||
kind = "Deployment";
|
||||
metadata = {
|
||||
inherit name;
|
||||
};
|
||||
spec = {
|
||||
selector.matchLabels = selectorLabel;
|
||||
replicas = 2;
|
||||
template = {
|
||||
metadata.labels = selectorLabel // extraPodLabels;
|
||||
spec.containters = [
|
||||
{
|
||||
inherit name;
|
||||
image = "nginx";
|
||||
ports = [{ containerPort = port; }];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
{
|
||||
apiVersion = "apps/v1";
|
||||
kind = "Service";
|
||||
metadata = {
|
||||
inherit name;
|
||||
labels = selectorLabel;
|
||||
};
|
||||
spec = {
|
||||
ports = { port = 80; protocol = "TCP"; };
|
||||
selector = selectorLabel;
|
||||
};
|
||||
}
|
||||
]
|
||||
;
|
||||
in
|
||||
trivialWebService {
|
||||
name = "my-nginx";
|
||||
selectorLabel = { run = "my-nginx"; };
|
||||
port = 80;
|
||||
extraPodLabels = { someOther = "label"; };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue