fix(attic): securityContext improvements and conditionally switch to StatefulSet

This commit is contained in:
technofab 2024-03-10 14:53:01 +01:00
parent 7d0c2c6d11
commit ff98c7e3b5

View file

@ -3,15 +3,26 @@
lib, lib,
... ...
}: { }: {
kubernetes.resources = { kubernetes.resources = let
deployments."${values.uniqueName}" = { # switch to a StatefulSet if we don't use an external storage configuration
type =
if values.externalStorage
then "deployments"
else "statefulSets";
in {
${type}."${values.uniqueName}" = {
spec = { spec = {
replicas = values.replicaCount; replicas = values.replicaCount;
selector.matchLabels.app = "${values.uniqueName}"; selector.matchLabels.app = "${values.uniqueName}";
serviceName = "attic";
template = { template = {
metadata.labels.app = "${values.uniqueName}"; metadata.labels.app = "${values.uniqueName}";
spec = { spec = {
securityContext.fsGroup = 1000; securityContext = {
fsGroup = 1000;
runAsUser = 1000;
runAsGroup = 1000;
};
containers."api-server" = { containers."api-server" = {
image = "${values.image.repository}:${values.image.tag}"; image = "${values.image.repository}:${values.image.tag}";
imagePullPolicy = values.image.pullPolicy; imagePullPolicy = values.image.pullPolicy;