Skip to content

Commit

Permalink
arm is not ready even config is persisted. removes race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
mjudeikis committed Apr 2, 2019
1 parent 2b81b7e commit 782bf12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/monitoring/monitoring.go
Expand Up @@ -73,6 +73,7 @@ func (m *monitor) init(ctx context.Context, log *logrus.Entry) error {
func (m *monitor) listResourceGroupMonitoringHostnames(ctx context.Context, subscriptionID, resourceGroup string) (hostnames []string, err error) {
// get dedicated routes we want to monitor
m.log.Debug("waiting for OpenShiftManagedCluster config to be persisted")
hostnames = []string{}
for {
oc, err := loadOCConfig()
if err != nil {
Expand All @@ -84,10 +85,9 @@ func (m *monitor) listResourceGroupMonitoringHostnames(ctx context.Context, subs
}
// get all external IP's used by VMSS
m.log.Debug("waiting for ss-masters ip addresses")
hostnames = []string{}
for iter, err := m.pipcli.ListVirtualMachineScaleSetPublicIPAddressesComplete(ctx, resourceGroup, "ss-master"); iter.NotDone(); err = iter.Next() {
if err != nil {
return nil, err
time.Sleep(5 * time.Second)
} else if iter.Value().IPAddress != nil {
hostnames = append(hostnames, *iter.Value().IPAddress)
}
Expand All @@ -96,7 +96,7 @@ func (m *monitor) listResourceGroupMonitoringHostnames(ctx context.Context, subs
m.log.Debug("waiting for ip-apiserver server hostname")
ip, err := m.pipcli.Get(ctx, resourceGroup, "ip-apiserver", "")
if err != nil {
return nil, err
time.Sleep(5 * time.Second)
} else if err == nil && ip.Location != nil {
hostnames = append(hostnames, fmt.Sprintf("%s.%s.cloudapp.azure.com", *ip.DNSSettings.DomainNameLabel, *ip.Location))
}
Expand Down

0 comments on commit 782bf12

Please sign in to comment.