create cluster script support MacOS
Signed-off-by: chaosi-zju <chaosi@zju.edu.cn>
This commit is contained in:
parent
cf1dbf0e16
commit
29a4ace923
|
@ -13,8 +13,7 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# This script only fits for Linux, macOS adaptation will come soon
|
# This script works for both linux and macOS.
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
@ -70,7 +69,7 @@ fi
|
||||||
function rand() {
|
function rand() {
|
||||||
min=$1
|
min=$1
|
||||||
max=$(($2-$min+1))
|
max=$(($2-$min+1))
|
||||||
num=$(date +%s%N)
|
num=$(date +%s)
|
||||||
echo $(($num%$max+$min))
|
echo $(($num%$max+$min))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +95,8 @@ cp -rf "${REPO_ROOT}"/artifacts/kindClusterConfig/general-config.yaml "${TEMP_PA
|
||||||
sed -i'' -e "s#{{pod_cidr}}#${POD_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
|
sed -i'' -e "s#{{pod_cidr}}#${POD_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
|
||||||
sed -i'' -e "s#{{service_cidr}}#${SERVICE_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
|
sed -i'' -e "s#{{service_cidr}}#${SERVICE_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
|
||||||
|
|
||||||
kind_log="$(mktemp --suffix=-kind.log)"
|
mkdir -p /tmp/kind-log/
|
||||||
|
kind_log="/tmp/kind-log/$(date +%s)"
|
||||||
echo "Creating cluster \"${CLUSTER_NAME}\" ..."
|
echo "Creating cluster \"${CLUSTER_NAME}\" ..."
|
||||||
kind create cluster --name "${CLUSTER_NAME}" --kubeconfig="${KUBECONFIG}" --image="${CLUSTER_VERSION}" --config="${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml > ${kind_log} 2>&1 || (
|
kind create cluster --name "${CLUSTER_NAME}" --kubeconfig="${KUBECONFIG}" --image="${CLUSTER_VERSION}" --config="${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml > ${kind_log} 2>&1 || (
|
||||||
echo "Creating cluster ${CLUSTER_NAME} failed, see detail log in ${kind_log}."
|
echo "Creating cluster ${CLUSTER_NAME} failed, see detail log in ${kind_log}."
|
||||||
|
|
Loading…
Reference in New Issue