saltstack / saltstack/salt

pillarenv environments in masterless setup

Open
#52,832 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed Pillar severity-high
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue/Question

I'm using a masterless setup to manage application configuration and deployment on a single machine.

My problem seems similar to #36153 and #30234 , with the difference of a masterless setup, and salt version involved.

I'm trying to use pillar environments to enable multiple deployments of an application with different sets of configurations.

So I have my pillar_roots configured like so:

pillar_roots:
  base:
    - /srv/pillar
  alpha:
    - /srv/pillar/alpha
  beta:
    - /srv/pillar/beta

and my /srv/pillar/top.sls looking like this:

base:                                                                                                                                                                                                                                                                                                                       
  "*":
    - otherstuff

alpha:
  "*":
    - myapp1
    - myapp2
    
beta:
  "*":
    - myapp1
    - myapp2

But testing with e.g. salt-call -l info --local pillar.items myapp1 pillarenv=alpha fails to give the expected results, instead showing the content of beta. I understand it's merging the pillar files in the order they are processed(if I add a key in the alpha version, but not in the beta version, It will be present in the output).

I also tested with pillar_source_merge_strategy: none in my masterless config, after finding out about this, to no effect.

Setup

/etc/salt/minion.d/masterless.conf:

file_client: local

file_roots:
  base:
    - /srv/salt/
  alpha:
    - /srv/salt/alpha
  beta:
    - /srv/salt/beta
                                                                                                                                                                                                                                                                                  
pillar_roots:
  base:
    - /srv/pillar
  alpha:
    - /srv/pillar/alpha
  beta:
    - /srv/pillar/beta
Steps to Reproduce Issue

/srv/pillar/alpha/test.sls:

test:                                                                                                                                                                                                                                                                                                                       
  a: 1
  b: 2
  c: 3

/srv/pillar/beta/test.sls:

test:                                                                                                                                                                                                                                                                                                                       
  a: 3
  b: 4
$ salt-call -l info --local pillar.items test pillarenv=alpha                                                                                                                                                                                                                                     
local:                                                                                                                                                                                                                                                                                                                      
    ----------
    test:
        ----------
        a:
            3
        b:
            4
        c:
            3           
Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

# salt-call --version                                                                                                                                                                                                                                                                             
salt-call 2019.2.0 (Fluorine)   
# uname -a                                                                                                                                                                                                                                                                                        
Linux server-04 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the masterless configuration in /etc/salt/minion.d/masterless.conf and the salt-call --local pillar.items test pillarenv=alpha entry point. Compare how the alpha and beta pillar_roots and top.sls files are processed, focusing on why beta values appear in the alpha result. Done means the alpha result contains alpha data without beta-only values while preserving the expected merged keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.