gen-psp.sh 778 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. set -xeEuo pipefail
  3. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
  4. pushd "$SCRIPT_DIR" &>/dev/stderr
  5. PSP_YAML_FILE="$SCRIPT_DIR/../../deploy/examples/psp.yaml"
  6. tmpdir="$(mktemp -d)"
  7. WITHOUT_FILE="${tmpdir}"/without-psp.yaml # intermediate file of yaml that doesn't include PSP
  8. WITH_FILE="${tmpdir}"/with-psp.yaml # intermediate file of yaml that includes previous plus PSP
  9. export ADDITIONAL_HELM_CLI_OPTIONS="--set pspEnable=false"
  10. ./get-helm-rbac.sh >"$WITHOUT_FILE"
  11. export ADDITIONAL_HELM_CLI_OPTIONS="--set pspEnable=true"
  12. ./get-helm-rbac.sh >"$WITH_FILE"
  13. rm -f "$PSP_YAML_FILE"
  14. cat psp.yaml.header >>"$PSP_YAML_FILE"
  15. ./keep-added.sh "$WITHOUT_FILE" "$WITH_FILE" >>"$PSP_YAML_FILE"
  16. rm -rf "$tmpdir"
  17. popd &>/dev/stderr