Skip to content

Commit

Permalink
Rename metapatch var in applyAllocationToGameServer (#2198)
Browse files Browse the repository at this point in the history
Minor fix from a PR comment that I had in the backlog but hadn't
submitted yet.

Fix for #2148 (comment)
  • Loading branch information
markmandel authored Jul 28, 2021
1 parent d3b9d6b commit 7db59fc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/gameserverallocations/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,22 +570,22 @@ func (c *Allocator) allocationUpdateWorkers(ctx context.Context, workerCount int

// applyAllocationToGameServer patches the inputted GameServer with the allocation metadata changes, and updates it to the Allocated State.
// Returns the updated GameServer.
func (c *Allocator) applyAllocationToGameServer(ctx context.Context, fam allocationv1.MetaPatch, gs *agonesv1.GameServer) (*agonesv1.GameServer, error) {
func (c *Allocator) applyAllocationToGameServer(ctx context.Context, mp allocationv1.MetaPatch, gs *agonesv1.GameServer) (*agonesv1.GameServer, error) {
// patch ObjectMeta labels
if fam.Labels != nil {
if mp.Labels != nil {
if gs.ObjectMeta.Labels == nil {
gs.ObjectMeta.Labels = make(map[string]string, len(fam.Labels))
gs.ObjectMeta.Labels = make(map[string]string, len(mp.Labels))
}
for key, value := range fam.Labels {
for key, value := range mp.Labels {
gs.ObjectMeta.Labels[key] = value
}
}

if gs.ObjectMeta.Annotations == nil {
gs.ObjectMeta.Annotations = make(map[string]string, len(fam.Annotations))
gs.ObjectMeta.Annotations = make(map[string]string, len(mp.Annotations))
}
// apply annotations patch
for key, value := range fam.Annotations {
for key, value := range mp.Annotations {
gs.ObjectMeta.Annotations[key] = value
}

Expand Down

0 comments on commit 7db59fc

Please sign in to comment.