-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [Improvement] Adds FORUM_ENV filter to manage forum environment vars #24
feat: [Improvement] Adds FORUM_ENV filter to manage forum environment vars #24
Conversation
The forum service is entirirely configured using environemnt variables, and there are a number of environment variables that are not configurable via tutor currently. This change adds patches in those places allowing additional configuration variables to be passed.
I understand the need to configure the forum via environment variables. EDIT: Scratch that, I have a better idea (see below). |
I think I got a better idea:
And then in the k8s templates:
(and similar in the docker-compose templates) With this approach, users would only have to add items to the Please tell me whether this makes sense, I understand it might be a little confusing. |
I think this makes a lot more sense! I was just reluctant to add new config to the main project. |
Just realised what I proposed won't work since the values won't be rendered. So I've implemented your approach. |
[Improvement] Introduces the `FORUM_ENV` filter to which any additional forum which simplifies management of environment variables for the forum service. Additional environment variables can be added to this filter, and existing values can be removed as needed by plugins. These are rendered into the new `forum-k8s-env` and `forum-local-env` patches for the kubernetes and docker configs respectively.
b4a3163
to
dc977ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have a couple minor comments, otherwise I think this is top notch. @ghassanmas what do you think?
This looks interesting change, I have quickly tested and provided a comment above... I will keep an eye on this and expect me to test it locally with docker/compose. But I wouldn't test it with k8s as it's still a black box to me. A curious quesiotn I have; What would happen if opreator would use the k8s/local patch directly? like do we expect them to do so? I suppose it might be the case if I have different configruation between local and k8s Another thing that also make the situation more obscure to me is that it might be the case that we run k8s locally hence But this I guess then something related to tutor core naming as always naming might not reflect the meaning :-) |
d991674
to
9192b24
Compare
I can't think for a good reason right now for someone to want different environment variables for k8s vs local. However, they can just use the patches in that case as you mentioned. I imagine people will generally only deploy an instance using local or k8s and not both from a single config, so if they wanted they can just copy over the config, change the required variables/plugins/settings and deploy to local and k8s from different configs. I think running k8s on your local computer is a kind of an edge case! I've tested tutor again minikube and I currently run a k3s cluster on a secondary mini-pc exactly for these kinds of tests. I've had success so far, but it definitely takes some effort setting up. |
I have tested this locally and it worked as expected, the services init, craeted a thread..etc. The only thing I can think of, is just ot update the readme, and second regarding the order/priority of the patches, my thinking is that we have know three pathces that can override each other:
My understanding and I think that the logical is tha should be loaded in that order, but I haven't tested that yet, looking through the code I see that 2 and 3 has priority high, so I think we should be safe... unless we get into a weired edge case if opreator are using both 2 and 3 and 3 get loaded before 2 |
9192b24
to
c7c882a
Compare
I've updated the readme file with some info about how this hook can be used. As for the priority. I think that's definitely a potential issue. I'm not sure how to fully avoid it, and perhaps it can't be avoided in all cases. Do you think it's worth warning about this in the readme? I've run into such edge cases in the past and it was hard to diagnose, but perhaps also hard to list all such edge cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a minor formatting issue
c7c882a
to
19dbac5
Compare
19dbac5
to
eb1bf55
Compare
@regisb Just checking if this is OK to merge now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! As the maintainer of this repo, I'll let @ghassanmas take care of squashing and merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for late respond, I has been recently...
I have teseted this, it worked with no issue with tutor local.
Regarding this:
As for the priority. I think that's definitely a potential issue. I'm not sure how to fully avoid it, and perhaps it can't be avoided in all cases. Do you think it's worth warning about this in the readme? I've run into such edge cases in the past and it was hard to diagnose, but perhaps also hard to list all such edge cases.
I think the way to avoid this, is set the priority FORUM_ENV, hight + 1, this would ensure that other spesfic patches (k8s/local ) has higher priority, given high is just a number.
I haven't tested that though, it's based on my understanding how priority works in tutor, I will give it a look later and update the code accordingly.
Thank you for your contribution, it's much apperciated 🎉 .
The forum service is entirirely configured using environemnt variables, and there are a number of environment variables that are not configurable via tutor currently. This change adds patches in those places allowing additional configuration variables to be passed.