feat: print etcd ready status
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
		| @@ -34,6 +34,7 @@ import ( | |||||||
| 	clientv3 "go.etcd.io/etcd/client/v3" | 	clientv3 "go.etcd.io/etcd/client/v3" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
|  |  | ||||||
|  | 	corev1 "k8s.io/api/core/v1" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/util/wait" | 	"k8s.io/apimachinery/pkg/util/wait" | ||||||
| 	clientset "k8s.io/client-go/kubernetes" | 	clientset "k8s.io/client-go/kubernetes" | ||||||
| @@ -229,6 +230,16 @@ func getRawEtcdEndpointsFromPodAnnotationWithoutRetry(client clientset.Interface | |||||||
| 	} | 	} | ||||||
| 	etcdEndpoints := []string{} | 	etcdEndpoints := []string{} | ||||||
| 	for _, pod := range podList.Items { | 	for _, pod := range podList.Items { | ||||||
|  | 		podIsReady := false | ||||||
|  | 		for _, c := range pod.Status.Conditions { | ||||||
|  | 			if c.Type == corev1.PodReady && c.Status == corev1.ConditionTrue { | ||||||
|  | 				podIsReady = true | ||||||
|  | 				break | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		if !podIsReady { | ||||||
|  | 			klog.V(3).Infof("etcd pod %q is not ready", pod.ObjectMeta.Name) | ||||||
|  | 		} | ||||||
| 		etcdEndpoint, ok := pod.ObjectMeta.Annotations[constants.EtcdAdvertiseClientUrlsAnnotationKey] | 		etcdEndpoint, ok := pod.ObjectMeta.Annotations[constants.EtcdAdvertiseClientUrlsAnnotationKey] | ||||||
| 		if !ok { | 		if !ok { | ||||||
| 			klog.V(3).Infof("etcd Pod %q is missing the %q annotation; cannot infer etcd advertise client URL using the Pod annotation", pod.ObjectMeta.Name, constants.EtcdAdvertiseClientUrlsAnnotationKey) | 			klog.V(3).Infof("etcd Pod %q is missing the %q annotation; cannot infer etcd advertise client URL using the Pod annotation", pod.ObjectMeta.Name, constants.EtcdAdvertiseClientUrlsAnnotationKey) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 yxxhero
					yxxhero