Add config fallbacks for session
, cache
and queue
when disabling redis-cluster
#585
Reference in New Issue
Block a user
No description provided.
Delete Branch "refs/pull/585/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description of the change
Add config fallbacks for
session
,cache
andqueue
including tests.Benefits
If users disable the default
redis-cluster
sub-chart dependency, this will configure the respective sections to use the Gitea defaults as listed in https://docs.gitea.com/next/administration/config-cheat-sheet.Possible drawbacks
Users will run on non-optimal settings for production without knowing their config.
Applicable issues
Checklist
values.yaml
and added to theREADME.md
using readme-generator-for-helmREADME.md
Without having enough time to review this today, a suggestion regarding
Users will run on non-optimal settings for production without knowing their config.
:We could print a notice within https://gitea.com/gitea/helm-chart/src/branch/main/templates/NOTES.txt. This is shown when running
helm install
orhelm upgrade
. That's the only possible way to let users know that their configuration might not be best fit for production while not cancelling the helm templating. What do you think about that, @pat-s?Might surely "better than nothing" but helm charts are often wrapped by other tools and such hints don't appear there (terraform, argo (?)). I guess the best we can do is to highlight it in the README (in addition to NOTES.txt, surely a good idea) and "just hope for the best". At some point users are also just solely responsible for their settings and might notice when things aren't running smooth.
Ah, right. Wrapper tools hide those notes. I like your suggestion to add it to the readme as well. Let's do both, as you said. This should™️ help.
@justusbunsi Added both. Feel free to modify directly if you have suggestions to content and wording.
Oh dear, I really tried to break your changes. 😆
As you can see, I changed a few things. My commit messages should be descriptive. If not, let me know.
Beside those changes, I could not find any issues regarding your changes. Although, I found unrelated things (see second part of this comment).
Having "redis-cluster" disabled creates this tiny invalid block inside
app.ini
. So in theory it would've been enough to not set these settings while "redis-cluster" is disabled.But I really appreciate what you've did here:
Explicitly set Gitea internal defaults (if not otherwise defined) is a neat way to reduce the current impact of #356 for users experimenting with/without Redis.
As soon as that issue is resolved, we should be able to drop these explicit resets again and simplify our code base. I've added a note in #356.
While reviewing this PR, I've also noticed that unless "redis-cluster" is completely disabled, users will never be able to overrule our redis related defaults via inline values. Neither with the current main state, nor with the changes in this PR.
Sure, they can overload them via
additionalConfigSources
- they are independent from inline values. But still have an inconsistent app.ini.That explains the user complaints about redis being very hard to overwrite.
Imagine: Trying to use "redis-cluster" for everything except for sessions where
db
is desired.Our defaults will prepare
[session].PROVIDER_CONFIG
for "redis-cluster". Per documentation, that option should be empty when[session].PROVIDER=db
.Luckily, it doesn't conflict and sessions are correctly written into the database. But it is at least confusing for admins looking at their Gitea config.
As this issue most likely exists since the introduction of
additionalConfigSources
, I consider this out of scope of this PR 🙂. But without this PR I wouldn't have noticed.We need to reconsider the whole app.ini creation with #356 anyway, so it might be a good fit there. I've added a note about this finding over there, too.
LGTM. I keep it up to you to merge this PR. That way you have the chance to review my changes.
Highly appreciated and very good findings! If every PR would be reviewed with your standards, I'd be very happy :)
Yes, this has been a "bug" beforehand I'd say. I'd argue that it's not the actual reason why users faced problems but it definitely contributed to it.
I thought for some time about it as it comes back to the idea of "going with application defaults even though they are not well suited" which is and will always be a debatable topic: I.e., how opinionated should a chart be in terms of the default and general configuration (of course allowing everything but WRT to it's own template actions).
Yes I see. Though maybe this use case never applied so far as either users used redis for all of the three or for none. But yes, in theory this should be possible without duplicated config sections.
A general test would be great which issues a warning if duplicated config sections/mappings are detected.
I also think that this is an improvement for now and we can go with it (and also release 1.21.2). Thanks also for the missed bracket in
NOTES.txt
!