Skip to content
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

new feature: add saltenv directory to file_roots, pillar_roots and ext_pillar.stack for dynamic environments #55812

Closed
wants to merge 13 commits into from

Conversation

morgana2313
Copy link
Contributor

@morgana2313 morgana2313 commented Jan 8, 2020

What does this PR do?

Extends dynamic environments for file_roots, pillar_roots and ext_pillar.stack; the requestor's saltenv/pillarenv can be inserted to a requested file-path with the token __env__. Glob-style wildcard matching for environments in file_roots, pillar_roots and ext_pillar.stack.

This allows for file_roots, pillar_roots and ext_pillar.stack variants of the gitfs, svnfs and hgfs behavior where branches and tags are translated into salt environments; salt environments are translated into directories. This allows for adding saltenvs dynamically without restarting the salt-master.

What issues does this PR fix or reference?

Fixes: #55747. Extends #50784 and #46309

New Behavior

  1. glob-style wildcard matching of saltenv/pillarenv. Backwards compatible; specifying __env__ as environment has the same effect as '*' and matches all environments. The first matching saltenv/pillarenv is used.

  2. __env__ in a path is replaced by the requistor's saltenv/pillarenv.

  3. new option for ext_pillar stack: pillarenv

file_roots:
  foo*:
    - /path/__env__/salt    # becomes /path/foo-bar/salt for saltenv foo-bar
    - /path2/__env__        # becomes /path2/foo-foo for saltenv foo-foo
  '*':
    - /path/__env__/salt    # becomes /path/bar-bar/salt for saltenv bar-bar
    - /path2/__env__        # becomes /path2/bar-foo for saltenv bar-foo

pillar_roots:
  foo*:
    - /path/__env__/pillar    # becomes /path/foo-bar/pillar for saltenv foo-bar
    - /path2/__env__          # becomes /path2/foo-foo for saltenv foo-foo
  '*':
    - /path/__env__/pillar    # becomes /path/bar-bar/pillar for saltenv bar-bar
    - /path2/__env__          # becomes /path2/bar-foo for saltenv bar-foo

ext_pillar:
  - stack:
      pillarenv:
        foo*: /path/__env__/pillar/stack.cfg
        '*': /path2/__env__/pillar/stack.cfg

Tests written?

Yes: Existing unit tests modified to expect new behavior.

Commits signed with GPG?

No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@morgana2313 morgana2313 changed the title WIP: new feature: add saltenv directory to file_roots, pillar_roots and ext_pillar.stack for dynamic environments new feature: add saltenv directory to file_roots, pillar_roots and ext_pillar.stack for dynamic environments Jan 28, 2020
@morgana2313
Copy link
Contributor Author

I think the failed checks are perhaps artifacts of the check process?

@morgana2313 morgana2313 marked this pull request as ready for review January 28, 2020 07:45
@morgana2313 morgana2313 requested a review from a team as a code owner January 28, 2020 07:45
@ghost ghost requested a review from waynew January 28, 2020 07:45
@codecov
Copy link

codecov bot commented Jan 30, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@c5829d6). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #55812   +/-   ##
=========================================
  Coverage          ?   22.71%           
=========================================
  Files             ?     1536           
  Lines             ?   272509           
  Branches          ?    58530           
=========================================
  Hits              ?    61870           
  Misses            ?   204679           
  Partials          ?     5960
Flag Coverage Δ
#archlts 16.39% <0%> (?)
#centos7 23.67% <0%> (?)
#proxy 24.45% <0%> (?)
#py2 22.29% <0%> (?)
#py3 17.09% <0%> (?)
#runtests 22.71% <0%> (?)
#ubuntu1604 24.4% <0%> (?)
#windows2016 21.78% <0%> (?)
#windows2019 21.85% <0%> (?)
#zeromq 22.71% <0%> (?)

@codecov
Copy link

codecov bot commented Jan 30, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@df19107). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #55812   +/-   ##
=========================================
  Coverage          ?   22.71%           
=========================================
  Files             ?     1536           
  Lines             ?   272509           
  Branches          ?    58530           
=========================================
  Hits              ?    61870           
  Misses            ?   204679           
  Partials          ?     5960
Flag Coverage Δ
#archlts 16.39% <0%> (?)
#centos7 23.67% <0%> (?)
#proxy 24.45% <0%> (?)
#py2 22.29% <0%> (?)
#py3 17.09% <0%> (?)
#runtests 22.71% <0%> (?)
#ubuntu1604 24.4% <0%> (?)
#windows2016 21.78% <0%> (?)
#windows2019 21.85% <0%> (?)
#zeromq 22.71% <0%> (?)

1 similar comment
@codecov
Copy link

codecov bot commented Jan 30, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@df19107). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #55812   +/-   ##
=========================================
  Coverage          ?   22.71%           
=========================================
  Files             ?     1536           
  Lines             ?   272509           
  Branches          ?    58530           
=========================================
  Hits              ?    61870           
  Misses            ?   204679           
  Partials          ?     5960
Flag Coverage Δ
#archlts 16.39% <0%> (?)
#centos7 23.67% <0%> (?)
#proxy 24.45% <0%> (?)
#py2 22.29% <0%> (?)
#py3 17.09% <0%> (?)
#runtests 22.71% <0%> (?)
#ubuntu1604 24.4% <0%> (?)
#windows2016 21.78% <0%> (?)
#windows2019 21.85% <0%> (?)
#zeromq 22.71% <0%> (?)

@morgana2313
Copy link
Contributor Author

morgana2313 commented Feb 5, 2020

@garethgreenaway, @dwoz: I think this pull request is ready to merge and has been for a week, how do I get somebody to review it?
I think it passes all checks, but a few seem to fail at random without information that I can understand as to why.
Regards, Jasper

Copy link
Contributor

@waynew waynew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morgana2313 thanks for the PR!

It's looking good, but it's definitely missing some test coverage. I will be OOO this week but I'll put it on the list of things to discuss with our architecture team. At the very least, we will require some more tests - if you struggle with writing tests please let us know and we can figure out a time to help train on testing.

@sagetherage sagetherage added the Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases label Mar 19, 2020
@mikisch81
Copy link

Hello,
Is this PR still in progress?

@dwoz dwoz added help-wanted Community help is needed to resolve this Abandoned labels Dec 10, 2023
@dwoz
Copy link
Contributor

dwoz commented Dec 10, 2023

Closing this due to inactivity. Anyone should feel free to re-open it if they want to see it through to the end in one release cycle.

@dwoz dwoz closed this Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abandoned help-wanted Community help is needed to resolve this Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new feature: add saltenv directory to file_roots and pillar_roots for dynamic environments
5 participants