#!/bin/sh # Apply the facility manifest without undoing an off switch (MAS-WP-0007). # A missing power annotation is on. Refuses to apply when the namespace # annotation cannot be read. set -eu cd "$(dirname "$0")" if [ "$#" -ne 1 ]; then echo "usage: apply.sh IMAGE" >&2 exit 2 fi image=$1 if ! power=$(kubectl get namespace mas \ -o jsonpath='{.metadata.annotations.mas\.coulomb\.social/power}'); then echo "cannot read namespace mas; refusing to apply" >&2 exit 1 fi if [ -z "$power" ]; then power=on fi python3 ./facility.py render "$image" "$power" < manifests.yaml | kubectl apply -f -