Skip to content

Commit

Permalink
Add important labels for kubectl output
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Oct 15, 2024
1 parent 4915a85 commit 9052b20
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ func (a *Actuator) patchMachine(ctx context.Context, orig, updated *machinev1bet
}

func updateMachineFromCloudscaleServer(machine *machinev1beta1.Machine, s cloudscale.Server) error {
if machine.Labels == nil {
machine.Labels = make(map[string]string)
}
machine.Labels[machinecontroller.MachineInstanceTypeLabelName] = s.Flavor.Slug
machine.Labels[machinecontroller.MachineRegionLabelName] = strings.TrimRightFunc(s.Zone.Slug, func(r rune) bool {
return r >= '0' && r <= '9'
})
machine.Labels[machinecontroller.MachineAZLabelName] = s.Zone.Slug

machine.Spec.ProviderID = ptr.To(formatProviderID(s.UUID))
machine.Status.Addresses = machineAddressesFromCloudscaleServer(s)
status := providerStatusFromCloudscaleServer(s)
Expand Down

0 comments on commit 9052b20

Please sign in to comment.