From 279824e1f18c15d95f6897ee377c736e3ebbcec4 Mon Sep 17 00:00:00 2001 From: pi3ch Date: Sat, 10 Sep 2022 09:10:21 +0800 Subject: [PATCH 1/2] Support for SSH log level --- templates/gitea/statefulset.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/gitea/statefulset.yaml b/templates/gitea/statefulset.yaml index ed9a887..994aafa 100644 --- a/templates/gitea/statefulset.yaml +++ b/templates/gitea/statefulset.yaml @@ -209,6 +209,8 @@ spec: value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }} - name: SSH_PORT value: {{ .Values.gitea.config.server.SSH_PORT | quote }} + - name: SSH_LOG_LEVEL + value: {{ .Values.gitea.config.server.SSH_LOG_LEVEL | quote }} - name: GITEA_APP_INI value: /data/gitea/conf/app.ini - name: GITEA_CUSTOM -- 2.40.1 From c0fd66bdd7bad2cb958399e3f39c295334da680e Mon Sep 17 00:00:00 2001 From: justusbunsi Date: Tue, 7 Mar 2023 17:01:56 +0100 Subject: [PATCH 2/2] Move SSH_LOG_LEVEL to ssh related object Signed-off-by: justusbunsi --- README.md | 1 + templates/gitea/statefulset.yaml | 4 +- unittests/statefulset/ssh-configuration.yaml | 40 ++++++++++++++++++++ values.yaml | 4 ++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 unittests/statefulset/ssh-configuration.yaml diff --git a/README.md b/README.md index bb64eb6..b740cb2 100644 --- a/README.md +++ b/README.md @@ -718,6 +718,7 @@ gitea: | `gitea.additionalConfigSources` | Additional configuration from secret or configmap | `[]` | | `gitea.additionalConfigFromEnvs` | Additional configuration sources from environment variables | `[]` | | `gitea.podAnnotations` | Annotations for the Gitea pod | `{}` | +| `gitea.ssh.logLevel` | Configure OpenSSH's log level. Only available for root-based Gitea image. | `INFO` | ### LivenessProbe diff --git a/templates/gitea/statefulset.yaml b/templates/gitea/statefulset.yaml index 25a77ee..6394e9a 100644 --- a/templates/gitea/statefulset.yaml +++ b/templates/gitea/statefulset.yaml @@ -243,8 +243,10 @@ spec: value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }} - name: SSH_PORT value: {{ .Values.gitea.config.server.SSH_PORT | quote }} + {{- if not .Values.image.rootless }} - name: SSH_LOG_LEVEL - value: {{ .Values.gitea.config.server.SSH_LOG_LEVEL | quote }} + value: {{ .Values.gitea.ssh.logLevel | quote }} + {{- end }} - name: GITEA_APP_INI value: /data/gitea/conf/app.ini - name: GITEA_CUSTOM diff --git a/unittests/statefulset/ssh-configuration.yaml b/unittests/statefulset/ssh-configuration.yaml new file mode 100644 index 0000000..24ffc3a --- /dev/null +++ b/unittests/statefulset/ssh-configuration.yaml @@ -0,0 +1,40 @@ +suite: Statefulset template (SSH configuration) +release: + name: gitea-unittests + namespace: testing +templates: + - templates/gitea/statefulset.yaml + - templates/gitea/config.yaml +tests: + - it: supports defining SSH log level for root based image + template: templates/gitea/statefulset.yaml + set: + image.rootless: false + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: SSH_LOG_LEVEL + value: "INFO" + - it: supports overriding SSH log level + template: templates/gitea/statefulset.yaml + set: + image.rootless: false + gitea.ssh.logLevel: "DEBUG" + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: SSH_LOG_LEVEL + value: "DEBUG" + - it: skips SSH_LOG_LEVEL for rootless image + template: templates/gitea/statefulset.yaml + set: + image.rootless: true + gitea.ssh.logLevel: "DEBUG" # explicitly defining a non-standard level here + asserts: + - notContains: + path: spec.template.spec.containers[0].env + any: true + content: + name: SSH_LOG_LEVEL diff --git a/values.yaml b/values.yaml index 1213221..458f495 100644 --- a/values.yaml +++ b/values.yaml @@ -348,6 +348,10 @@ gitea: ## @param gitea.podAnnotations Annotations for the Gitea pod podAnnotations: {} + ## @param gitea.ssh.logLevel Configure OpenSSH's log level. Only available for root-based Gitea image. + ssh: + logLevel: "INFO" + ## @section LivenessProbe # ## @param gitea.livenessProbe.enabled Enable liveness probe -- 2.40.1