Skip to content

Commit f9de2b9

Browse files
committed
handle empty identifier inside environmentProviderJob()
Change-Id: I0ba1ecdcbf321b2910e2a30b78346481b06708f9
1 parent 28d2492 commit f9de2b9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/controller/environmentrequest_controller.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"k8s.io/apimachinery/pkg/fields"
3030
"k8s.io/apimachinery/pkg/runtime"
3131
"k8s.io/apimachinery/pkg/types"
32+
"k8s.io/apimachinery/pkg/util/uuid"
3233
ref "k8s.io/client-go/tools/reference"
3334
ctrl "sigs.k8s.io/controller-runtime"
3435
"sigs.k8s.io/controller-runtime/pkg/builder"
@@ -356,8 +357,14 @@ func (r EnvironmentRequestReconciler) environmentProviderJob(ctx context.Context
356357
return nil, err
357358
}
358359

360+
identifier := environmentrequest.Spec.Identifier
361+
if identifier == "" {
362+
identifier = string(uuid.NewUUID())
363+
}
364+
environmentrequest.Labels["etos.eiffel-community.github.io/id"] = identifier
365+
359366
labels := map[string]string{
360-
"etos.eiffel-community.github.io/id": environmentrequest.Spec.Identifier, // TODO: omitempty
367+
"etos.eiffel-community.github.io/id": identifier,
361368
"app.kubernetes.io/name": "environment-provider",
362369
"app.kubernetes.io/part-of": "etos",
363370
}

0 commit comments

Comments
 (0)