-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make possible to reference previous pillars from subsequent pillars, as they specified in the top file #37003
Make possible to reference previous pillars from subsequent pillars, as they specified in the top file #37003
Conversation
I would like to have @thatch45 @terminalmage and @plastikos all chime in here. |
I like this approach and I am ok with it. It inserts the logic in the correct place and simplifies the code a little, I think it is very well done. |
The PR is not yet ready to be merged, wait until I finalize it plz. |
Of course :) |
I'm trying to fix the tests, but when I launch them locally - they pass (unlike in Jenkins). For example this one: Can somebody tell, from the top of the head, what can cause this? My versions report:
Jenkins versions report:
|
Okay, I have updated |
I resolved the issues with tests, but stuck with #37905. |
@cachedout, hooray, the PR is ready to be merged 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.
Some comments about the docs, doesn't look like it would block a merge, we can take care of them afterwards.
Code looks OK, the only thing that has me worried about performance is the invocations of the loader in render_pillar()
, this might put extra load on the master at scale when compiling pillar data for a large number of minions.
@thatch45 is this a valid concern, or am I just being too cautious?
doc/topics/pillar/index.rst
Outdated
Referencing Other Pillars | ||
========================= | ||
|
||
.. versionadded:: ????? |
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.
Now that we're past the Carbon release cycle, this can be changed to .. versionadded:: Nitrogen
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.
Done.
doc/topics/pillar/index.rst
Outdated
|
||
.. versionadded:: ????? | ||
|
||
It is possible to reference pillar values, that are defined in other |
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.
The comma here is unnecessary.
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.
Fixed.
doc/topics/pillar/index.rst
Outdated
.. versionadded:: ????? | ||
|
||
It is possible to reference pillar values, that are defined in other | ||
pillar files. To do that, the pillar with referenced pillars should |
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.
This could be worded better. Perhaps:
To do this, make sure that any pillar variables which are being referenced by other pillar SLS files are defined higher up in the pillar Top file, so that they are evaluated first.
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.
Fixed.
What solutions do you see? To make loaders copy-able and mutable? |
That concern is very valid. Given that this is in a loop, this has the potential to totally destroy master performance at scale. Why not use the copy of the minion functions we already have in the pillar instance? |
Because without that |
I'm not following why that would be. This looks like we're just using the recomputed functions to generate new renderers. Forgive my lack of understanding here but what's different about the renderers on each iteration? |
Take a look at this integration test: And at how pillars are rendered for it: Without recreating functions But TL;DR To make functions like |
K, that makes sense. Thanks for the explanation. |
I think the solution is to add |
@AndrewPashkin Yes, I agree. Exactly what I was thinking. Do you want to take a swing at that? Might be a bit before I can get to it. |
@cachedout, I'd want to do that, but I have bad shortage of time, so I can't really promise anything. |
Hi, guys, I decided to get back to this PR. Here is the quick summary of the current state of things:
BUT. I've found that it seems like it is fundamentally impossible to make them updateable, because there is the place when the options (the thing that is actually needs to be made updateable in What are your thoughts on that? |
The only idea that I have for now is that it's possible to factor out actual loading of the modules out of |
I think, that it might be the case, that the performance impact is insignificant. The bottle neck here is But considering that the modules are loaded lazily, on demand, and that the amount of SLS files is not something that usually scales up to really big numbers (like number of minions), the overhead in real life scenarios might be not noticeable. This is also supported by the fact that test runs times are not increased (both ~1:15), and I also did local benchmarks with multiple minions and multiple SLS files invoking the same module and I haven't found any difference in performance between |
Hmm, I think you might be right here. @terminalmage and @thatch45 what do you think? |
I think he is right, and yes, in the old days we would cache the pillar modules, any you still can with the lazy loader, but the modules (if I recall) need to be loaded on a per pillar generation so the right variables are set in the loaded modules. Lazy loading then helps because you don't need to reload all the modules, just the needed ones |
That's correct, if a module defines |
this is why we reload pillar modules with each request to the pillar, this was actually a bug in much earlier versions of salt where the cached modules did not always properly contain the right pillar data. So you are spot on once again |
I see that the Python 3 tests are failing and not only in my PR. Should I wait until they are fixed? |
Tests are fixed, let's 🚢 it? |
What does this PR do?
It implements proposal of @jberkus to make possible to reference previous pillars from the ones that are subsequent in the top file.
Even if core developers have own plans for solving #6955, this feature does not prevent any other solution from being implemented and would just give a developer another way to set up his system.
What issues does this PR fix or reference?
#6955
Previous Behavior
Previously order in which regular pillars are loaded (and become reference-able by other pillars) was undefined.
New Behavior
Now user can reference pillars, that come before current pillar in the top file.
Tests written?
Yes. I would ask core devs to advise if and what additional tests are needed.