Skip to content

Commit 76e07e1

Browse files
committed
chore(kubectl): add server-side apply
1 parent 6eb7798 commit 76e07e1

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

install.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,23 @@ EOF
239239
fi
240240
}
241241

242+
function configure_kubectl {
243+
echo -e "\\033[32m---> Start configuring kubectl defaults\\033[0m"
244+
mkdir -p "$HOME/.kube"
245+
cat << EOF > "$HOME/.kube/kuberc"
246+
apiVersion: kubectl.config.k8s.io/v1beta1
247+
kind: Preference
248+
defaults:
249+
# Default to server-side apply
250+
- command: apply
251+
options:
252+
- name: server-side
253+
default: "true"
254+
EOF
255+
chmod 600 "$HOME/.kube/kuberc"
256+
echo -e "\\033[32m---> Kubectl defaults configured (server-side apply enabled)\\033[0m"
257+
}
258+
242259
function configure_k3s_mirrors {
243260
echo -e "\\033[32m---> Start configuring k3s mirrors\\033[0m"
244261
if [[ "${INSTALL_DRYCC_MIRROR}" == "cn" ]] ; then
@@ -254,6 +271,7 @@ function configure_k3s_mirrors {
254271
function install_k3s_server {
255272
configure_os
256273
install_runtime
274+
configure_kubectl
257275
configure_registry
258276
configure_k3s_mirrors
259277
INSTALL_K3S_EXEC="server ${INSTALL_K3S_EXEC} --embedded-registry --flannel-backend=none --disable-network-policy --disable=traefik --disable=servicelb --disable-kube-proxy --cluster-cidr=${CLUSTER_CIDR} --service-cidr=${SERVICE_CIDR}"
@@ -281,6 +299,7 @@ EOF
281299
function install_k3s_agent {
282300
configure_os
283301
install_runtime
302+
configure_kubectl
284303
configure_registry
285304
configure_k3s_mirrors
286305
if [[ -n "${K3S_DATA_DIR}" ]] ; then
@@ -438,7 +457,7 @@ function install_gateway() {
438457

439458
helm repo add istio https://github.com/istio-charts
440459
helm repo update
441-
kubectl apply --server-side -f $gateway_api_url/releases/download/${version}/experimental-install.yaml
460+
kubectl apply -f $gateway_api_url/releases/download/${version}/experimental-install.yaml
442461
helm upgrade --install istio-base istio/base -n istio-system --set defaultRevision=default --create-namespace --wait $options
443462
helm upgrade --install istio-istiod istio/istiod -n istio-system \
444463
--set pilot.env.PILOT_ENABLE_ALPHA_GATEWAY_API=true \

0 commit comments

Comments
 (0)