From e70c5497b92cf4f0dd11bf2bef89f4301596ea67 Mon Sep 17 00:00:00 2001 From: Tom Dohrmann Date: Fri, 6 Sep 2024 11:53:15 +0200 Subject: [PATCH] scripts: use different genpolicy depending on platform --- packages/scripts.nix | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/scripts.nix b/packages/scripts.nix index d0082fc8a9..eb7f9585cc 100644 --- a/packages/scripts.nix +++ b/packages/scripts.nix @@ -156,7 +156,6 @@ runtimeInputs = with pkgs; [ yq-go contrast - microsoft.genpolicy ]; text = '' imageRef=$1 @@ -169,9 +168,24 @@ resourcegen --platform "$platform" --image-replacements "$tmpdir/image-replacements.txt" --add-load-balancers coordinator > "$tmpdir/coordinator_base.yml" pushd "$tmpdir" >/dev/null - cp ${pkgs.microsoft.genpolicy.rules-coordinator}/genpolicy-rules.rego rules.rego - cp ${pkgs.microsoft.genpolicy.settings-coordinator}/genpolicy-settings.json . - genpolicy < "$tmpdir/coordinator_base.yml" + + case $platform in + "aks-clh-snp") + cp ${pkgs.microsoft.genpolicy.rules-coordinator}/genpolicy-rules.rego rules.rego + cp ${pkgs.microsoft.genpolicy.settings-coordinator}/genpolicy-settings.json . + ${pkgs.microsoft.genpolicy}/bin/genpolicy < "$tmpdir/coordinator_base.yml" + ;; + "k3s-qemu-snp"|"k3s-qemu-tdx"|"rke2-qemu-tdx") + cp ${pkgs.kata.genpolicy.rules}/genpolicy-rules.rego rules.rego + cp ${pkgs.kata.genpolicy.settings}/genpolicy-settings.json . + ${pkgs.kata.genpolicy}/bin/genpolicy < "$tmpdir/coordinator_base.yml" + ;; + *) + echo "Unsupported platform: {{ platform }}" + exit 1 + ;; + esac + popd >/dev/null ''; };