Support for SSH log level #358

Merged
pat-s merged 7 commits from pi3ch/helm-chart:main into main 2023-03-22 08:13:31 +00:00
Contributor
Re https://gitea.com/gitea/helm-chart/issues/224#issuecomment-717087
pi3ch added 1 commit 2022-09-10 01:11:23 +00:00
Support for SSH log level
All checks were successful
continuous-integration/drone/pr Build is passing
279824e1f1
pat-s approved these changes 2022-09-14 08:49:19 +00:00
pat-s left a comment
Member

Nice catch!

Nice catch!
Member

Setting the required environment variable for changing the log level is already possible using the .statefulset.env configuration.

Setting the required environment variable for changing the log level is already possible using the `.statefulset.env` configuration.
justusbunsi closed this pull request 2022-09-23 13:24:28 +00:00
justusbunsi reopened this pull request 2022-09-23 22:48:44 +00:00
Member

Reopened. See #224 (comment)
Sorry for closing.

Reopened. See https://gitea.com/gitea/helm-chart/issues/224#issuecomment-718042 Sorry for closing.
justusbunsi requested changes 2022-09-25 12:08:48 +00:00
@ -210,2 +210,4 @@
- name: SSH_PORT
value: {{ .Values.gitea.config.server.SSH_PORT | quote }}
- name: SSH_LOG_LEVEL
value: {{ .Values.gitea.config.server.SSH_LOG_LEVEL | quote }}
Member

Reviewing the example config file, SSH_LOG_LEVEL seems to be no valid app.ini setting but only an environment variable being used for ssh templating. I suggest either not locating it at .Values.gitea.config.server to prevent this value from being written to the config file, or filtering it out during inline-config processing in _helpers.tpl.

A possible location for this could be a new object .Values.gitea.ssh with key logLevel. Doing so would implicitly ease the way for #321 (disable ssh features).

In any way, a default value must be defined when not checking the existence of a values key.

Reviewing the example config file, `SSH_LOG_LEVEL` seems to be no valid app.ini setting but only an environment variable being used for ssh templating. I suggest either not locating it at `.Values.gitea.config.server` to prevent this value from being written to the config file, or filtering it out during inline-config processing in `_helpers.tpl`. A possible location for this could be a new object `.Values.gitea.ssh` with key `logLevel`. Doing so would implicitly ease the way for #321 (disable ssh features). In any way, a default value must be defined when not checking the existence of a values key.
justusbunsi marked this conversation as resolved
Member

Thanks for checking so thoroughly, @justusbunsi! I did not look at the example app.ini as the naming seemed to make sense inline with the other SSH options.

A possible location for this could be a new object .Values.gitea.ssh with key logLevel. Doing so would implicitly ease the way for #321 (disable ssh features).

This, in combination with a comment why the SSH settings are located in their own block, would be elegant.

@pi3ch Would you be interested in moving into this direction (within this PR)?

Thanks for checking so thoroughly, @justusbunsi! I did not look at the example `app.ini` as the naming seemed to make sense inline with the other SSH options. > A possible location for this could be a new object .Values.gitea.ssh with key logLevel. Doing so would implicitly ease the way for #321 (disable ssh features). This, in combination with a comment why the SSH settings are located in their own block, would be elegant. @pi3ch Would you be interested in moving into this direction (within this PR)?
pi3ch requested review from justusbunsi 2022-09-25 23:27:32 +00:00
Author
Contributor

I found all SSH related settings under Server section of the cheatsheet (https://docs.gitea.io/en-us/config-cheat-sheet/#server-server) so it made sense to keep the SSH settings all in once place. Putting it in a difference place could be confusing.

I may suggest Logs section would be more appropriate because firstly there is already another SSH related setting, secondly it is simple for new users to find it out (https://docs.gitea.io/en-us/config-cheat-sheet/#log-log).

I found all SSH related settings under **Server** section of the cheatsheet (https://docs.gitea.io/en-us/config-cheat-sheet/#server-server) so it made sense to keep the SSH settings all in once place. Putting it in a difference place could be confusing. I may suggest **Logs** section would be more appropriate because firstly there is already another SSH related setting, secondly it is simple for new users to find it out (https://docs.gitea.io/en-us/config-cheat-sheet/#log-log).
Member

I may suggest Logs section would be more appropriate because firstly there is already another SSH related setting, secondly it is simple for new users to find it out (https://docs.gitea.io/en-us/config-cheat-sheet/#log-log).

Sounds also reasonable. Might be a bit harder to get all SSH-related settings with a on/off switch then if they are split across multiple categories but the LOG_LEVEL one should not make any difference at all if SSH is off anyway.

> I may suggest Logs section would be more appropriate because firstly there is already another SSH related setting, secondly it is simple for new users to find it out (https://docs.gitea.io/en-us/config-cheat-sheet/#log-log). Sounds also reasonable. Might be a bit harder to get all SSH-related settings with a on/off switch then if they are split across multiple categories but the LOG_LEVEL one should not make any difference at all if SSH is off anyway.
Member

I understand what you mean and it kind of makes sense. Though, I'd still prefer extracting that option into a new object. The whole object .Values.gitea.config simply applies all its content to the app.ini. That's what it's designed for. Without using this Helm Chart you would not add an option to app.ini which has no effect. You would define the environment variable. Even if there are other related options inside app.ini. You know what I mean? It just doesn't feel right adding it there.

With a dedicated object supporting ssh application options and ssh environment options, the chart user wouldn't have to search through the config cheat sheet. The user wouldn't have to configure application options via .Values.gitea.config at all. That would be a feature of this helm chart to simplify ssh configuration as the chart would know what it has to use in which part of the generated helm release.

Surely, supporting all ssh related options at once is totally out of scope of this PR and I don't ask for it. But this PR could lead the way into that direction, even if there is yet another option until it's fully supported.

I understand what you mean and it kind of makes sense. Though, I'd still prefer extracting that option into a new object. The whole object `.Values.gitea.config` simply applies all its content to the app.ini. That's what it's designed for. Without using this Helm Chart you would not add an option to app.ini which has no effect. You would define the environment variable. Even if there are other related options inside app.ini. You know what I mean? It just doesn't feel right adding it there. With a dedicated object supporting ssh application options _and_ ssh environment options, the chart user wouldn't have to search through the config cheat sheet. The user wouldn't have to configure application options via `.Values.gitea.config` at all. That would be a feature of this helm chart to simplify ssh configuration as the chart would know what it has to use in which part of the generated helm release. Surely, supporting all ssh related options at once is totally out of scope of this PR and I don't ask for it. But this PR could lead the way into that direction, even if there is yet another option until it's fully supported.
Author
Contributor

I personally don't mind and either option is fine with me. Perhaps it is better we cast vote and decide on this so this MR can get in soon.

I personally don't mind and either option is fine with me. Perhaps it is better we cast vote and decide on this so this MR can get in soon.
Member

Perhaps it is better we cast vote and decide on this so this MR can get in soon.

Good idea. @gitea/Maintainers any opinions on this?

> Perhaps it is better we cast vote and decide on this so this MR can get in soon. Good idea. @gitea/Maintainers any opinions on this?
strk approved these changes 2022-09-27 05:51:13 +00:00
Member

Anyway, there should be a default value for this setting. Otherwise the environment variable is empty which might cause side effects.

Anyway, there should be a default value for this setting. Otherwise the environment variable is empty which might cause side effects.
Member

Let's put things together:

  1. Adding the value at gitea.config.server.SSH_*: Would be in line with existing SSH settings but the helm chart would be somewhat off as it would add a setting to gitea.config.server which does not exist in Gitea itself
  2. A new section at gitea.ssh in the helm chart.
  3. Adding the value to statefulset.env and treating is as a normal env var which is picked up by some service internally.

(1) Only makes sense if the setting would be supported by Gitea itself, as Justus pointed out. Given all the other SSH options existing there, putting the new one there would help with consistency. However, this would require a change in Gitea core and not result in a quick solution to the problem.
(2) Might be cleaner and quicker than (1) in the first place but needs clear documentation stating why this one SSH setting lives there and not in gitea.config.server.
(3) Is more like an option for additional, user-based env vars which should be injected additionally.

A hybrid solution could also be to start with (2) for a quick fix and aim for (1) longterm, i.e. trying to get SSH_LOG_LEVEL to be an official option in Gitea so the helm chart can define it in gitea.config.server?

Let's put things together: 1. Adding the value at `gitea.config.server.SSH_*`: Would be in line with existing SSH settings but the helm chart would be somewhat off as it would add a setting to `gitea.config.server` which does not exist in Gitea itself 2. A new section at `gitea.ssh` in the helm chart. 3. Adding the value to `statefulset.env` and treating is as a normal env var which is picked up by some service internally. (1) Only makes sense if the setting would be supported by Gitea itself, as Justus pointed out. Given all the other SSH options existing there, putting the new one there would help with consistency. However, this would require a change in Gitea core and not result in a quick solution to the problem. (2) Might be cleaner and quicker than (1) in the first place but needs clear documentation stating why this one SSH setting lives there and not in `gitea.config.server`. (3) Is more like an option for additional, user-based env vars which should be injected additionally. A hybrid solution could also be to start with (2) for a quick fix and aim for (1) longterm, i.e. trying to get `SSH_LOG_LEVEL` to be an official option in Gitea so the helm chart can define it in `gitea.config.server`?
Member

I agree with @justusbunsi it doesn't really feel right to add it to gitea.config
therefore I also vote for creating a dedicated ssh object for all ssh related settings.
gitea.ssh seems to be fitting here :)

I agree with @justusbunsi it doesn't really feel right to add it to `gitea.config` therefore I also vote for creating a dedicated ssh object for all ssh related settings. `gitea.ssh` seems to be fitting here :)
Member

@pi3ch With regards to Chart maintainability I would like to prevent a quick fix resulting in a breaking change or at least inconsistency when adding related features such as #321.

Do you want to continue with this PR or do you mind granting write permissions to maintainers via checkbox on the right?

@pi3ch With regards to Chart maintainability I would like to prevent a quick fix resulting in a breaking change or at least inconsistency when adding related features such as #321. Do you want to continue with this PR or do you mind granting write permissions to maintainers via checkbox on the right?
justusbunsi added the
kind
feature
label 2023-01-14 12:54:40 +00:00
Author
Contributor

@pi3ch With regards to Chart maintainability I would like to prevent a quick fix resulting in a breaking change or at least inconsistency when adding related features such as #321.

Do you want to continue with this PR or do you mind granting write permissions to maintainers via checkbox on the right?

Sure. Granted you the access.

> @pi3ch With regards to Chart maintainability I would like to prevent a quick fix resulting in a breaking change or at least inconsistency when adding related features such as #321. > > Do you want to continue with this PR or do you mind granting write permissions to maintainers via checkbox on the right? Sure. Granted you the access.
justusbunsi added 1 commit 2023-02-26 14:31:14 +00:00
Merge branch 'main' into main
All checks were successful
continuous-integration/drone/pr Build is passing
35f7e64365
Member

@pi3ch With regards to Chart maintainability I would like to prevent a quick fix resulting in a breaking change or at least inconsistency when adding related features such as #321.

Do you want to continue with this PR or do you mind granting write permissions to maintainers via checkbox on the right?

Sure. Granted you the access.

@pi3ch, I thought using the checkbox on the right would also grant write permissions to your fork branch. Using "Update branch by merge" button worked but pushing from command line is rejected with "Unauthorized" message. Do you have some sort of branch protection configured? Do you mind granting me explicit write permissions to the PR branch? Or shall I create a Pull Request towards your repository?

> > @pi3ch With regards to Chart maintainability I would like to prevent a quick fix resulting in a breaking change or at least inconsistency when adding related features such as #321. > > > > Do you want to continue with this PR or do you mind granting write permissions to maintainers via checkbox on the right? > > Sure. Granted you the access. @pi3ch, I thought using the checkbox on the right would also grant write permissions to your fork branch. Using "Update branch by merge" button worked but pushing from command line is rejected with "Unauthorized" message. Do you have some sort of branch protection configured? Do you mind granting me explicit write permissions to the PR branch? Or shall I create a Pull Request towards your repository?
pi3ch added 1 commit 2023-02-26 22:19:22 +00:00
Merge branch 'main' into main
All checks were successful
continuous-integration/drone/pr Build is passing
5b380cfb38
Author
Contributor

@justusbunsi Gitea UI is all new to me. where can I find exclusive write PR? I've just pressed "Update by merge", unsure that added your changes.

I didn't setup any branch protection, was just a vanilla PR.

You can try to PR to my branch and I MR here.

@justusbunsi Gitea UI is all new to me. where can I find exclusive write PR? I've just pressed "Update by merge", unsure that added your changes. I didn't setup any branch protection, was just a vanilla PR. You can try to PR to my branch and I MR here.
Member

You can try to PR to my branch and I MR here.

@pi3ch Let's do it that way. I've created pi3ch/helm-chart#1 to your PR branch.

> You can try to PR to my branch and I MR here. @pi3ch Let's do it that way. I've created https://gitea.com/pi3ch/helm-chart/pulls/1 to your PR branch.
pi3ch added 2 commits 2023-03-10 22:46:11 +00:00
Move SSH_LOG_LEVEL to ssh related object
Signed-off-by: justusbunsi <sk.bunsenbrenner@gmail.com>
c0fd66bdd7
pi3ch added 1 commit 2023-03-10 22:47:03 +00:00
Merge branch 'main' into main
All checks were successful
continuous-integration/drone/pr Build is passing
edb1ef7f96
Author
Contributor

@justusbunsi done. All good?

@justusbunsi done. All good?
justusbunsi approved these changes 2023-03-21 18:21:33 +00:00
justusbunsi left a comment
Member

LGTM. Thanks @pi3ch for your patience.

LGTM. Thanks @pi3ch for your patience.
justusbunsi added 1 commit 2023-03-21 18:21:56 +00:00
Merge branch 'main' into main
All checks were successful
continuous-integration/drone/pr Build is passing
8510cb83c0
Member

@pat-s Do you agree with what I changed? If so, we can merge it.

@pat-s Do you agree with what I changed? If so, we can merge it.
pat-s merged commit fdac9e9048 into main 2023-03-22 08:13:31 +00:00
Sign in to join this conversation.
No description provided.