diff --git a/templates/k8s/statefulset.libsonnet b/templates/k8s/statefulset.libsonnet index 47711ccb5..f003ac055 100644 --- a/templates/k8s/statefulset.libsonnet +++ b/templates/k8s/statefulset.libsonnet @@ -113,15 +113,14 @@ local Kube = import "kube.libsonnet"; name: "gerrit-ssh-keys", readOnly: true, } - ] - + if std.objectHas(config, "gerrit") then [ + ] + (if std.objectHas(config, "gerrit") then [ { mountPath: "/run/secrets/jenkins/ssh-" + gerrit.site, name: std.strReplace(gerrit.site, '.', '-') + "-ssh-keys", readOnly: true, - } + } for gerrit in config.gerrit - ] else [], + ]) else [], env: [ { name: "JAVA_OPTS", @@ -222,8 +221,8 @@ local Kube = import "kube.libsonnet"; secretName: "gerrit-ssh-keys", }, } - ] - + if std.objectHas(config, "gerrit") then [ + ] + + (if std.objectHas(config, "gerrit") then [ { name: std.strReplace(gerrit.site, '.', '-') + "-ssh-keys", secret: { @@ -231,7 +230,7 @@ local Kube = import "kube.libsonnet"; }, } for gerrit in config.gerrit - ] else [], + ]) else [], }, }, volumeClaimTemplates: [