#!/usr/bin/env bash set -euo pipefail WIRE_VALUES="" MAIN_DOMAIN="" NGINX_VALUES="" NAMESPACE="default" CHECK_NGINX=false CREATE_NGINX_VALUES=false WRITE_WIRE_SERVER=false DEBUG=false MULTI_DOMAIN="" need() { command -v "$1" >/dev/null || { echo "ERROR: missing dependency: $1"; exit 2; }; } ok() { echo "OK: $*"; } wire_ok() { if [[ "$DEBUG" == true ]]; then ok "$@" fi } fail() { echo "MISSING/WRONG: $*"; FAILED=$((FAILED + 1)); } usage_error() { echo "ERROR: $*" >&2; exit 2; } require_value() { [[ -n "${2-}" && "${2-}" != -* ]] \ || usage_error "$1 requires a nonempty value, not another option" } set_multi_domain() { require_value '--multi-domain (-d)' "${1-}" [[ -z "$MULTI_DOMAIN" ]] || usage_error "only one multi-ingress domain is allowed per invocation" MULTI_DOMAIN="$1" } usage() { cat </dev/null; then ok "main nginx-ingress-services ingress appears to exist for $MAIN_DOMAIN" else fail "main nginx-ingress-services ingress not found for $MAIN_DOMAIN" cat < "$file" <