feat: initial helm integration (thanks to @matejc)

helm2json was first implemented by matejc in
https://github.com/matejc/helm2json and incorperated in this project,
big thanks to @matejc for making this possible
This commit is contained in:
Jaka Hudoklin 2019-02-28 13:17:40 +01:00
parent a5f9639258
commit ba1144a8df
No known key found for this signature in database
GPG key ID: 6A08896BFD32BD95
7 changed files with 296 additions and 0 deletions

48
helm/fetchhelm.nix Normal file
View file

@ -0,0 +1,48 @@
{ stdenvNoCC, lib, kubernetes-helm, cacert }:
let
cleanName = name: lib.replaceStrings ["/"] ["-"] name;
in {
# name of the chart
chart
# chart url to fetch from custom location
, chartUrl ? null
# version of the chart
, version ? null
# chart hash
, sha256
# whether to extract chart
, untar ? true
# use custom charts repo
, repo ? null
# pass --verify to helm chart
, verify ? false
# pass --devel to helm chart
, devel ? false }: stdenvNoCC.mkDerivation {
name = "${cleanName chart}-${if version == null then "dev" else version}";
buildCommand = ''
export HOME="$PWD"
helm init --client-only >/dev/null
${if repo == null then "" else "helm repo add repository ${repo}"}
helm fetch -d ./chart \
${if untar then "--untar" else ""} \
${if version == null then "" else "--version ${version}"} \
${if devel then "--devel" else ""} \
${if verify then "--verify" else ""} \
${if chartUrl == null then (if repo == null then chart else "repository/${chart}") else chartUrl}
cp -r chart/*/ $out
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = sha256;
nativeBuildInputs = [ kubernetes-helm cacert ];
}