Unverified Commit 5f4a5e79 authored by Julien Pivotto's avatar Julien Pivotto Committed by GitHub
Browse files

Merge pull request #8737 from roidelapluie/scwpointer

scaleway_sd_config: be more cautious with pointers
parents a9a5f04f 73237c04
......@@ -134,23 +134,32 @@ func (d *instanceDiscovery) refresh(ctx context.Context) ([]*targetgroup.Group,
var targets []model.LabelSet
for _, server := range servers.Servers {
labels := model.LabelSet{
instanceBootTypeLabel: model.LabelValue(server.BootType),
instanceHostnameLabel: model.LabelValue(server.Hostname),
instanceIDLabel: model.LabelValue(server.ID),
instanceImageArchLabel: model.LabelValue(server.Image.Arch),
instanceImageIDLabel: model.LabelValue(server.Image.ID),
instanceImageNameLabel: model.LabelValue(server.Image.Name),
instanceLocationClusterID: model.LabelValue(server.Location.ClusterID),
instanceLocationHypervisorID: model.LabelValue(server.Location.HypervisorID),
instanceLocationNodeID: model.LabelValue(server.Location.NodeID),
instanceNameLabel: model.LabelValue(server.Name),
instanceOrganizationLabel: model.LabelValue(server.Organization),
instanceProjectLabel: model.LabelValue(server.Project),
instanceSecurityGroupIDLabel: model.LabelValue(server.SecurityGroup.ID),
instanceSecurityGroupNameLabel: model.LabelValue(server.SecurityGroup.Name),
instanceStateLabel: model.LabelValue(server.State),
instanceTypeLabel: model.LabelValue(server.CommercialType),
instanceZoneLabel: model.LabelValue(server.Zone.String()),
instanceBootTypeLabel: model.LabelValue(server.BootType),
instanceHostnameLabel: model.LabelValue(server.Hostname),
instanceIDLabel: model.LabelValue(server.ID),
instanceNameLabel: model.LabelValue(server.Name),
instanceOrganizationLabel: model.LabelValue(server.Organization),
instanceProjectLabel: model.LabelValue(server.Project),
instanceStateLabel: model.LabelValue(server.State),
instanceTypeLabel: model.LabelValue(server.CommercialType),
instanceZoneLabel: model.LabelValue(server.Zone.String()),
}
if server.Image != nil {
labels[instanceImageArchLabel] = model.LabelValue(server.Image.Arch)
labels[instanceImageIDLabel] = model.LabelValue(server.Image.ID)
labels[instanceImageNameLabel] = model.LabelValue(server.Image.Name)
}
if server.Location != nil {
labels[instanceLocationClusterID] = model.LabelValue(server.Location.ClusterID)
labels[instanceLocationHypervisorID] = model.LabelValue(server.Location.HypervisorID)
labels[instanceLocationNodeID] = model.LabelValue(server.Location.NodeID)
}
if server.SecurityGroup != nil {
labels[instanceSecurityGroupIDLabel] = model.LabelValue(server.SecurityGroup.ID)
labels[instanceSecurityGroupNameLabel] = model.LabelValue(server.SecurityGroup.Name)
}
if region, err := server.Zone.Region(); err == nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment