-
Notifications
You must be signed in to change notification settings - Fork 47
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
Use dev/staging pillars to remove branching logic in provisioning #1053
Comments
I support this approach wholeheartedly. As you point out, @rocodes, it has precedent in how we parameterize |
I think a good initial step towards less conditional logic throughout our provisioning files (thought about this a lot in the context of #945 and the other related proposals I have made around build variants) could go like this:
Good outcomes:
upstream examples/precedent:
|
To make this more concrete, here is an example of what this would look like.
Here's an example of what the default-config.j2 file would look like. All configuration details are in one file. ./securedrop_salt/sd-default-config.j2
And here's an example of the drop-in dev configuration (staging would have its own similar pillar file) ./securedrop_pillar/dev.sls
|
I like the approach of centralizing the variables in one place and pillars sounds like the correct approach. One potential problem with the approach that I can see is that pillarenvs are mutually exclusive when explicitly set via In practice this would prevents us from requiring default Qubes formulas like qvm.anon-whonix, which rely on the base environment. I was trying to look at other approaches which would let programmatically inject additional pillar data. Ideally this would be without relying on files because without saltenv we can't really count on being able to dynamically change which files it picks. I looked into The most promising approach without using files is by passing in pillar data (the next section). Pass in pillar data via salt-callsWe can also inject pillar data with One downside is that the command would look very verbose. Luckily there is a way to pass arguments via stdin.
Then we could programmatically inject pillar overrides based on the configuration we desire. |
Thanks so much for all the thoughtful feedback, @deeplow :) I should have renamed this issue when I posted the last comment, since pillarenv/saltenv was the original thing I was wondering about several months ago, but not the thing I most recently proposed - I've slightly renamed it now to clarify that the approach is still about pillar data + avoiding branching logic, but doesn't hinge on pillarenv/saltenv. In this last suggestion I am not suggesting we use our own pillarenv - the same way we kept securedrop_salt in
What I am imagining here is that |
Description
Filing for discussion
Right now our provisioning logic copies everything needed for provisioning into one common Salt directory, and uses conditionals in .sls files to choose the right path(s) for provisioning, leading to lots of branching logic
{% if d.environment == "staging" %} ... {% elif d.environment == "prod" %}
. Part of why the provsioning is complex is because it's trying to deal with different build flavours/environments, and can't tell which one to use until orchestration/apply time.I think we could use saltenv/pillarenv and simplify our lives:
qubesctl state.apply pillarenv=dev
)** (use the
pillarenv_from_saltenv
configuration option for sanity)securedrop-workstation.repo
,sd-release-key.asc
), meaning sd-default-config{.sls,.yml} wouldn't be needed.How will this impact SecureDrop/SecureDrop Workstation users?
How would this affect the SecureDrop Workstation threat model?
The text was updated successfully, but these errors were encountered: