diff --git a/helm-poc/README.md b/helm-poc/README.md new file mode 100644 index 0000000..bdd0a2d --- /dev/null +++ b/helm-poc/README.md @@ -0,0 +1,7 @@ +# Notes + +Patch was generated with: + +```sh +diff -ruN kube-prometheus-stack.orig kube-prometheus-stack.new > ../patches/kube-prometheus-stack.patch +``` diff --git a/helm-poc/default.nix b/helm-poc/default.nix index f3dfe61..270eed8 100644 --- a/helm-poc/default.nix +++ b/helm-poc/default.nix @@ -10,6 +10,9 @@ let version = "57.0.3"; url = "https://github.com/prometheus-community/helm-charts/releases/download/${name}-${version}/${name}-${version}.tgz"; hash = "sha256-oZNaFSfFR2dtf5IMUQ0CnXQeVLvoW22JdRqMmgmdtTs="; + patches = [ + ./patches/kube-prometheus-stack.patch + ]; } rec { name = "cert-manager"; diff --git a/helm-poc/nix/helm.nix b/helm-poc/nix/helm.nix index d0670af..e2dbd29 100644 --- a/helm-poc/nix/helm.nix +++ b/helm-poc/nix/helm.nix @@ -4,9 +4,16 @@ , lib ? pkgs.lib }: let - mkHelm = { name, version, url, hash ? lib.fakeSha256 }: + mkHelm = { + name, + version, + url, + hash ? lib.fakeSha25, + namespace ? "", + patches ? [] + }: pkgs.stdenv.mkDerivation { - inherit name; + inherit name patches; src = pkgs.fetchurl { inherit url hash; @@ -14,13 +21,18 @@ let phases = [ "unpackPhase" + "patchPhase" "build" ]; + namespace = if namespace != "" then "--namespace ${namespace}" else ""; + build = '' mkdir -p $out - ${helm} template ${name} ./ > $out/${name}-${version}.yaml - #${helm} version > $out/README + ${helm} template \ + --namespace ${namespace} \ + ${name} ./ > $out/${name}-${version}.yaml + ${helm} version > $out/VERSION ''; }; diff --git a/helm-poc/patches/kube-prometheus-stack.patch b/helm-poc/patches/kube-prometheus-stack.patch new file mode 100644 index 0000000..e49f05c --- /dev/null +++ b/helm-poc/patches/kube-prometheus-stack.patch @@ -0,0 +1,11 @@ +diff '--color=auto' -ruN kube-prometheus-stack.orig/templates/alertmanager/alertmanager.yaml kube-prometheus-stack.new/templates/alertmanager/alertmanager.yaml +--- kube-prometheus-stack.orig/templates/alertmanager/alertmanager.yaml 2024-03-14 23:04:27.000000000 +0100 ++++ kube-prometheus-stack.new/templates/alertmanager/alertmanager.yaml 2024-03-21 21:35:56.775410551 +0100 +@@ -1,6 +1,6 @@ + {{- if .Values.alertmanager.enabled }} + apiVersion: monitoring.coreos.com/v1 +-kind: Alertmanager ++kind: Alertmanager # Patch Testaroo + metadata: + name: {{ template "kube-prometheus-stack.alertmanager.crname" . }} + namespace: {{ template "kube-prometheus-stack.namespace" . }}