Last active
October 7, 2025 12:13
-
-
Save Lillecarl/bfab23199ac7251af11e98c36fc6430b to your computer and use it in GitHub Desktop.
Use kluctl deploy --prune
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env fish | |
| # Defined via `source` | |
| function kluapply --description 'Deploy YAML with kluctl' | |
| argparse --ignore-unknown 'd/discriminator=' 'f/file=' -- $argv | |
| or return 1 | |
| set discriminator $_flag_discriminator | |
| set filepath $_flag_file | |
| if test -z "$discriminator" | |
| echo "Error: -d/--discriminator required" >&2 | |
| return 1 | |
| end | |
| set tmpdir (mktemp -d) | |
| set manifests_dir $tmpdir/manifests | |
| mkdir -p $manifests_dir | |
| echo " | |
| targets: | |
| - name: local" >$tmpdir/.kluctl.yaml | |
| echo " | |
| deployments: | |
| - path: manifests" >$tmpdir/deployment.yaml | |
| if not test -t 0 | |
| read -z >$manifests_dir/resources.yaml | |
| else if test -f "$filepath" | |
| cp $filepath $manifests_dir/resources.yaml | |
| else | |
| echo "Error: File not found: $filepath" >&2 | |
| rm -rf $tmpdir | |
| return 1 | |
| end | |
| set command kluctl deploy --target local --discriminator $discriminator --project-dir $tmpdir $argv | |
| echo $command | |
| $command | |
| set exit_code $status | |
| rm -rf $tmpdir | |
| return $exit_code | |
| end | |
| kluapply $argv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment