-
Notifications
You must be signed in to change notification settings - Fork 871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The kubeconfig maybe overwritten aboout the create_cluster function in hack/scripts #1545
Comments
My question is |
but there is the same ENV enviroment shared in the |
Yeah, I get what you mean. Given the
It's weird that I can see the |
Yeah, you are right!!! Any idea about how to fix it? |
Do you think this works? diff --git a/hack/util.sh b/hack/util.sh
index a3e29f3c..95f752c2 100755
--- a/hack/util.sh
+++ b/hack/util.sh
@@ -356,6 +356,9 @@ function util::create_cluster() {
mkdir -p ${log_path}
rm -rf "${log_path}/${cluster_name}.log"
rm -f "${kubeconfig}"
+ kubectl config --kubeconfig="${kubeconfig}" delete-cluster="${cluster_name}"
+ kubectl config --kubeconfig="${kubeconfig}" delete-context="${cluster_name}"
+ kubectl config --kubeconfig="${kubeconfig}" delete-context="kind-${cluster_name}"
nohup kind delete cluster --name="${cluster_name}" >> "${log_path}"/"${cluster_name}".log 2>&1 && kind create cluster --name "${cluster_name}" --kubeconfig="${kubeconfig}" --image="${kind_image}" --config="${cluster_config}" >> "${log_path}"/"${cluster_name}".log
2>&1 &
echo "Creating cluster ${cluster_name}"
} Or --- a/hack/util.sh
+++ b/hack/util.sh
@@ -355,8 +355,7 @@ function util::create_cluster() {
mkdir -p ${log_path}
rm -rf "${log_path}/${cluster_name}.log"
- rm -f "${kubeconfig}"
- nohup kind delete cluster --name="${cluster_name}" >> "${log_path}"/"${cluster_name}".log 2>&1 && kind create cluster --name "${cluster_name}" --kubeconfig="${kubeconfig}" --image="${kind_image}" --config="${cluster_config}" >> "${log_path}"/"${cluster_name}".log
2>&1 &
+ nohup kind delete cluster --name="${cluster_name}" --kubeconfig="$kubeconfig" >> "${log_path}"/"${cluster_name}".log 2>&1 && kind create cluster --name "${cluster_name}" --kubeconfig="${kubeconfig}" --image="${kind_image}" --config="${cluster_config}" >> "${log_p
ath}"/"${cluster_name}".log 2>&1 &
echo "Creating cluster ${cluster_name}"
}
|
I think both work, perhaps the second is more elegant, since the OS can lock fd (file descriptor) and 「kind」can remove the specified cluster |
Yes, I prefer the second one too. Would you like to send a PR for this? @Charlie17Li |
@RainbowMango Does this slow down local-up-karmada.sh? |
I don't think so. |
/cc @chaosi-zju |
@XiShanYongYe-Chang hello, the issue is over time, actually, the problem has already been fixed by my previous PR #3682 since we now use different kubeconfig path when creating cluster, no longer has conflict~ util::create_cluster "${MEMBER_CLUSTER_1_NAME}" "${MEMBER_CLUSTER_1_TMP_CONFIG}" "${CLUSTER_VERSION}" "${KIND_LOG_FILE}" "${TEMP_PATH}"/member1.yaml
util::create_cluster "${MEMBER_CLUSTER_2_NAME}" "${MEMBER_CLUSTER_2_TMP_CONFIG}" "${CLUSTER_VERSION}" "${KIND_LOG_FILE}" "${TEMP_PATH}"/member2.yaml
util::create_cluster "${PULL_MODE_CLUSTER_NAME}" "${PULL_MODE_CLUSTER_TMP_CONFIG}" "${CLUSTER_VERSION}" "${KIND_LOG_FILE}" |
/close |
@chaosi-zju: You can't close an active issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/close |
@XiShanYongYe-Chang: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Please provide an in-depth description of the question you have:
When I follow the hack/local-up-karmada.sh to create cluster
karmada/hack/local-up-karmada.sh
Lines 102 to 104 in a084c8d
and the create cluster func with 「kind」:
karmada/hack/util.sh
Lines 349 to 361 in a084c8d
the
kubeconfig
is deleted several timesWhat do you think about this question?:
If
member1
is already created whenmember3
is ready to be created, the configuration formember1
is deleted.Then the func will be failed
karmada/hack/util.sh
Line 409 in a084c8d
I think there must be an func to init the environment, if necessary, I can try edit the script
Environment:
The text was updated successfully, but these errors were encountered: