From 5d86ce1ced89a5b49efa2ecb8b09c6ac18c02a5c Mon Sep 17 00:00:00 2001 From: Isala Piyarisi Date: Wed, 18 Aug 2021 22:05:45 +0530 Subject: [PATCH] Fixed issue with copying reference pod labels (#65) --- controllers/provision.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/provision.go b/controllers/provision.go index 15a078e..da7fe06 100644 --- a/controllers/provision.go +++ b/controllers/provision.go @@ -90,7 +90,11 @@ func (r *FlowTestReconciler) provisionResource(ctx context.Context) error { extraLabels := GetLabels("pod-simulation", &flowTest) - simulationPod.ObjectMeta.Labels = referencePod.ObjectMeta.Labels + if referencePod.ObjectMeta.Labels != nil { + simulationPod.ObjectMeta.Labels = referencePod.ObjectMeta.Labels + } else { + simulationPod.ObjectMeta.Labels = make(map[string]string) + } for k, v := range extraLabels { simulationPod.ObjectMeta.Labels[k] = v