Add option to add labels to Kubernetes nodes
Make nextcloud always go to nodes with fast storage Don't mount nextcloud on syncthing pod
This commit is contained in:
parent
11200c0ff7
commit
afa0bd023e
8 changed files with 41 additions and 9 deletions
|
@ -15,10 +15,10 @@ let
|
|||
./media.nix
|
||||
./bind9
|
||||
./dnsmasq.nix
|
||||
# ./minecraft.nix
|
||||
./blog.nix
|
||||
./atticd.nix
|
||||
# ./argo.nix
|
||||
# ./minecraft.nix
|
||||
];
|
||||
in
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# We deploy several resources that rely on "custom resource definitions".
|
||||
# We must first import these resources definitions, before deploying resources that depend on them.
|
||||
{ kubenix, nixhelm, system, ... }: {
|
||||
{ lib, kubenix, nixhelm, system, machines, ... }: {
|
||||
imports = [
|
||||
kubenix.modules.k8s
|
||||
kubenix.modules.helm
|
||||
|
@ -58,6 +58,16 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
resources.nodes =
|
||||
let
|
||||
machinesWithKubernetesLabels = lib.filterAttrs (name: machine: machine.kubernetesNodeLabels != null) machines;
|
||||
in
|
||||
builtins.mapAttrs
|
||||
(name: machine: {
|
||||
metadata.labels = machine.kubernetesNodeLabels;
|
||||
})
|
||||
machinesWithKubernetesLabels;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,6 +13,14 @@
|
|||
|
||||
spec = {
|
||||
selector.matchLabels.app = "nextcloud";
|
||||
strategy = {
|
||||
type = "RollingUpdate";
|
||||
|
||||
rollingUpdate = {
|
||||
maxSurge = 0;
|
||||
maxUnavailable = 1;
|
||||
};
|
||||
};
|
||||
|
||||
template = {
|
||||
metadata.labels.app = "nextcloud";
|
||||
|
@ -40,6 +48,15 @@
|
|||
fsGroup = 33;
|
||||
fsGroupChangePolicy = "OnRootMismatch";
|
||||
};
|
||||
|
||||
affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution = [{
|
||||
weight = 1;
|
||||
preference.matchExpressions = [{
|
||||
key = "storageType";
|
||||
operator = "In";
|
||||
values = [ "fast" ];
|
||||
}];
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
name = "config";
|
||||
mountPath = "/config";
|
||||
}
|
||||
{
|
||||
name = "nextcloud-data";
|
||||
mountPath = "/data";
|
||||
}
|
||||
{
|
||||
name = "music";
|
||||
mountPath = "/music";
|
||||
|
@ -39,7 +35,6 @@
|
|||
|
||||
volumes = {
|
||||
config.persistentVolumeClaim.claimName = "syncthing";
|
||||
nextcloud-data.persistentVolumeClaim.claimName = "nextcloud";
|
||||
music.persistentVolumeClaim.claimName = "music";
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue