diff --git a/api/v1alpha1/backup_types.go b/api/v1alpha1/backup_types.go index a1237f5de..0c8502edb 100644 --- a/api/v1alpha1/backup_types.go +++ b/api/v1alpha1/backup_types.go @@ -31,7 +31,7 @@ type BackupSpec struct { // To specify the image that will be used for sidecar container. // +optional - // +kubebuilder:default:="radondb/mysql-sidecar:0.1.88" + // +kubebuilder:default:="radondb/mysql-sidecar:latest" Image string `json:"image"` // HostName represents the host for which to take backup diff --git a/cluster/syncer/statefulset.go b/cluster/syncer/statefulset.go index 23a98f171..4853d256c 100644 --- a/cluster/syncer/statefulset.go +++ b/cluster/syncer/statefulset.go @@ -510,6 +510,13 @@ func (s *StatefulSetSyncer) applyNWait(ctx context.Context, pod *corev1.Pod) err return true, nil } + // Because of PDB, minAvaliable 50%, if Spec Replicas is 5, sfs Spec first be set to 3, then to be set 5 + // pod healthy is yes,but controller-revision-hash will never correct, it must return,otherwise wait for 2 hours. + // https://kubernetes.io/zh/docs/tasks/run-application/configure-pdb/ + if pod.ObjectMeta.Labels["healthy"] == "yes" && + pod.ObjectMeta.Labels["controller-revision-hash"] != s.sfs.Status.UpdateRevision { + return false, fmt.Errorf("pod %s is ready, wait next schedule", pod.Name) + } return false, nil }) } diff --git a/sidecar/config.go b/sidecar/config.go index b3eae4760..8a08c9f30 100644 --- a/sidecar/config.go +++ b/sidecar/config.go @@ -459,7 +459,7 @@ done i=0 while [ $i -lt %d ]; do if [ $i -ne %d ]; then - while true; do + for k in $(seq 12); do res=$(curl -i -X POST -d '{"address": "%s-'$i'.%s.%s:%d"}' -u root:%s http://%s:%d/v1/cluster/add) code=$(echo $res|grep "HTTP"|awk '{print $2}') if [ "$code" -eq "200" ]; then @@ -467,7 +467,7 @@ while [ $i -lt %d ]; do fi done - while true; do + for k in $(seq 12); do res=$(curl -i -X POST -d '{"address": "%s:%d"}' -u root:%s http://%s-$i.%s.%s:%d/v1/cluster/add) code=$(echo $res|grep "HTTP"|awk '{print $2}') if [ "$code" -eq "200" ]; then