Skip to content

Commit

Permalink
salt, build: add certs renewal orchestrate
Browse files Browse the repository at this point in the history
This orchestrate will be called by the reactor
when it will receive an event for an expired
certificates.
It will run `sls` defined under `certs_renewal`
pillar entry for each expired certificate.

Refs: #1887
  • Loading branch information
alexandre-allard committed Nov 3, 2020
1 parent f2e1b52 commit 6d59b36
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,8 @@ def _get_parts(self) -> Iterator[str]:
Path('salt/metalk8s/orchestrate/bootstrap/pre-downgrade.sls'),
Path('salt/metalk8s/orchestrate/bootstrap/pre-upgrade.sls'),

Path('salt/metalk8s/orchestrate/certs/renew.sls'),

Path('salt/metalk8s/orchestrate/downgrade/init.sls'),
Path('salt/metalk8s/orchestrate/downgrade/precheck.sls'),
Path('salt/metalk8s/orchestrate/downgrade/pre.sls'),
Expand Down
15 changes: 15 additions & 0 deletions salt/metalk8s/orchestrate/certs/renew.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{%- set target_pillar = salt.saltutil.runner(
'pillar.show_pillar', kwarg={'minion': pillar.orchestrate.target}
) %}
{%- set sls = [] %}

{%- for cert in target_pillar.certs_renewal %}
{%- if cert["name"] in pillar.orchestrate.certificates %}
{%- do sls.extend(cert["sls"]) %}
{%- endif %}
{%- endfor %}

Renew expired certificates:
salt.state:
- tgt: {{ pillar.orchestrate.target }}
- sls: {{ sls | unique | json }}

0 comments on commit 6d59b36

Please sign in to comment.