You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "squakez (via GitHub)" <gi...@apache.org> on 2024/03/15 10:37:11 UTC

[PR] feat(trait): move runtime logic into trait catalog [camel-k]

squakez opened a new pull request, #5251:
URL: https://github.com/apache/camel-k/pull/5251

   <!-- Description -->
   This is a POC PR to show a possible solution to the majority of traits that still depends on Quarkus runtime. Most of them depends or can leverage the specific configuration properties mechanism (ie, logging in this example), therefore can be directly driven by the catalog. With this PR we delegate a single property (logging.level) to the related configuration. Eventually, the same would be done with a catalog on the Springboot runtime.
   
   ```
   ./kamel run test.yaml -t logging.level=DEBUG --dev
   ...
   [1] 2024-03-15 10:29:51,850 DEBUG [org.apa.cam.imp.DefaultCamelContext] (main) start() took 97 millis
   ...
   ``
   
   <!--
   Enter your extended release note in the below block. If the PR requires
   additional action from users switching to the new release, include the string
   "action required". If no release note is required, write "NONE". 
   
   You can (optionally) mark this PR with labels "kind/bug" or "kind/feature" to make sure
   the text is added to the right section of the release notes. 
   -->
   
   **Release Note**
   ```release-note
   feat(trait): move runtime logic into trait catalog
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(trait): move runtime logic into trait catalog [camel-k]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5251:
URL: https://github.com/apache/camel-k/pull/5251#issuecomment-2009190234

   :warning: Unit test coverage report - coverage decreased from 37.3% to 37.2% (**-0.1%**)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(trait): move runtime logic into trait catalog [camel-k]

Posted by "claudio4j (via GitHub)" <gi...@apache.org>.
claudio4j commented on PR #5251:
URL: https://github.com/apache/camel-k/pull/5251#issuecomment-2000030671

   This is an interesting approach as it offloads the properties to the catalog provider.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(trait): move runtime logic into trait catalog [camel-k]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5251:
URL: https://github.com/apache/camel-k/pull/5251#issuecomment-1999390458

   :warning: Unit test coverage report - coverage decreased from 37.2% to 37.1% (**-0.1%**)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(trait): move runtime logic into trait catalog [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez merged PR #5251:
URL: https://github.com/apache/camel-k/pull/5251


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(trait): move runtime logic into trait catalog [camel-k]

Posted by "claudio4j (via GitHub)" <gi...@apache.org>.
claudio4j commented on code in PR #5251:
URL: https://github.com/apache/camel-k/pull/5251#discussion_r1526542556


##########
pkg/trait/logging.go:
##########
@@ -61,7 +61,15 @@ func (l loggingTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
 }
 
 func (l loggingTrait) Apply(e *Environment) error {
-	envvar.SetVal(&e.EnvVars, envVarQuarkusLogLevel, l.Level)
+	if loggingCap, ok := e.CamelCatalog.Runtime.Capabilities["logging"]; ok {
+		if e.ApplicationProperties == nil {
+			e.ApplicationProperties = make(map[string]string)
+		}
+		e.ApplicationProperties[loggingCap.Properties["level"]] = l.Level

Review Comment:
   the properties in capabilities may be an array, so in the trait code it just iterates over the key/values. So, there is no need to set individual property keys.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(trait): move runtime logic into trait catalog [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #5251:
URL: https://github.com/apache/camel-k/pull/5251#discussion_r1528118012


##########
pkg/trait/logging.go:
##########
@@ -61,7 +61,15 @@ func (l loggingTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
 }
 
 func (l loggingTrait) Apply(e *Environment) error {
-	envvar.SetVal(&e.EnvVars, envVarQuarkusLogLevel, l.Level)
+	if loggingCap, ok := e.CamelCatalog.Runtime.Capabilities["logging"]; ok {
+		if e.ApplicationProperties == nil {
+			e.ApplicationProperties = make(map[string]string)
+		}
+		e.ApplicationProperties[loggingCap.Properties["level"]] = l.Level

Review Comment:
   If we do an array we'd need to parse the value, ie `test=hello` as key/value with the all the possible problems it would encompass.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org