Skip to content

Commit

Permalink
Merge pull request #4295 from chaosi-zju/feat-create-cluster
Browse files Browse the repository at this point in the history
create cluster script support MacOS
  • Loading branch information
karmada-bot authored Nov 24, 2023
2 parents 1d4a95c + 29a4ace commit 7c6fe06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hack/create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# 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 nounset
set -o pipefail
Expand Down Expand Up @@ -70,7 +69,7 @@ fi
function rand() {
min=$1
max=$(($2-$min+1))
num=$(date +%s%N)
num=$(date +%s)
echo $(($num%$max+$min))
}

Expand All @@ -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#{{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}\" ..."
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}."
Expand Down

0 comments on commit 7c6fe06

Please sign in to comment.