Skip to content
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

[pull] main from kosmos-io:main #23

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions hack/k8s-in-k8s/kubelet_node_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ EOL
}

function install_lvscare_lb() {
echo "exec(1/6): get port of apiserver...."
echo "exec(1/7): get port of apiserver...."

PORT=$(grep 'server:' "${PATH_KUBERNETES}/${KUBELET_KUBE_CONFIG_NAME}" | awk -F '[:/]' '{print $NF}')

Expand All @@ -584,7 +584,7 @@ function install_lvscare_lb() {
fi

# Start generating kube-lvscare.yaml
echo "exec(2/6): generate kube-lvscare.yaml...."
echo "exec(2/7): generate kube-lvscare.yaml...."

cat <<EOL > $PATH_KUBERNETES/manifests/kube-lvscare.yaml
apiVersion: v1
Expand Down Expand Up @@ -639,25 +639,33 @@ EOL
status: {}
EOL

echo "exec(3/6): restart static pod"
echo "exec(3/7): restart static pod"
mv "${PATH_KUBERNETES}/manifests/kube-lvscare.yaml" "${PATH_KUBERNETES}/kube-lvscare.yaml"
sleep 2
mv "${PATH_KUBERNETES}/kube-lvscare.yaml" "${PATH_KUBERNETES}/manifests/kube-lvscare.yaml"

echo "exec(4/6): wait lvscare ready"
echo "exec(4/7): wait lvscare ready"
if wait_api_server_proxy_ready; then
echo "lvscare is ready"
else
echo "lvscare is not ready"
exit 1
fi

echo "exec(5/6): update kubelet.conf"
echo "exec(5/7): update kubelet.conf"
cp "${PATH_KUBERNETES}/${KUBELET_KUBE_CONFIG_NAME}" "${PATH_KUBERNETES}/${KUBELET_KUBE_CONFIG_NAME}.bak"
sed -i "s|server: .*|server: https://${LOCAL_IP}:${LOCAL_PORT}|" "${PATH_KUBERNETES}/${KUBELET_KUBE_CONFIG_NAME}"
sed -i 's|certificate-authority-data: .*|insecure-skip-tls-verify: true|' "${PATH_KUBERNETES}/${KUBELET_KUBE_CONFIG_NAME}"
sed -i "s|server: .*|server: https://apiserver.virtual-cluster-system.svc:${LOCAL_PORT}|" "${PATH_KUBERNETES}/${KUBELET_KUBE_CONFIG_NAME}"

echo "exec(6/7): update /etc/hosts"
local_record="${LOCAL_IP} apiserver.virtual-cluster-system.svc"
if grep -qFx "$local_record" /etc/hosts; then
echo "Record $local_record already exists in /etc/hosts."
else
sed -i "1i $local_record" /etc/hosts
echo "Record $local_record inserted into /etc/hosts."
fi

echo "exec(6/6): restart kubelet"
echo "exec(7/7): restart kubelet"
systemctl restart kubelet
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kubenest/constants/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
CertificateValidity = time.Hour * 24 * 365 * 100
CaCertAndKeyName = "ca"
VirtualClusterCertAndKeyName = "virtualCluster"
VirtualClusterSystemNamespace = "virtualCluster-system"
VirtualClusterSystemNamespace = "virtual-cluster-system"
ApiserverCertAndKeyName = "apiserver"
EtcdCaCertAndKeyName = "etcd-ca"
EtcdServerCertAndKeyName = "etcd-server"
Expand Down
Loading