Skip to content

Commit 715d3b0

Browse files
committed
handle empty identifier inside environmentProviderJob()
Change-Id: I0ba1ecdcbf321b2910e2a30b78346481b06708f9
1 parent 7d13398 commit 715d3b0

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"
@@ -365,8 +366,14 @@ func (r EnvironmentRequestReconciler) environmentProviderJob(ctx context.Context
365366
return nil, err
366367
}
367368

369+
identifier := environmentrequest.Spec.Identifier
370+
if identifier == "" {
371+
identifier = string(uuid.NewUUID())
372+
}
373+
environmentrequest.Labels["etos.eiffel-community.github.io/id"] = identifier
374+
368375
labels := map[string]string{
369-
"etos.eiffel-community.github.io/id": environmentrequest.Spec.Identifier, // TODO: omitempty
376+
"etos.eiffel-community.github.io/id": identifier,
370377
"app.kubernetes.io/name": "environment-provider",
371378
"app.kubernetes.io/part-of": "etos",
372379
}

0 commit comments

Comments
 (0)