Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.0
current_version = 0.1.1
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,20 @@ jobs:
salt-os-version: ${{ matrix.os_version }}
salt-state: ${{ matrix.salt_state }}
salt-pillar-root: ${{ matrix.salt_pillar_root }}

windows:
uses: plus3it/actions-workflows/.github/workflows/test-salt-windows.yml@ddd67e99878a285f728de398c1116151c2d7791a
strategy:
matrix:
os_version:
- windows-2019
- windows-2022
- windows-2025
salt_state:
- flux-cli
salt_pillar_root:
- ./tests/pillar/test-flux-cli
with:
salt-os-version: ${{ matrix.os_version }}
salt-state: ${{ matrix.salt_state }}
salt-pillar-root: ${{ matrix.salt_pillar_root }}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

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

### 0.1.1

**Released**: 2026.05.13

**Summary**:

* Adds setup-capability for Windows-based onfiguration-targets (tested with Windows Server 2022)
* Adds Windows-related CI features to project
* Add conditional, VERY basic integration-steps for Podman and Docker

### 0.1.0

**Released**: 2026.05.12
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ A SaltStack formula designed to install and configure the [Flux](https://fluxcd.

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.

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).
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:

* 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.
* Sites that wish to use a specific version of the Flux CLI will need to target that content

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).


## Available states
Expand Down
3 changes: 2 additions & 1 deletion flux-cli/config/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %}

include:
Expand All @@ -13,3 +12,5 @@ include:
- flux-cli.config.win_clean
{%- endif %}

Avoid being a null-router (config/clean):
test.nop: []
3 changes: 2 additions & 1 deletion flux-cli/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ include:
- flux-cli.config.win_file
{%- endif %}


Avoid being a null-router (config/file):
test.nop: []
4 changes: 0 additions & 4 deletions flux-cli/config/lin_clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ Remove bash-completion file for Flux:
file.absent:
- name: '/etc/bash_completion.d/flux'

Remove kubeconfig directory for all users:
file.absent:
- name: '/etc/skel/.kube'

Remove shell-ENVs for Flux:
file.absent:
- name: '/etc/profile.d/flux_env.sh'
6 changes: 3 additions & 3 deletions flux-cli/config/lin_file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Ensure Docker Service for Flux/Kind:
- name: 'docker'
- enable: True
- require:
- file: 'Enforce flux permissions and SELinux'
- sls: {{ sls_package_install }}
- require_in:
- file: 'Install user-env setup for Podman socket'
{%- endif %}
Expand All @@ -39,7 +39,7 @@ Ensure Podman Socket for Kind:
- enable: True
- comment: "Podman detected; enabling socket for Flux/Kind compatibility."
- require:
- file: 'Enforce flux permissions and SELinux'
- sls: {{ sls_package_install }}
- require_in:
- file: 'Install user-env setup for Podman socket'
{%- endif %}
Expand All @@ -48,7 +48,7 @@ Ensure bash-completion package is present:
pkg.installed:
- name: bash-completion
- require:
- file: 'Enforce flux permissions and SELinux'
- sls: {{ sls_package_install }}

Ensure kubeconfig directory for all users:
file.directory:
Expand Down
20 changes: 20 additions & 0 deletions flux-cli/config/win_clean.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}

Remove Flux Autoload from Global Windows PowerShell Profile:
file.replace:
- name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1'
# (?ms) enables multiline matching so we can grab the whole block at once
- pattern: '(?ms)^# --- START FLUX CLI AUTOLOAD ---.*?# --- END FLUX CLI AUTOLOAD ---$'
- repl: ''
- ignore_if_missing: True

Remove Flux Autoload from Global PowerShell 7 Profile:
file.replace:
- name: 'C:\Program Files\PowerShell\7\profile.ps1'
- pattern: '(?ms)^# --- START FLUX CLI AUTOLOAD ---.*?# --- END FLUX CLI AUTOLOAD ---$'
- repl: ''
- ignore_if_missing: True
95 changes: 95 additions & 0 deletions flux-cli/config/win_file.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %}


include:
- {{ sls_package_install }}

Ensure Default User kubeconfig directory exists:
file.directory:
- makedirs: True
- name: 'C:\Users\Default\.kube'
- require:
- sls: {{ sls_package_install }}

Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile:
file.blockreplace:
- append_if_not_found: True
- content: |
if (Test-Path "{{ install_dir }}flux-completion.ps1") {
. "{{ install_dir }}flux-completion.ps1"
}
if (Test-Path "{{ install_dir }}flux-env.ps1") {
. "{{ install_dir }}flux-env.ps1"
}
- marker_end: '# --- END FLUX CLI AUTOLOAD ---'
- marker_start: '# --- START FLUX CLI AUTOLOAD ---'
- name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1'
- require:
- file: 'Ensure Global (default) Windows PowerShell Profile Exists'
- cmd: 'Generate Flux CLI PowerShell Autocompletion'
- file: 'Install user-env setup for Windows container runtimes'

Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile:
file.blockreplace:
- append_if_not_found: True
- content: |
if (Test-Path "{{ install_dir }}flux-completion.ps1") {
. "{{ install_dir }}flux-completion.ps1"
}
if (Test-Path "{{ install_dir }}flux-env.ps1") {
. "{{ install_dir }}flux-env.ps1"
}
- marker_end: '# --- END FLUX CLI AUTOLOAD ---'
- marker_start: '# --- START FLUX CLI AUTOLOAD ---'
- name: 'C:\Program Files\PowerShell\7\profile.ps1'
- onlyif:
- 'Test-Path "C:\Program Files\PowerShell\7"'
- shell: powershell
- require:
- file: 'Ensure Global PowerShell 7 Profile Exists'
- cmd: 'Generate Flux CLI PowerShell Autocompletion'
- file: 'Install user-env setup for Windows container runtimes'

Ensure Global (default) Windows PowerShell Profile Exists:
file.managed:
- name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1'
- replace: False

Ensure Global PowerShell 7 Profile Exists:
file.managed:
- name: 'C:\Program Files\PowerShell\7\profile.ps1'
- onlyif:
- 'Test-Path "C:\Program Files\PowerShell\7"'
- shell: powershell
- replace: False

Generate Flux CLI PowerShell Autocompletion:
cmd.run:
- name: >
& "{{ install_dir }}flux.exe" completion powershell |
Out-File -FilePath "{{ install_dir }}flux-completion.ps1"
-Encoding UTF8
- onchanges:
- archive: 'Extract flux CLI Archive'
- shell: powershell

Install user-env setup for Windows container runtimes:
file.managed:
- name: '{{ install_dir }}flux-env.ps1'
- contents: |
# Ensure Flux and Kind can locate the correct container socket on Windows
if (Get-Command podman -ErrorAction SilentlyContinue) {
$env:DOCKER_HOST = "npipe:////./pipe/podman-machine-default"
} elseif (Get-Command docker -ErrorAction SilentlyContinue) {
$env:DOCKER_HOST = "npipe:////./pipe/docker_engine"
}
- require:
- sls: {{ sls_package_install }}
11 changes: 0 additions & 11 deletions flux-cli/files/default/example.tmpl.jinja

This file was deleted.

2 changes: 2 additions & 0 deletions flux-cli/package/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ include:
- flux-cli.package.win_clean
{%- endif %}

Avoid being a null-router (package/clean):
test.nop: []
2 changes: 2 additions & 0 deletions flux-cli/package/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ include:
- flux-cli.package.win_install
{%- endif %}

Avoid being a null-router (package/install):
test.nop: []
20 changes: 20 additions & 0 deletions flux-cli/package/win_clean.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %}

include:
- {{ sls_config_clean }}

Ensure Flux CLI is removed from PATH:
win_path.absent:
- name: '{{ install_dir }}'

Remove Flux CLI installation directory:
file.absent:
- name: '{{ install_dir }}'
- require:
- win_path: 'Ensure Flux CLI is removed from PATH'
81 changes: 81 additions & 0 deletions flux-cli/package/win_install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %}
{%- set target_arch = flux_cli.get('arch', 'amd64') %}
{%- set flux_archive = 'C:\\Windows\\TEMP\\flux_windows_' ~ target_arch ~
'.zip' %}
{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %}

{#- Determine the download URI #}
{%- set download_uri = flux_cli.pkg.download_uri %}
{%- set api_response = {} %}

{%- if not download_uri %}
{%- set api_url = 'https://api.github.com/repos/fluxcd/flux2/releases/latest' %}
{%- set api_response = salt['http.query'](api_url, decode=True, decode_type='json') %}

{%- if 'dict' in api_response and 'tag_name' in api_response['dict'] %}
{%- set latest_tag = api_response['dict']['tag_name'] %}
{%- set version_num = latest_tag | replace('v', '') %}
{%- set download_uri = 'https://github.com/fluxcd/flux2/releases/download/'
~ latest_tag ~ '/flux_' ~ version_num ~ '_windows_' ~ target_arch ~
'.zip' %}
{%- endif %}
{%- endif %}


{%- if not download_uri %}
Alert-and-exit Due to Missing URL:
test.fail_without_changes:
- name: 'Failed to construct download_uri. Please provide the URL manually in Pillar.'
- failhard: True
{%- elif flux_cli.pkg.download_uri %}
Download flux CLI Archive-File:
file.managed:
- name: '{{ flux_archive }}'
- onchanges_in:
- archive: 'Extract flux CLI Archive'
- skip_verify: True
- source: '{{ flux_cli.pkg.download_uri }}'
{%- else %}
Announce Fall-back:
test.show_notification:
- text: |
------------------------------------------------------------------------
No URL specified in Pillar. Attempting to download release-archive from:

{{ download_uri }}

------------------------------------------------------------------------

Download flux CLI Archive-File:
cmd.run:
- name: 'curl -sSLf -o {{ flux_archive }} {{ download_uri }}'
- onchanges_in:
- archive: 'Extract flux CLI Archive'
- require:
- test: 'Announce Fall-back'
- unless: 'test -s {{ flux_archive }}'
{%- endif %}

Extract flux CLI Archive:
archive.extracted:
- enforce_toplevel: False
- name: '{{ install_dir }}'
- overwrite: True
- source: '{{ flux_archive }}'

Ensure Flux CLI is in PATH:
win_path.exists:
- name: '{{ install_dir }}'
- require:
- archive: 'Extract flux CLI Archive'

Remove staged flux CLI Archive-File:
file.absent:
- name: '{{ flux_archive }}'
- require:
- archive: 'Extract flux CLI Archive'
17 changes: 17 additions & 0 deletions flux-cli/parameters/os_family/Windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Set values specific to:
# salt['config.get']('os_family') == RedHat.
#
# You just need to add the key:values for this `os_family` that differ
# from `defaults.yaml` + `<osarch>.yaml`.
#
# If you do not need to provide defaults via the `os_family` config,
# you can remove this file or provide at least an empty dict, e.g.
# values: {}
---
values:
pkg:
name: flux-cli-windows
...
11 changes: 0 additions & 11 deletions flux-cli/service/clean.sls

This file was deleted.

5 changes: 0 additions & 5 deletions flux-cli/service/init.sls

This file was deleted.

Loading
Loading