saltstack / saltstack/salt

Proxy pillar ID targetting

Open
#54,504 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Proxy-Minion severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Issue

I was adding hundreds of proxy minion pillars for a cluster. During which, I realized that the proxy pillar format doesn't follow the regular pillar convention of descriptor-ID: key: value seen with regular pillars. This is a feature loss seeing as with regular pillars many can be listed in the same pillar sls file.

Instead, the "descriptor" is taken from the hard coded target ID in the /srv/pillar/top.sls file, with a proxy pillar file indent underneath. That pillar file contains a single pillar who's highest key is proxy:
This convention has the added loss of not being able to use wildcards * in the top file to break down minion targeting into groupings.

/srv/pillar/$ ls
net-device1.sls top.sls

/srv/pillar/$ cat top.sls
base:
  'target':
    - net-device1

/srv/pillar/$ cat net-device1.sls
proxy:
  proxytype: networkswitch
  host: 172.23.23.5
  username: root
  passwd: letmein

/srv/pillar/$ salt-proxy --proxyid=target -d 

This is unwieldy at scale, if I am adding hundreds of proxy pillars I'd prefer to segregate proxy pillars into files with a grouping convention rather than each proxy pillar getting its own file, and slot in the top.sls file.


Solution

Two part:

  1. The salt-proxy --proxyid=[ID] targeting logic needs to be rewritten to allow the same minion ID targeting in the /srv/pillar/top.sls file as it is with /srv/salt/top.sls file for salt states.

  2. Further the --proxyid should look for a proxy pillar indented key:value for its ID, or take it from the proxy pillar's descriptor-ID above proxy: like normal pillars.

/srv/pillar/$ ls
top.sls groupABC.sls group123.sls

/srv/pillar/$ cat top.sls
base:
  'switch*':
    - groupABC
  'router*':
    - group123

/srv/pillar/$ cat groupABC.sls
switch1:
  proxy:
    proxytype: networkswitch
    host: 172.23.23.5
    username: root
    passwd: letmein

switch2:
  proxy:
    proxytype: networkswitch
    host: 172.23.23.6
    username: root
    passwd: letmein

proxy:
  id: switch3
  proxytype: networkswitch
  host: 172.23.23.7
  username: root
  passwd: letmein

/srv/pillar/$ salt-proxy --proxyid=switch3 -d 
/srv/pillar/$ salt-proxy --proxyid=switch2 -d 

Please note that both proxy pillar structures would be valid for spinning up proxy switch2 & switch3 with this change.

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 by tracing the implementation behind salt-proxy --proxyid and how /srv/pillar/top.sls selects pillar files. Use the two YAML examples as behavioral requirements; done means proxy IDs can be targeted through grouped or wildcard top-file entries and both shown pillar structures are accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.