diff --git a/policies/policy-install.sh b/policies/policy-install.sh index cc0440a1..7db93b5c 100755 --- a/policies/policy-install.sh +++ b/policies/policy-install.sh @@ -13,9 +13,10 @@ set -x [ $(id -u) -eq 0 ] || exec sudo $0 $@ +K3S=/usr/local/bin/k3s counter=1 -while [[ $(k3s kubectl get namespaces | grep karavi | wc -l) -ne 1 ]] +while [[ $($K3S kubectl get namespaces | grep karavi | wc -l) -ne 1 ]] do if [[ "$counter" -eq 30 ]] then @@ -29,22 +30,22 @@ done cd "$(dirname "$0")" -if [[ $(k3s kubectl get secret karavi-storage-secret -n karavi | grep karavi-storage-secret | wc -l) -ne 1 ]] +if [[ $($K3S kubectl get secret karavi-storage-secret -n karavi | grep karavi-storage-secret | wc -l) -ne 1 ]] then echo "Creating karavi storage secret" - k3s kubectl apply -f ./karavi-storage-secret.yaml + $K3S kubectl apply -f ./karavi-storage-secret.yaml fi -if [[ $(k3s kubectl get configmap common -n karavi | grep common | wc -l) -ne 1 ]] +if [[ $($K3S kubectl get configmap common -n karavi | grep common | wc -l) -ne 1 ]] then - k3s kubectl create configmap common -n karavi --from-file=./common.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - + $K3S kubectl create configmap common -n karavi --from-file=./common.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - fi -k3s kubectl create configmap powermax-volumes-create -n karavi --from-file=./volumes_powermax_create.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap powerscale-volumes-create -n karavi --from-file=./volumes_powerscale_create.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap volumes-create -n karavi --from-file=./volumes_create.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap volumes-delete -n karavi --from-file=./volumes_delete.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap volumes-unmap -n karavi --from-file=./volumes_unmap.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap volumes-map -n karavi --from-file=./volumes_map.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap powerflex-urls -n karavi --from-file=./url.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap powermax-urls -n karavi --from-file=./powermax_url.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - -k3s kubectl create configmap powerscale-urls -n karavi --from-file=./powerscale_url.rego --save-config --dry-run=client -o yaml | k3s kubectl apply -f - +$K3S kubectl create configmap powermax-volumes-create -n karavi --from-file=./volumes_powermax_create.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap powerscale-volumes-create -n karavi --from-file=./volumes_powerscale_create.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap volumes-create -n karavi --from-file=./volumes_create.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap volumes-delete -n karavi --from-file=./volumes_delete.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap volumes-unmap -n karavi --from-file=./volumes_unmap.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap volumes-map -n karavi --from-file=./volumes_map.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap powerflex-urls -n karavi --from-file=./url.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap powermax-urls -n karavi --from-file=./powermax_url.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f - +$K3S kubectl create configmap powerscale-urls -n karavi --from-file=./powerscale_url.rego --save-config --dry-run=client -o yaml | $K3S kubectl apply -f -