This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 7a8b30a9b fix: Add proper app label on default integration platform
7a8b30a9b is described below
commit 7a8b30a9b4d9aef45cbed1f24e244cfec9654405
Author: Christoph Deppisch <[email protected]>
AuthorDate: Tue May 9 10:35:28 2023 +0200
fix: Add proper app label on default integration platform
Make sure to add app=camel-k label on the default integration platform
created by the operator
---
pkg/cmd/operator/operator.go | 1 +
pkg/trait/platform.go | 1 +
pkg/trait/platform_test.go | 2 +-
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index 862043d5c..b1f1623c4 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -258,6 +258,7 @@ func findOrCreateIntegrationPlatform(ctx context.Context, c
client.Client, opera
if defaultPlatform.Labels == nil {
defaultPlatform.Labels = make(map[string]string)
}
+ defaultPlatform.Labels["app"] = "camel-k"
defaultPlatform.Labels["camel.apache.org/platform.generated"] =
"true"
if operatorID != "" {
diff --git a/pkg/trait/platform.go b/pkg/trait/platform.go
index 8850c1fb5..88468889e 100644
--- a/pkg/trait/platform.go
+++ b/pkg/trait/platform.go
@@ -132,6 +132,7 @@ func (t *platformTrait) getOrCreatePlatform(e *Environment)
(*v1.IntegrationPlat
if defaultPlatform.Labels == nil {
defaultPlatform.Labels = make(map[string]string)
}
+ defaultPlatform.Labels["app"] = "camel-k"
defaultPlatform.Labels["camel.apache.org/platform.generated"] =
True
// Cascade the operator id in charge to reconcile the
Integration
if v1.GetOperatorIDAnnotation(e.Integration) != "" {
diff --git a/pkg/trait/platform_test.go b/pkg/trait/platform_test.go
index d549c99d4..2907680a4 100644
--- a/pkg/trait/platform_test.go
+++ b/pkg/trait/platform_test.go
@@ -109,7 +109,7 @@ func TestPlatformTraitCreatesDefaultPlatform(t *testing.T) {
assert.Equal(t, v1.IntegrationPhaseWaitingForPlatform,
e.Integration.Status.Phase)
assert.Equal(t, 1, len(e.Resources.Items()))
defPlatform := v1.NewIntegrationPlatform("ns1",
platform.DefaultPlatformName)
- defPlatform.Labels =
map[string]string{"camel.apache.org/platform.generated": True}
+ defPlatform.Labels = map[string]string{"app": "camel-k",
"camel.apache.org/platform.generated": True}
assert.Contains(t, e.Resources.Items(), &defPlatform)
}