mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Fix kube2sky flakes. Fix tools.GetEtcdVersion to work with etcd > 2.0.7
This commit is contained in:
@@ -106,7 +106,7 @@ func mutateEtcdOrDie(mutator func() error) {
|
||||
func newEtcdClient() (client *etcd.Client) {
|
||||
maxConnectRetries := 12
|
||||
for maxConnectRetries > 0 {
|
||||
if _, _, err := tools.GetEtcdVersion(*etcd_server); err != nil {
|
||||
if _, err := tools.GetEtcdVersion(*etcd_server); err != nil {
|
||||
log.Fatalf("Failed to connect to etcd server: %v, error: %v", *etcd_server, err)
|
||||
if maxConnectRetries > 0 {
|
||||
log.Println("Retrying request after 5 second sleep.")
|
||||
@@ -120,13 +120,25 @@ func newEtcdClient() (client *etcd.Client) {
|
||||
break
|
||||
}
|
||||
}
|
||||
client = etcd.NewClient([]string{*etcd_server})
|
||||
if client == nil {
|
||||
return nil
|
||||
// loop until we have > 0 machines && machines[0] != ""
|
||||
timeout := false
|
||||
go func() {
|
||||
<-time.After(10 * time.Second)
|
||||
timeout = true
|
||||
}()
|
||||
for !timeout {
|
||||
client = etcd.NewClient([]string{*etcd_server})
|
||||
if client == nil {
|
||||
return nil
|
||||
}
|
||||
client.SyncCluster()
|
||||
machines := client.GetCluster()
|
||||
if len(machines) > 0 && len(machines[0]) > 0 {
|
||||
return client
|
||||
}
|
||||
}
|
||||
client.SyncCluster()
|
||||
|
||||
return client
|
||||
log.Fatal("Timed out waiting for correct response from etcd server")
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: evaluate using pkg/client/clientcmd
|
||||
|
@@ -21,15 +21,17 @@ desiredState:
|
||||
dnsPolicy: "Default" # Don't use cluster DNS.
|
||||
containers:
|
||||
- name: etcd
|
||||
image: quay.io/coreos/etcd:v2.0.3
|
||||
image: gcr.io/google_containers/etcd:2.0.9
|
||||
command: [
|
||||
# entrypoint = "/etcd",
|
||||
"-listen-client-urls=http://0.0.0.0:2379,http://0.0.0.0:4001",
|
||||
"/usr/local/bin/etcd",
|
||||
"--addr",
|
||||
"127.0.0.1:4001",
|
||||
"--bind-addr",
|
||||
"127.0.0.1:4001",
|
||||
"-initial-cluster-token=skydns-etcd",
|
||||
"-advertise-client-urls=http://127.0.0.1:4001",
|
||||
]
|
||||
- name: kube2sky
|
||||
image: gcr.io/google_containers/kube2sky:1.2
|
||||
image: gcr.io/google_containers/kube2sky:1.3
|
||||
volumeMounts:
|
||||
- name: dns-token
|
||||
mountPath: /etc/dns_token
|
||||
|
Reference in New Issue
Block a user