mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
feat: print etcd ready status
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
12fc215656
commit
e6d6d8e14c
@ -34,6 +34,7 @@ import (
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
@ -229,6 +230,16 @@ func getRawEtcdEndpointsFromPodAnnotationWithoutRetry(client clientset.Interface
|
||||
}
|
||||
etcdEndpoints := []string{}
|
||||
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]
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user