Skip to content

Commit 7c6fe06

Browse files
authored
Merge pull request #4295 from chaosi-zju/feat-create-cluster
create cluster script support MacOS
2 parents 1d4a95c + 29a4ace commit 7c6fe06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hack/create-cluster.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# This script only fits for Linux, macOS adaptation will come soon
17-
16+
# This script works for both linux and macOS.
1817
set -o errexit
1918
set -o nounset
2019
set -o pipefail
@@ -70,7 +69,7 @@ fi
7069
function rand() {
7170
min=$1
7271
max=$(($2-$min+1))
73-
num=$(date +%s%N)
72+
num=$(date +%s)
7473
echo $(($num%$max+$min))
7574
}
7675

@@ -96,7 +95,8 @@ cp -rf "${REPO_ROOT}"/artifacts/kindClusterConfig/general-config.yaml "${TEMP_PA
9695
sed -i'' -e "s#{{pod_cidr}}#${POD_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
9796
sed -i'' -e "s#{{service_cidr}}#${SERVICE_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
9897

99-
kind_log="$(mktemp --suffix=-kind.log)"
98+
mkdir -p /tmp/kind-log/
99+
kind_log="/tmp/kind-log/$(date +%s)"
100100
echo "Creating cluster \"${CLUSTER_NAME}\" ..."
101101
kind create cluster --name "${CLUSTER_NAME}" --kubeconfig="${KUBECONFIG}" --image="${CLUSTER_VERSION}" --config="${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml > ${kind_log} 2>&1 || (
102102
echo "Creating cluster ${CLUSTER_NAME} failed, see detail log in ${kind_log}."

0 commit comments

Comments
 (0)