#!/usr/bin/env bash
# shellcheck disable=SC2155
set -eo pipefail

# Scores live manifests using the same resource and policy context as Kubescape.

readonly KUBE_SCORE_IGNORE_TEST="deployment-has-host-podantiaffinity,deployment-replicas"
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

manifests="$("$SCRIPT_DIR/manifests" "$@")"
printf '%s\n' "$manifests" \
  | kube-score score --ignore-test "$KUBE_SCORE_IGNORE_TEST" -
