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,
...
}: {
kubernetes.resources = {
deployments."${values.uniqueName}" = {
kubernetes.resources = let
# 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 = {
replicas = values.replicaCount;
selector.matchLabels.app = "${values.uniqueName}";
serviceName = "attic";
template = {
metadata.labels.app = "${values.uniqueName}";
spec = {
securityContext.fsGroup = 1000;
securityContext = {
fsGroup = 1000;
runAsUser = 1000;
runAsGroup = 1000;
};
containers."api-server" = {
image = "${values.image.repository}:${values.image.tag}";
imagePullPolicy = values.image.pullPolicy;