kopeio / etcd-manager

operator for etcd: moved to https://github.com/kubernetes-sigs/etcdadm
Apache License 2.0
164 stars 45 forks source link

Use next attachment point when device already in use #323

Closed hakman closed 4 years ago

hakman commented 4 years ago

Trying to attach volumes with same device names adds unnecessary delays. With this fix, kube-apiserver starts in less than a minute after NodeUp finishes.

Fixes #217

hakman commented 4 years ago
I0505 15:16:54.605527    8984 volumes.go:86] AWS API Request: ec2metadata/GetToken
I0505 15:16:54.606897    8984 volumes.go:86] AWS API Request: ec2metadata/GetDynamicData
I0505 15:16:54.608283    8984 volumes.go:86] AWS API Request: ec2metadata/GetMetadata
I0505 15:16:54.609035    8984 volumes.go:86] AWS API Request: ec2metadata/GetMetadata
I0505 15:16:54.609834    8984 volumes.go:86] AWS API Request: ec2metadata/GetMetadata
I0505 15:16:54.614547    8984 main.go:279] Mounting available etcd volumes matching tags [k8s.io/etcd/events k8s.io/role/master=1 kubernetes.io/cluster/k8s.test.com=owned]; nameTag=k8s.io/etcd/events
I0505 15:16:54.616581    8984 volumes.go:86] AWS API Request: ec2/DescribeVolumes
I0505 15:16:54.829148    8984 mounter.go:294] Trying to mount master volume: "vol-0c276c2e24d65df14"
I0505 15:16:54.829310    8984 volumes.go:86] AWS API Request: ec2/AttachVolume
W0505 15:16:55.102292    8984 volumes.go:341] Invalid value '/dev/xvdu' for unixDevice. Attachment point /dev/xvdu is already in use
I0505 15:16:55.102394    8984 volumes.go:86] AWS API Request: ec2/AttachVolume
I0505 15:16:55.412977    8984 volumes.go:347] AttachVolume request returned {
  AttachTime: 2020-05-05 15:16:55.384 +0000 UTC,
  Device: "/dev/xvdv",
  InstanceId: "i-08d1d1f8a9ebe3409",
  State: "attaching",
  VolumeId: "vol-0c276c2e24d65df14"
}
I0505 15:16:55.413125    8984 volumes.go:86] AWS API Request: ec2/DescribeVolumes
I0505 15:16:55.537078    8984 mounter.go:308] Currently attached volumes: [0xc0002b0000]
I0505 15:16:55.537099    8984 mounter.go:72] Master volume "vol-0c276c2e24d65df14" is attached at "/dev/xvdv"
hakman commented 4 years ago

CC @justinsb

justinsb commented 4 years ago

Some nits for more verbose logging and comments, but this looks good - thank you!

/approve /lgtm