@@ -90,6 +90,33 @@ function install_helm {
9090 echo -e " \\ 033[32m---> crun runtime install completed!\\ 033[0m"
9191}
9292
93+ function helm_upgrade {
94+ local max_retries=${HELM_MAX_RETRIES:- 3}
95+ local retry_interval=${HELM_RETRY_INTERVAL:- 10}
96+ local has_timeout=false
97+ for arg in " $@ " ; do
98+ if [[ " $arg " == " --timeout" ]]; then
99+ has_timeout=true
100+ break
101+ fi
102+ done
103+ local timeout_args=()
104+ if [[ " $has_timeout " == " false" ]]; then
105+ timeout_args=(--timeout 10m0s)
106+ fi
107+ for (( attempt= 1 ; attempt<= max_retries; attempt++ )) ; do
108+ if helm upgrade --install " $@ " " ${timeout_args[@]} " ; then
109+ return 0
110+ fi
111+ if [[ $attempt -lt $max_retries ]]; then
112+ echo -e " \\ 033[33m---> Warning: helm upgrade --install failed (attempt $attempt /$max_retries ), retrying in ${retry_interval} s...\\ 033[0m"
113+ sleep " $retry_interval "
114+ fi
115+ done
116+ echo -e " \\ 033[31m---> Error: helm upgrade --install failed after $max_retries attempts\\ 033[0m"
117+ return 1
118+ }
119+
93120function configure_os {
94121 echo -e " \\ 033[32m---> Start configuring kernel parameters\\ 033[0m"
95122 if [[ " $( command -v iptables) " != " " ]] ; then
@@ -151,9 +178,9 @@ function install_kata_runtime {
151178
152179 curl -fL " ${kata_download_url} " -o ${kata_package}
153180 tar -I zstd -xf ${kata_package} -C /
154- ln -s /opt/kata/bin/containerd-shim-kata-v2 /usr/local/bin/containerd-shim-kata-v2
155- ln -s /opt/kata/bin/kata-collect-data.sh /usr/local/bin/kata-collect-data.sh
156- ln -s /opt/kata/bin/kata-runtime /usr/local/bin/kata-runtime
181+ ln -sf /opt/kata/bin/containerd-shim-kata-v2 /usr/local/bin/containerd-shim-kata-v2
182+ ln -sf /opt/kata/bin/kata-collect-data.sh /usr/local/bin/kata-collect-data.sh
183+ ln -sf /opt/kata/bin/kata-runtime /usr/local/bin/kata-runtime
157184 rm -rf ${kata_package}
158185 echo -e " \\ 033[32m---> Kata runtime install completed!\\ 033[0m"
159186}
209236
210237function configure_registry {
211238 if [[ " ${INSTALL_DRYCC_MIRROR} " == " cn" ]]; then
212- cat << EOF >> "${REGISTRY_CONFIG_FILE} "
239+ cat << EOF > "${REGISTRY_CONFIG_FILE} "
213240mirrors:
214241 docker.io:
215242 endpoint:
@@ -310,7 +337,7 @@ function install_longhorn {
310337 helm repo update
311338 if [[ -z " ${LONGHORN_CONFIG_FILE} " ]] ; then
312339 echo -e " \\ 033[32m---> Longhorn using the default configuration.\\ 033[0m"
313- helm upgrade --install longhorn longhorn/longhorn \
340+ helm_upgrade longhorn longhorn/longhorn \
314341 --set csi.attacherReplicaCount=1 \
315342 --set csi.provisionerReplicaCount=1 \
316343 --set csi.resizerReplicaCount=1 \
@@ -321,7 +348,7 @@ function install_longhorn {
321348 --namespace longhorn-system \
322349 --create-namespace $options --wait
323350 else
324- helm upgrade --install longhorn longhorn/longhorn -f " ${LONGHORN_CONFIG_FILE} " --wait
351+ helm_upgrade longhorn longhorn/longhorn -f " ${LONGHORN_CONFIG_FILE} " --wait
325352 fi
326353 echo -e " \\ 033[32m---> Longhorn install completed!\\ 033[0m"
327354}
@@ -342,7 +369,7 @@ function install_mountpoint {
342369 | grep -E ' ^v[0-9]+\.[0-9]+\.[0-9]+$' \
343370 | sort -Vr \
344371 | head -1)
345- helm upgrade --install aws-mountpoint-s3-csi-driver aws-mountpoint-s3-csi-driver/aws-mountpoint-s3-csi-driver \
372+ helm_upgrade aws-mountpoint-s3-csi-driver aws-mountpoint-s3-csi-driver/aws-mountpoint-s3-csi-driver \
346373 --set supportLegacySystemDMounts=false \
347374 --set image.repository=registry.drycc.cc/drycc/mountpoint-s3-csi-driver \
348375 --set image.tag=${version# v} \
@@ -370,7 +397,7 @@ function install_network() {
370397 options=${1:- " " }
371398 echo -e " \\ 033[32m---> Start install network...\\ 033[0m"
372399 kubernetes_service_host=(` ip -o route get to 8.8.8.8 | sed -n ' s/.*src \([0-9.]\+\).*/\1/p' ` )
373- helm upgrade --install cilium $CHARTS_URL /cilium \
400+ helm_upgrade cilium $CHARTS_URL /cilium \
374401 --set endpointHealthChecking.enabled=false \
375402 --set healthChecking=false \
376403 --set operator.replicas=1 \
@@ -395,7 +422,7 @@ function install_metallb() {
395422 check_metallb
396423 options=${1:- " " }
397424 echo -e " \\ 033[32m---> Start install metallb...\\ 033[0m"
398- helm upgrade --install metallb $CHARTS_URL /metallb \
425+ helm_upgrade metallb $CHARTS_URL /metallb \
399426 --set speaker.frr.enabled=true \
400427 --namespace metallb \
401428 --create-namespace $options --wait
@@ -440,12 +467,12 @@ function install_gateway() {
440467 helm repo add istio https://github.com/istio-charts
441468 helm repo update
442469 kubectl apply -f $gateway_api_url /releases/download/${version} /experimental-install.yaml
443- helm upgrade --install istio-base istio/base -n istio-system --set defaultRevision=default --create-namespace --wait $options
444- helm upgrade --install istio-istiod istio/istiod -n istio-system \
470+ helm_upgrade istio-base istio/base -n istio-system --set defaultRevision=default --create-namespace --wait $options
471+ helm_upgrade istio-istiod istio/istiod -n istio-system \
445472 --set pilot.env.PILOT_ENABLE_ALPHA_GATEWAY_API=true \
446473 --set pilot.env.PILOT_ENABLE_QUIC_LISTENERS=true \
447474 --wait $options
448- helm upgrade --install istio-gateway istio/gateway -n istio-gateway \
475+ helm_upgrade istio-gateway istio/gateway -n istio-gateway \
449476 --set service.type=ClusterIP \
450477 --create-namespace --wait $options
451478 echo -e " \\ 033[32m---> Gateway install completed!\\ 033[0m"
@@ -454,7 +481,7 @@ function install_gateway() {
454481function install_cert_manager() {
455482 options=${1:- " " }
456483 echo -e " \\ 033[32m---> Start install cert-manager...\\ 033[0m"
457- helm upgrade --install cert-manager $CHARTS_URL /cert-manager \
484+ helm_upgrade cert-manager $CHARTS_URL /cert-manager \
458485 --namespace cert-manager \
459486 --create-namespace \
460487 --set clusterResourceNamespace=drycc \
@@ -476,7 +503,7 @@ function install_catalog() {
476503
477504 options=${1:- " " }
478505 echo -e " \\ 033[32m---> Start install catalog...\\ 033[0m"
479- helm upgrade --install catalog $CHARTS_URL /catalog \
506+ helm_upgrade catalog $CHARTS_URL /catalog \
480507 --set asyncBindingOperationsEnabled=true \
481508 --set image=registry.drycc.cc/drycc-addons/service-catalog:${service_catalog_version# v} \
482509 --namespace catalog \
667694 export VICTORIAMETRICS_CONFIG_FILE
668695 fi
669696
670- helm upgrade --install drycc $CHARTS_URL /workflow \
697+ helm_upgrade drycc $CHARTS_URL /workflow \
671698 --namespace drycc \
672699 --values /tmp/drycc-values.yaml \
673700 --values /tmp/drycc-mirror-values.yaml \
@@ -694,12 +721,12 @@ function install_helmbroker {
694721
695722 options=${1:- " " }
696723 local VALKEY_PASSWORD=$( kubectl get secrets -n drycc valkey-creds -o jsonpath=" {.data.password}" | base64 -d)
697- local HELMBROKER_USERNAME=${HELMBROKER_USERNAME:- $(cat / proc/ sys/ kernel/ random/ uuid)}
698- local HELMBROKER_PASSWORD=${HELMBROKER_PASSWORD:- $(cat / proc/ sys/ kernel/ random/ uuid)}
724+ local HELMBROKER_USERNAME=${HELMBROKER_USERNAME:- $(kubectl get secrets -n drycc-helmbroker helmbroker-creds -o jsonpath= " {.data.username} " 2> / dev / null | base64 -d || cat / proc/ sys/ kernel/ random/ uuid)}
725+ local HELMBROKER_PASSWORD=${HELMBROKER_PASSWORD:- $(kubectl get secrets -n drycc-helmbroker helmbroker-creds -o jsonpath= " {.data.password} " 2> / dev / null | base64 -d || cat / proc/ sys/ kernel/ random/ uuid)}
699726
700727 echo -e " \\ 033[32m---> Start install helmbroker...\\ 033[0m"
701728
702- helm upgrade --install helmbroker $CHARTS_URL /helmbroker \
729+ helm_upgrade helmbroker $CHARTS_URL /helmbroker \
703730 --set valkey.enabled=false \
704731 --set gateway.gatewayClass=${GATEWAY_CLASS} \
705732 --set global.platformDomain=${PLATFORM_DOMAIN} \
0 commit comments