hernanDatgDev commented on code in PR #4987:
URL: https://github.com/apache/camel-k/pull/4987#discussion_r1430485890


##########
pkg/controller/integration/kits.go:
##########
@@ -257,10 +259,32 @@ func matchesTrait(it map[string]interface{}, kt 
map[string]interface{}) bool {
 }
 
 func hasMatchingSources(it *v1.Integration, kit *v1.IntegrationKit) bool {
-       if len(it.Sources()) != len(kit.Spec.Sources) {
+       // A kit may have fewer sources during native builds but should not 
have more
+       if len(kit.Spec.Sources) > len(it.Sources()) {
                return false
        }
+
+       isNativeKit := false
+       if kit.Spec.Traits.Quarkus != nil {
+               // TODO: Verify proper way to determine mode
+               mode := kit.Spec.Traits.Quarkus.Modes[0]
+               isNativeKit = mode == traitv1.NativeQuarkusMode
+       }
+
+       var kitRuntimeCatalog *camel.RuntimeCatalog
+       if isNativeKit {
+               var err error
+               kitRuntimeCatalog, err = 
camel.GetVersionedCatalog(kit.Status.RuntimeVersion)
+               if err != nil {
+                       // TODO: log error here?
+                       return false
+               }
+       }
+
        for _, itSource := range it.Sources() {
+               if isNativeKit && !sourceRequiredByKitCatalog(itSource, 
kitRuntimeCatalog) {

Review Comment:
   Updates have been made for a distinction between UserDefinedSources() and 
AllSources()
   Relevant classes have been refactored. This is providing the expected 
behavior when testing.



-- 
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-unsubscr...@camel.apache.org

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

Reply via email to