This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit a69f5fd9722ae2975129b1fa21e31c3a58d31868
Author: nferraro <ni.ferr...@gmail.com>
AuthorDate: Thu Jan 10 15:52:39 2019 +0100

    Fix #312: add flag to enable predefined image published and builder
---
 pkg/apis/camel/v1alpha1/integrationplatform_types.go | 15 ++++++++-------
 pkg/builder/builder_steps.go                         | 11 ++++++++---
 pkg/cmd/install.go                                   |  3 +++
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/pkg/apis/camel/v1alpha1/integrationplatform_types.go 
b/pkg/apis/camel/v1alpha1/integrationplatform_types.go
index 7db0ae0..f967b2a 100644
--- a/pkg/apis/camel/v1alpha1/integrationplatform_types.go
+++ b/pkg/apis/camel/v1alpha1/integrationplatform_types.go
@@ -71,13 +71,14 @@ var allTraitProfiles = 
[]TraitProfile{TraitProfileOpenShift, TraitProfileKuberne
 
 // IntegrationPlatformBuildSpec contains platform related build information
 type IntegrationPlatformBuildSpec struct {
-       PublishStrategy IntegrationPlatformBuildPublishStrategy 
`json:"publishStrategy,omitempty"`
-       Registry        string                                  
`json:"registry,omitempty"`
-       Organization    string                                  
`json:"organization,omitempty"`
-       PushSecret      string                                  
`json:"pushSecret,omitempty"`
-       CamelVersion    string                                  
`json:"camelVersion,omitempty"`
-       Properties      map[string]string                       
`json:"properties,omitempty"`
-       Repositories    []string                                
`json:"repositories,omitempty"`
+       PublishStrategy  IntegrationPlatformBuildPublishStrategy 
`json:"publishStrategy,omitempty"`
+       Registry         string                                  
`json:"registry,omitempty"`
+       Organization     string                                  
`json:"organization,omitempty"`
+       PushSecret       string                                  
`json:"pushSecret,omitempty"`
+       CamelVersion     string                                  
`json:"camelVersion,omitempty"`
+       PredefinedImages bool                                    
`json:"predefinedImages,omitempty"`
+       Properties       map[string]string                       
`json:"properties,omitempty"`
+       Repositories     []string                                
`json:"repositories,omitempty"`
 }
 
 // IntegrationPlatformBuildPublishStrategy enumerates all implemented build 
strategies
diff --git a/pkg/builder/builder_steps.go b/pkg/builder/builder_steps.go
index 6be2a71..b5db1ca 100644
--- a/pkg/builder/builder_steps.go
+++ b/pkg/builder/builder_steps.go
@@ -154,9 +154,14 @@ func ComputeDependencies(ctx *Context) error {
 
 // LookupPredefinedImage is used to find a suitable predefined image if 
available
 func LookupPredefinedImage(ctx *Context) error {
-       standardDependencies := map[string]bool {
-               "camel:core": true,
-               "runtime:jvm": true,
+       if !ctx.Request.Platform.Build.PredefinedImages {
+               // Usage of predefined images not enabled
+               return nil
+       }
+
+       standardDependencies := map[string]bool{
+               "camel:core":   true,
+               "runtime:jvm":  true,
                "runtime:yaml": true,
        }
 
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index f9bbff2..6f9cd02 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -43,6 +43,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) 
*cobra.Command {
        cmd.Flags().BoolVar(&impl.clusterSetupOnly, "cluster-setup", false, 
"Execute cluster-wide operations only (may require admin rights)")
        cmd.Flags().BoolVar(&impl.skipClusterSetup, "skip-cluster-setup", 
false, "Skip the cluster-setup phase")
        cmd.Flags().BoolVar(&impl.exampleSetup, "example", false, "Install 
example integration")
+       cmd.Flags().BoolVar(&impl.predefinedImages, "predefined-images", false, 
"Enable usage of predefined images")
        cmd.Flags().StringVar(&impl.registry, "registry", "", "A Docker 
registry that can be used to publish images")
        cmd.Flags().StringVarP(&impl.outputFormat, "output", "o", "", "Output 
format. One of: json|yaml")
        cmd.Flags().StringVar(&impl.organization, "organization", "", "A 
organization on the Docker registry that can be used to publish images")
@@ -69,6 +70,7 @@ type installCmdOptions struct {
        clusterSetupOnly bool
        skipClusterSetup bool
        exampleSetup     bool
+       predefinedImages bool
        registry         string
        outputFormat     string
        organization     string
@@ -140,6 +142,7 @@ func (o *installCmdOptions) install(cmd *cobra.Command, 
args []string) error {
                        platform.Spec.Build.CamelVersion = o.camelVersion
                }
 
+               platform.Spec.Build.PredefinedImages = o.predefinedImages
                platform.Spec.Resources.Contexts = o.contexts
 
                err = install.RuntimeObjectOrCollect(o.Context, c, namespace, 
collection, platform)

Reply via email to