Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yurrriq/helm-outdated

A Helm plugin to list outdated subcharts
https://github.com/yurrriq/helm-outdated

dependency-management helm helm-plugin kubernetes outdated-dependencies

Last synced: 17 days ago
JSON representation

A Helm plugin to list outdated subcharts

Awesome Lists containing this project

README

        

* helm-outdated
** Dependencies
- [[https://helm.sh/][Helm]] (obviously)
- (GNU) awk
- [[https://yq.readthedocs.io/][yq]]
- Optional (for ~make install~): [[https://www.gnu.org/software/stow/][GNU Stow]]

** Script
:PROPERTIES:
:header-args: :tangle outdated.sh
:END:

Be safer.
#+BEGIN_SRC sh :shebang "#! /usr/bin/env bash"
set -euo pipefail
#+END_SRC

Iterate through each dependency, and determine if it's outdated.
#+BEGIN_SRC sh
while IFS= read -r dependency; do
subchart="${dependency%-*}"
current="${dependency##*-}"
latest=$(helm inspect chart "$subchart" | yq -r '.version')

if [ "$current" == "$latest" ]; then
printf "%s is up to date.\\n" "$subchart"
else
printf "Consider upgrading %s: %s -> %s.\\n" \
"$subchart" "$current" "$latest"
fi
done < <(helm dep list \
| grep -v WARNING \
| tail -n+2 | head -n-1 | sort -u \
| awk '{ sub("@","",$3); printf "%s/%s-%s\n", $3, $1, $2; }')
#+END_SRC
** Metadata
#+BEGIN_SRC yaml :tangle plugin.yaml :padline no
name: outdated
version: 0.0.5
usage: list outdated subcharts
description: |-
A Helm plugin to list outdated subcharts
command: "$HELM_PLUGIN_DIR/outdated.sh"
#+END_SRC
** Installation
:PROPERTIES:
:header-args: :tangle Makefile :padline no
:END:

The default target, =install=, is phony.
#+BEGIN_SRC makefile
.DEFAULT: install
.PHONY: install
#+END_SRC

The =install= target tangles [[./README.org][README.org]], creates the target directory if
missing, and uses [[https://www.gnu.org/software/stow/][GNU Stow]] to install the plugin.
#+BEGIN_SRC makefile
install: README.org
@ emacs --batch --quick \
--load ob-tangle \
--eval '(setq org-src-preserve-indentation t)' \
--eval '(org-babel-tangle-file "$<")'
@ mkdir -p "$${HELM_HOME:-$$HOME/.helm}/plugins/outdated"
@ stow -t "$${HELM_HOME:-$$HOME/.helm}/plugins/outdated" .
#+END_SRC

** Stow Ignore List
#+BEGIN_SRC txt :tangle .stow-local-ignore :padline no
\.DS_Store
\.git
Makefile
README\.org
#+END_SRC