fabric-samples/test-network-k8s/scripts/fabric_config.sh
Josh Kneubuhl 551250636d Run the Kube Test Network on Rancher / k3s
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
2022-05-09 13:43:13 -04:00

54 lines
No EOL
1.5 KiB
Bash
Executable file

#!/bin/bash
#
# Copyright IBM Corp All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
#
function init_namespace() {
push_fn "Creating namespace \"$NS\""
kubectl create namespace $NS || true
pop_fn
}
function init_storage_volumes() {
push_fn "Provisioning volume storage"
# odd.
# KIND runs the rancher local-path provider, installing as the storageclass 'standard'
# Rancher runs the local-path provider, installing as the storageclass 'local-path'
#
# When installing to KIND, use the 'standard' storage class.
if [ "${CLUSTER_RUNTIME}" == "kind" ]; then
export STORAGE_CLASS="standard"
elif [ "${CLUSTER_RUNTIME}" == "k3s" ]; then
export STORAGE_CLASS="local-path"
else
echo "Unknown CLUSTER_RUNTIME ${CLUSTER_RUNTIME}"
exit 1
fi
cat kube/pvc-fabric-org0.yaml | envsubst | kubectl -n $NS create -f - || true
cat kube/pvc-fabric-org1.yaml | envsubst | kubectl -n $NS create -f - || true
cat kube/pvc-fabric-org2.yaml | envsubst | kubectl -n $NS create -f - || true
pop_fn
}
function load_org_config() {
push_fn "Creating fabric config maps"
kubectl -n $NS delete configmap org0-config || true
kubectl -n $NS delete configmap org1-config || true
kubectl -n $NS delete configmap org2-config || true
kubectl -n $NS create configmap org0-config --from-file=config/org0
kubectl -n $NS create configmap org1-config --from-file=config/org1
kubectl -n $NS create configmap org2-config --from-file=config/org2
pop_fn
}