Skip to content

Commit cbaaa92

Browse files
authored
Merge pull request #3 from ferricoxide/AddWinFuncs
Add funcitonality for Windows Configuration-Targets
2 parents 2fa22fc + bc4edaa commit cbaaa92

26 files changed

Lines changed: 278 additions & 125 deletions

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.1.0
2+
current_version = 0.1.1
33
commit = True
44
message = Bumps version to {new_version}
55
tag = False

.github/workflows/test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,20 @@ jobs:
2525
salt-os-version: ${{ matrix.os_version }}
2626
salt-state: ${{ matrix.salt_state }}
2727
salt-pillar-root: ${{ matrix.salt_pillar_root }}
28+
29+
windows:
30+
uses: plus3it/actions-workflows/.github/workflows/test-salt-windows.yml@ddd67e99878a285f728de398c1116151c2d7791a
31+
strategy:
32+
matrix:
33+
os_version:
34+
- windows-2019
35+
- windows-2022
36+
- windows-2025
37+
salt_state:
38+
- flux-cli
39+
salt_pillar_root:
40+
- ./tests/pillar/test-flux-cli
41+
with:
42+
salt-os-version: ${{ matrix.os_version }}
43+
salt-state: ${{ matrix.salt_state }}
44+
salt-pillar-root: ${{ matrix.salt_pillar_root }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
### 0.1.1
8+
9+
**Released**: 2026.05.13
10+
11+
**Summary**:
12+
13+
* Adds setup-capability for Windows-based onfiguration-targets (tested with Windows Server 2022)
14+
* Adds Windows-related CI features to project
15+
* Add conditional, VERY basic integration-steps for Podman and Docker
16+
717
### 0.1.0
818

919
**Released**: 2026.05.12

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ A SaltStack formula designed to install and configure the [Flux](https://fluxcd.
55

66
It is primarily expected that this formula will be run via [P3](https://www.plus3it.com/)'s "[watchmaker](https://watchmaker.readthedocs.io/en/stable/)" framework.
77

8-
This formula is able to install the Flux CLI on both Linux[^1] and Windows Server[^2] operating environments. Intallation for internet-connected systems will come from the Flux CLI project's ["releases" page](https://github.com/fluxcd/flux2/releases).
8+
This formula is able to install the Flux CLI on both Linux[^1] and Windows Server[^2] operating environments. Intallation for internet-connected systems may come from the Flux CLI project's ["releases" page](https://github.com/fluxcd/flux2/releases). If installing this way, the formula will install the latest-available version of the content. Alternately:
9+
10+
* Sites whose installation-targets won't be able to reach the Flux CLI project's GitHub repository will need to self-host copies of the desired content.
11+
* Sites that wish to use a specific version of the Flux CLI will need to target that content
12+
13+
Targeting specific versions of the FluX CLI or local copies of the install-archives can be directed to do so by adding appropriate content to the formula's associated Pillar-data (see thish projct's [pillar.example](pillar.example) file for guidance).
914

1015

1116
## Available states

flux-cli/config/clean.sls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
{#- Get the `tplroot` from `tpldir` #}
55
{%- set tplroot = tpldir.split('/')[0] %}
6-
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
76
{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %}
87
98
include:
@@ -13,3 +12,5 @@ include:
1312
- flux-cli.config.win_clean
1413
{%- endif %}
1514
15+
Avoid being a null-router (config/clean):
16+
test.nop: []

flux-cli/config/file.sls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ include:
1515
- flux-cli.config.win_file
1616
{%- endif %}
1717
18-
18+
Avoid being a null-router (config/file):
19+
test.nop: []

flux-cli/config/lin_clean.sls

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ Remove bash-completion file for Flux:
1212
file.absent:
1313
- name: '/etc/bash_completion.d/flux'
1414
15-
Remove kubeconfig directory for all users:
16-
file.absent:
17-
- name: '/etc/skel/.kube'
18-
1915
Remove shell-ENVs for Flux:
2016
file.absent:
2117
- name: '/etc/profile.d/flux_env.sh'

flux-cli/config/lin_file.sls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Ensure Docker Service for Flux/Kind:
2727
- name: 'docker'
2828
- enable: True
2929
- require:
30-
- file: 'Enforce flux permissions and SELinux'
30+
- sls: {{ sls_package_install }}
3131
- require_in:
3232
- file: 'Install user-env setup for Podman socket'
3333
{%- endif %}
@@ -39,7 +39,7 @@ Ensure Podman Socket for Kind:
3939
- enable: True
4040
- comment: "Podman detected; enabling socket for Flux/Kind compatibility."
4141
- require:
42-
- file: 'Enforce flux permissions and SELinux'
42+
- sls: {{ sls_package_install }}
4343
- require_in:
4444
- file: 'Install user-env setup for Podman socket'
4545
{%- endif %}
@@ -48,7 +48,7 @@ Ensure bash-completion package is present:
4848
pkg.installed:
4949
- name: bash-completion
5050
- require:
51-
- file: 'Enforce flux permissions and SELinux'
51+
- sls: {{ sls_package_install }}
5252
5353
Ensure kubeconfig directory for all users:
5454
file.directory:

flux-cli/config/win_clean.sls

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
4+
{#- Get the `tplroot` from `tpldir` #}
5+
{%- set tplroot = tpldir.split('/')[0] %}
6+
7+
Remove Flux Autoload from Global Windows PowerShell Profile:
8+
file.replace:
9+
- name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1'
10+
# (?ms) enables multiline matching so we can grab the whole block at once
11+
- pattern: '(?ms)^# --- START FLUX CLI AUTOLOAD ---.*?# --- END FLUX CLI AUTOLOAD ---$'
12+
- repl: ''
13+
- ignore_if_missing: True
14+
15+
Remove Flux Autoload from Global PowerShell 7 Profile:
16+
file.replace:
17+
- name: 'C:\Program Files\PowerShell\7\profile.ps1'
18+
- pattern: '(?ms)^# --- START FLUX CLI AUTOLOAD ---.*?# --- END FLUX CLI AUTOLOAD ---$'
19+
- repl: ''
20+
- ignore_if_missing: True

flux-cli/config/win_file.sls

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
4+
{#- Get the `tplroot` from `tpldir` #}
5+
{%- set tplroot = tpldir.split('/')[0] %}
6+
{%- set sls_package_install = tplroot ~ '.package.install' %}
7+
{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %}
8+
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
9+
{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %}
10+
11+
12+
include:
13+
- {{ sls_package_install }}
14+
15+
Ensure Default User kubeconfig directory exists:
16+
file.directory:
17+
- makedirs: True
18+
- name: 'C:\Users\Default\.kube'
19+
- require:
20+
- sls: {{ sls_package_install }}
21+
22+
Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile:
23+
file.blockreplace:
24+
- append_if_not_found: True
25+
- content: |
26+
if (Test-Path "{{ install_dir }}flux-completion.ps1") {
27+
. "{{ install_dir }}flux-completion.ps1"
28+
}
29+
if (Test-Path "{{ install_dir }}flux-env.ps1") {
30+
. "{{ install_dir }}flux-env.ps1"
31+
}
32+
- marker_end: '# --- END FLUX CLI AUTOLOAD ---'
33+
- marker_start: '# --- START FLUX CLI AUTOLOAD ---'
34+
- name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1'
35+
- require:
36+
- file: 'Ensure Global (default) Windows PowerShell Profile Exists'
37+
- cmd: 'Generate Flux CLI PowerShell Autocompletion'
38+
- file: 'Install user-env setup for Windows container runtimes'
39+
40+
Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile:
41+
file.blockreplace:
42+
- append_if_not_found: True
43+
- content: |
44+
if (Test-Path "{{ install_dir }}flux-completion.ps1") {
45+
. "{{ install_dir }}flux-completion.ps1"
46+
}
47+
if (Test-Path "{{ install_dir }}flux-env.ps1") {
48+
. "{{ install_dir }}flux-env.ps1"
49+
}
50+
- marker_end: '# --- END FLUX CLI AUTOLOAD ---'
51+
- marker_start: '# --- START FLUX CLI AUTOLOAD ---'
52+
- name: 'C:\Program Files\PowerShell\7\profile.ps1'
53+
- onlyif:
54+
- 'Test-Path "C:\Program Files\PowerShell\7"'
55+
- shell: powershell
56+
- require:
57+
- file: 'Ensure Global PowerShell 7 Profile Exists'
58+
- cmd: 'Generate Flux CLI PowerShell Autocompletion'
59+
- file: 'Install user-env setup for Windows container runtimes'
60+
61+
Ensure Global (default) Windows PowerShell Profile Exists:
62+
file.managed:
63+
- name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1'
64+
- replace: False
65+
66+
Ensure Global PowerShell 7 Profile Exists:
67+
file.managed:
68+
- name: 'C:\Program Files\PowerShell\7\profile.ps1'
69+
- onlyif:
70+
- 'Test-Path "C:\Program Files\PowerShell\7"'
71+
- shell: powershell
72+
- replace: False
73+
74+
Generate Flux CLI PowerShell Autocompletion:
75+
cmd.run:
76+
- name: >
77+
& "{{ install_dir }}flux.exe" completion powershell |
78+
Out-File -FilePath "{{ install_dir }}flux-completion.ps1"
79+
-Encoding UTF8
80+
- onchanges:
81+
- archive: 'Extract flux CLI Archive'
82+
- shell: powershell
83+
84+
Install user-env setup for Windows container runtimes:
85+
file.managed:
86+
- name: '{{ install_dir }}flux-env.ps1'
87+
- contents: |
88+
# Ensure Flux and Kind can locate the correct container socket on Windows
89+
if (Get-Command podman -ErrorAction SilentlyContinue) {
90+
$env:DOCKER_HOST = "npipe:////./pipe/podman-machine-default"
91+
} elseif (Get-Command docker -ErrorAction SilentlyContinue) {
92+
$env:DOCKER_HOST = "npipe:////./pipe/docker_engine"
93+
}
94+
- require:
95+
- sls: {{ sls_package_install }}

0 commit comments

Comments
 (0)