You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2018/11/16 13:17:55 UTC

[GitHub] nicolaferraro closed pull request #227: Fix kaniko build

nicolaferraro closed pull request #227: Fix kaniko build
URL: https://github.com/apache/camel-k/pull/227
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/traits.adoc b/docs/traits.adoc
index 27f90b2c..130958e1 100644
--- a/docs/traits.adoc
+++ b/docs/traits.adoc
@@ -62,6 +62,28 @@ The following is a list of common traits that can be configured by the end users
   +
   It's enabled by default.
 
+| deployment
+| Kubernetes, OpenShift
+| Creates a standard Kubernetes deployment for running the integration.
+  +
+  +
+  It's enabled by default on vanilla Kubernetes/Openshift profiles.
+
+| knative
+| Knative (Kubernetes, Openshift)
+| Creates Knative resources to run the integration instead of the standard Kubernetes resources.
+  +
+  +
+  It's enabled by default when the Knative profile is active.
+
+[cols="m,"]
+!===
+
+! knative.sources
+! Configures a (comma-separated) list of channels to which the Knative service must be subscribed (to receive cloudevents from a channel).
+
+!===
+
 | service
 | Kubernetes, OpenShift
 | Exposes the integration with a Service resource so that it can be accessed by other applications (or integrations) in the same namespace.
@@ -117,6 +139,5 @@ There are also platform traits that **normally should not be configured** by the
 [options="header",cols="m,,"]
 |=======================
 | Trait      | Profiles 				| Description
-| deployment | Kubernetes, OpenShift	| Creates the basic Kubernetes resource needed for running the integration.
 | owner      | Kubernetes, OpenShift	| Makes sure that every resource created by the traits belongs to the integration custom resource (so they are deleted when the integration is deleted).
 |=======================
diff --git a/pkg/builder/builder.go b/pkg/builder/builder.go
index 1b452b41..430933bb 100644
--- a/pkg/builder/builder.go
+++ b/pkg/builder/builder.go
@@ -124,7 +124,11 @@ func (b *defaultBuilder) submit(request Request) {
 	r.Task.StartedAt = time.Now()
 
 	// create tmp path
-	builderPath, err := ioutil.TempDir(os.TempDir(), "builder-")
+	buildDir := request.BuildDir
+	if buildDir == "" {
+		buildDir = os.TempDir()
+	}
+	builderPath, err := ioutil.TempDir(buildDir, "builder-")
 	if err != nil {
 		r.Status = StatusError
 		r.Error = err
diff --git a/pkg/builder/builder_types.go b/pkg/builder/builder_types.go
index f4cd9b8e..6b97c1e7 100644
--- a/pkg/builder/builder_types.go
+++ b/pkg/builder/builder_types.go
@@ -85,6 +85,7 @@ type Request struct {
 	Code         v1alpha1.SourceSpec
 	Dependencies []string
 	Steps        []Step
+	BuildDir     string
 }
 
 // Task --
diff --git a/pkg/builder/kaniko/kaniko.go b/pkg/builder/kaniko/kaniko.go
index 318958f8..4cf67543 100644
--- a/pkg/builder/kaniko/kaniko.go
+++ b/pkg/builder/kaniko/kaniko.go
@@ -28,3 +28,6 @@ var DefaultSteps = []builder.Step{
 	builder.NewStep("packager", 30, builder.StandardPackager),
 	builder.NewStep("publisher", 40, Publisher),
 }
+
+// BuildDir is the directory where to build artifacts (shared with the Kaniko pod)
+var BuildDir = "/workspace"
\ No newline at end of file
diff --git a/pkg/platform/build.go b/pkg/platform/build.go
index 7b6332a9..d0a8c0ec 100644
--- a/pkg/platform/build.go
+++ b/pkg/platform/build.go
@@ -64,6 +64,7 @@ func NewBuildRequest(ctx context.Context, context *v1alpha1.IntegrationContext)
 		req.Steps = s2i.DefaultSteps
 	} else if SupportsKanikoPublishStrategy(p) {
 		req.Steps = kaniko.DefaultSteps
+		req.BuildDir = kaniko.BuildDir
 	} else {
 		return req, errors.New("unsupported platform configuration")
 	}
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index a8d083fe..2175525b 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -31,8 +31,8 @@ import (
 )
 
 type knativeTrait struct {
-	BaseTrait     `property:",squash"`
-	Subscriptions string `property:"subscriptions"`
+	BaseTrait `property:",squash"`
+	Sources   string `property:"sources"`
 }
 
 func newKnativeTrait() *knativeTrait {
@@ -42,9 +42,9 @@ func newKnativeTrait() *knativeTrait {
 }
 
 func (t *knativeTrait) autoconfigure(environment *environment, resources *kubernetes.Collection) error {
-	if t.Subscriptions == "" {
+	if t.Sources == "" {
 		channels := t.getSourceChannels(environment)
-		t.Subscriptions = strings.Join(channels, ",")
+		t.Sources = strings.Join(channels, ",")
 	}
 	return nil
 }
@@ -198,7 +198,7 @@ func (t *knativeTrait) getConfiguration(e *environment) knativeutil.CamelEnviron
 
 func (t *knativeTrait) getConfiguredSourceChannels() []string {
 	channels := make([]string, 0)
-	for _, ch := range strings.Split(t.Subscriptions, ",") {
+	for _, ch := range strings.Split(t.Sources, ",") {
 		cht := strings.Trim(ch, " \t\"")
 		if cht != "" {
 			channels = append(channels, cht)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services