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 2023/05/17 13:58:14 UTC

[GitHub] [camel-k] squakez opened a new pull request, #4384: feat: enable generic Pipeline

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

   Preliminary work required to enable the possibility to run a generic Pipeline instead of a "static" build.
   
   Ref #4281
   
   <!-- Description -->
   
   
   
   
   <!--
   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
   NONE
   ```
   


-- 
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


[GitHub] [camel-k] squakez merged pull request #4384: feat: enable generic Pipeline

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


-- 
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


[GitHub] [camel-k] squakez commented on a diff in pull request #4384: feat: enable generic Pipeline

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


##########
pkg/trait/builder.go:
##########
@@ -148,52 +149,59 @@ func (t *builderTrait) Apply(e *Environment) error {
 			ExecutorImage: executorImage,
 		}})
 	}
-
-	if t.Strategy != "" {
-		t.L.Infof("User defined build strategy %s", t.Strategy)
-		switch t.Strategy {
-		case string(v1.BuildStrategyPod):
-			e.BuildConfiguration.Strategy = v1.BuildStrategyPod
-		case string(v1.BuildStrategyRoutine):
-			e.BuildConfiguration.Strategy = v1.BuildStrategyRoutine
-		default:
-			return fmt.Errorf("must specify either pod or routine build strategy, unknown %s", t.Strategy)
-		}
-	}
-
-	if t.RequestCPU != "" {
-		e.BuildConfiguration.RequestCPU = t.RequestCPU
-	}
-	if t.RequestMemory != "" {
-		e.BuildConfiguration.RequestMemory = t.RequestMemory
-	}
-	if t.LimitCPU != "" {
-		e.BuildConfiguration.LimitCPU = t.LimitCPU
-	}
-	if t.LimitMemory != "" {
-		e.BuildConfiguration.LimitMemory = t.LimitMemory
-	}
-
 	return nil
 }
 
 func (t *builderTrait) builderTask(e *Environment) (*v1.BuilderTask, error) {
 	maven := v1.MavenBuildSpec{
-		MavenSpec: e.Platform.Status.Build.Maven,
+		MavenSpec: e.Platform.Status.Pipeline.Maven,
 	}
 	// Add Maven repositories defined in the IntegrationKit
 	for _, repo := range e.IntegrationKit.Spec.Repositories {
 		maven.Repositories = append(maven.Repositories, mvn.NewRepository(repo))
 	}
 
+	if trait := e.Catalog.GetTrait(quarkusTraitID); trait != nil {
+		// The builder trait must define certain resources requirements when we have a native build
+		if quarkus, ok := trait.(*quarkusTrait); ok && pointer.BoolDeref(quarkus.Enabled, true) && quarkus.isNativeIntegration(e) {
+			// Force the build to run in a separate Pod
+			t.L.Info("This is a Quarkus native build: setting build configuration with build Pod strategy, 1 CPU core and 4 GiB memory. Make sure your cluster can handle it.")
+			t.Strategy = string(v1.BuildStrategyPod)
+			t.RequestCPU = "1000m"
+			t.RequestMemory = "4Gi"

Review Comment:
   Sure. But it would be another feature development. This PR is about something different.



-- 
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


[GitHub] [camel-k] claudio4j commented on a diff in pull request #4384: feat: enable generic Pipeline

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


##########
pkg/trait/builder.go:
##########
@@ -148,52 +149,59 @@ func (t *builderTrait) Apply(e *Environment) error {
 			ExecutorImage: executorImage,
 		}})
 	}
-
-	if t.Strategy != "" {
-		t.L.Infof("User defined build strategy %s", t.Strategy)
-		switch t.Strategy {
-		case string(v1.BuildStrategyPod):
-			e.BuildConfiguration.Strategy = v1.BuildStrategyPod
-		case string(v1.BuildStrategyRoutine):
-			e.BuildConfiguration.Strategy = v1.BuildStrategyRoutine
-		default:
-			return fmt.Errorf("must specify either pod or routine build strategy, unknown %s", t.Strategy)
-		}
-	}
-
-	if t.RequestCPU != "" {
-		e.BuildConfiguration.RequestCPU = t.RequestCPU
-	}
-	if t.RequestMemory != "" {
-		e.BuildConfiguration.RequestMemory = t.RequestMemory
-	}
-	if t.LimitCPU != "" {
-		e.BuildConfiguration.LimitCPU = t.LimitCPU
-	}
-	if t.LimitMemory != "" {
-		e.BuildConfiguration.LimitMemory = t.LimitMemory
-	}
-
 	return nil
 }
 
 func (t *builderTrait) builderTask(e *Environment) (*v1.BuilderTask, error) {
 	maven := v1.MavenBuildSpec{
-		MavenSpec: e.Platform.Status.Build.Maven,
+		MavenSpec: e.Platform.Status.Pipeline.Maven,
 	}
 	// Add Maven repositories defined in the IntegrationKit
 	for _, repo := range e.IntegrationKit.Spec.Repositories {
 		maven.Repositories = append(maven.Repositories, mvn.NewRepository(repo))
 	}
 
+	if trait := e.Catalog.GetTrait(quarkusTraitID); trait != nil {
+		// The builder trait must define certain resources requirements when we have a native build
+		if quarkus, ok := trait.(*quarkusTrait); ok && pointer.BoolDeref(quarkus.Enabled, true) && quarkus.isNativeIntegration(e) {
+			// Force the build to run in a separate Pod
+			t.L.Info("This is a Quarkus native build: setting build configuration with build Pod strategy, 1 CPU core and 4 GiB memory. Make sure your cluster can handle it.")
+			t.Strategy = string(v1.BuildStrategyPod)
+			t.RequestCPU = "1000m"
+			t.RequestMemory = "4Gi"

Review Comment:
   Having a `native` settings for CPU/memory would be interesting for users who want to also customize these settings for native. Thinking on another level, it could be the native requirements are 2x or 3x the regular minimum, alternatively the operator could enhance this behavior, by verifying if the build failed for OOME and automatically increase the memory.



-- 
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