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 3cd9f07a9 chore(traits): remove deprecations no longer supported
3cd9f07a9 is described below
commit 3cd9f07a9ddec10bf2b66197222a492cb0300cf0
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Mon Feb 24 18:05:05 2025 +0100
chore(traits): remove deprecations no longer supported
---
pkg/trait/logging.go | 26 --------------------------
pkg/trait/logging_test.go | 20 --------------------
pkg/trait/master.go | 21 ---------------------
3 files changed, 67 deletions(-)
diff --git a/pkg/trait/logging.go b/pkg/trait/logging.go
index 8d88d21fc..d0b93bd5e 100644
--- a/pkg/trait/logging.go
+++ b/pkg/trait/logging.go
@@ -20,7 +20,6 @@ package trait
import (
traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
"github.com/apache/camel-k/v2/pkg/util/boolean"
- "github.com/apache/camel-k/v2/pkg/util/envvar"
"k8s.io/utils/ptr"
)
@@ -61,36 +60,11 @@ func (l *loggingTrait) Configure(e *Environment) (bool,
*TraitCondition, error)
func (l *loggingTrait) Apply(e *Environment) error {
if e.CamelCatalog.Runtime.Capabilities["logging"].RuntimeProperties !=
nil {
l.setCatalogConfiguration(e)
- } else {
- l.setEnvConfiguration(e)
}
return nil
}
-// Deprecated: to be removed in future release in favor of func
setCatalogConfiguration().
-func (l *loggingTrait) setEnvConfiguration(e *Environment) {
- envvar.SetVal(&e.EnvVars, envVarQuarkusLogLevel, l.getLevel())
-
- if l.Format != "" {
- envvar.SetVal(&e.EnvVars, envVarQuarkusLogConsoleFormat,
l.Format)
- }
-
- if ptr.Deref(l.JSON, false) {
- envvar.SetVal(&e.EnvVars, envVarQuarkusLogConsoleJSON,
boolean.TrueString)
- if ptr.Deref(l.JSONPrettyPrint, false) {
- envvar.SetVal(&e.EnvVars,
envVarQuarkusLogConsoleJSONPrettyPrint, boolean.TrueString)
- }
- } else {
- // If the trait is false OR unset, we default to false.
- envvar.SetVal(&e.EnvVars, envVarQuarkusLogConsoleJSON,
boolean.FalseString)
-
- if ptr.Deref(l.Color, true) {
- envvar.SetVal(&e.EnvVars, envVarQuarkusConsoleColor,
boolean.TrueString)
- }
- }
-}
-
func (l *loggingTrait) setCatalogConfiguration(e *Environment) {
if e.ApplicationProperties == nil {
e.ApplicationProperties = make(map[string]string)
diff --git a/pkg/trait/logging_test.go b/pkg/trait/logging_test.go
index 14541e854..b8b174c7b 100644
--- a/pkg/trait/logging_test.go
+++ b/pkg/trait/logging_test.go
@@ -33,7 +33,6 @@ import (
"github.com/apache/camel-k/v2/pkg/internal"
"github.com/apache/camel-k/v2/pkg/util/boolean"
"github.com/apache/camel-k/v2/pkg/util/camel"
- "github.com/apache/camel-k/v2/pkg/util/envvar"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
)
@@ -155,22 +154,3 @@ func TestJsonLoggingTrait(t *testing.T) {
assert.Equal(t, "${camel.k.logging.jsonPrettyPrint}",
env.ApplicationProperties["quarkus.log.console.json.pretty-print"])
assert.Equal(t, "", env.ApplicationProperties["quarkus.console.color"])
}
-
-func TestDefaultQuarkusLogging(t *testing.T) {
- env := createDefaultLoggingTestEnv(t)
- // Simulate an older catalog configuration which is missing the logging
- // capability
- env.CamelCatalog.Runtime.Capabilities["logging"] = v1.Capability{
- RuntimeProperties: nil,
- }
- env.EnvVars = []corev1.EnvVar{}
- conditions, traits, err := NewLoggingTestCatalog().apply(env)
-
- require.NoError(t, err)
- assert.NotEmpty(t, traits)
- assert.NotEmpty(t, conditions)
- assert.NotEmpty(t, env.ExecutedTraits)
-
- assert.Equal(t, &corev1.EnvVar{Name: "QUARKUS_LOG_LEVEL", Value:
"INFO"}, envvar.Get(env.EnvVars, envVarQuarkusLogLevel))
- assert.Equal(t, &corev1.EnvVar{Name: "QUARKUS_LOG_CONSOLE_JSON", Value:
"false"}, envvar.Get(env.EnvVars, envVarQuarkusLogConsoleJSON))
-}
diff --git a/pkg/trait/master.go b/pkg/trait/master.go
index d7aa9c1e1..f19cdfb02 100644
--- a/pkg/trait/master.go
+++ b/pkg/trait/master.go
@@ -119,33 +119,12 @@ func (t *masterTrait) Apply(e *Environment) error {
if
e.CamelCatalog.Runtime.Capabilities["master"].RuntimeProperties != nil {
t.setCatalogConfiguration(e)
- } else {
- t.setCustomizerConfiguration(e)
}
}
return nil
}
-// Deprecated: to be removed in future release in favor of func
setCatalogConfiguration().
-func (t *masterTrait) setCustomizerConfiguration(e *Environment) {
- e.Integration.Status.Configuration =
append(e.Integration.Status.Configuration,
- v1.ConfigurationSpec{Type: "property", Value:
"customizer.master.enabled=true"},
- )
- e.Integration.Status.Configuration =
append(e.Integration.Status.Configuration,
- v1.ConfigurationSpec{Type: "property", Value:
"customizer.master.kubernetesResourceNames=" + *t.ResourceName},
- )
- e.Integration.Status.Configuration =
append(e.Integration.Status.Configuration,
- v1.ConfigurationSpec{Type: "property", Value:
"customizer.master.leaseResourceType" + t.getResourceKey()},
- )
- e.Integration.Status.Configuration =
append(e.Integration.Status.Configuration,
- v1.ConfigurationSpec{Type: "property", Value:
"customizer.master.labelKey=" + t.getLabelKey()},
- )
- e.Integration.Status.Configuration =
append(e.Integration.Status.Configuration,
- v1.ConfigurationSpec{Type: "property", Value:
"customizer.master.labelValue=" + *t.LabelValue},
- )
-}
-
func (t *masterTrait) setCatalogConfiguration(e *Environment) {
if e.ApplicationProperties == nil {
e.ApplicationProperties = make(map[string]string)