diff --git a/controllers/actions.github.com/resourcebuilder.go b/controllers/actions.github.com/resourcebuilder.go index 5467c4f7..98b894a6 100644 --- a/controllers/actions.github.com/resourcebuilder.go +++ b/controllers/actions.github.com/resourcebuilder.go @@ -555,17 +555,12 @@ func (b *ResourceBuilder) newEphemeralRunnerSet(autoscalingRunnerSet *v1alpha1.A } func (b *ResourceBuilder) newEphemeralRunner(ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet) *v1alpha1.EphemeralRunner { - labels := make(map[string]string) - for k, v := range ephemeralRunnerSet.Labels { - if k == LabelKeyKubernetesComponent { - labels[k] = "runner" - } else { - labels[k] = v - } - } - - annotations := maps.Clone(ephemeralRunnerSet.Annotations) + labels := make(map[string]string, len(ephemeralRunnerSet.Labels)) + maps.Copy(labels, ephemeralRunnerSet.Labels) + labels[LabelKeyKubernetesComponent] = "runner" + annotations := make(map[string]string, len(ephemeralRunnerSet.Annotations)+1) + maps.Copy(annotations, ephemeralRunnerSet.Annotations) annotations[AnnotationKeyPatchID] = strconv.Itoa(ephemeralRunnerSet.Spec.PatchID) return &v1alpha1.EphemeralRunner{ ObjectMeta: metav1.ObjectMeta{