You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/08/19 16:37:26 UTC

[camel-k] branch 3350/allow-to-set-custom-images updated (53dc1a58e -> 77d747277)

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

nfilotto pushed a change to branch 3350/allow-to-set-custom-images
in repository https://gitbox.apache.org/repos/asf/camel-k.git


 discard 53dc1a58e feat(cli): Allow to specify custom kaniko and buildah images
     new 77d747277 feat(cli): Allow to specify custom Kaniko and Buildah images

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (53dc1a58e)
            \
             N -- N -- N   refs/heads/3350/allow-to-set-custom-images (77d747277)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[camel-k] 01/01: feat(cli): Allow to specify custom Kaniko and Buildah images

Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch 3350/allow-to-set-custom-images
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 77d7472779ff98a51df7ada0bb89e4bfc20efb8d
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Fri Aug 19 18:35:40 2022 +0200

    feat(cli): Allow to specify custom Kaniko and Buildah images
---
 pkg/apis/camel/v1/build_types.go                   |  4 ++++
 .../camel/v1/integrationplatform_types_support.go  | 10 ++++++++
 pkg/builder/buildah.go                             |  2 ++
 pkg/builder/kaniko.go                              |  4 ++++
 pkg/cmd/install.go                                 | 27 +++++++++++++++++++---
 pkg/cmd/install_test.go                            | 21 +++++++++++++++++
 pkg/controller/build/build_pod.go                  |  5 ++--
 pkg/controller/integrationplatform/kaniko_cache.go |  7 +++++-
 pkg/resources/resources.go                         | 20 ++++++++--------
 pkg/trait/builder.go                               | 19 ++++++++++++++-
 10 files changed, 101 insertions(+), 18 deletions(-)

diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go
index 0de3fd47c..631d761b0 100644
--- a/pkg/apis/camel/v1/build_types.go
+++ b/pkg/apis/camel/v1/build_types.go
@@ -111,6 +111,8 @@ type BuildahTask struct {
 	Platform string `json:"platform,omitempty"`
 	// log more information
 	Verbose *bool `json:"verbose,omitempty"`
+	// name of the docker image to use
+	Image string `json:"image,omitempty"`
 }
 
 // KanikoTask is used to configure Kaniko
@@ -121,6 +123,8 @@ type KanikoTask struct {
 	Verbose *bool `json:"verbose,omitempty"`
 	// use a cache
 	Cache KanikoTaskCache `json:"cache,omitempty"`
+	// name of the docker image to use
+	Image string `json:"image,omitempty"`
 }
 
 // KanikoTaskCache is used to configure Kaniko cache
diff --git a/pkg/apis/camel/v1/integrationplatform_types_support.go b/pkg/apis/camel/v1/integrationplatform_types_support.go
index fdd53b664..32d3ccc34 100644
--- a/pkg/apis/camel/v1/integrationplatform_types_support.go
+++ b/pkg/apis/camel/v1/integrationplatform_types_support.go
@@ -186,6 +186,16 @@ func (b IntegrationPlatformBuildSpec) IsOptionEnabled(option string) bool {
 	return false
 }
 
+// Add a publish strategy option
+func (b *IntegrationPlatformBuildSpec) AddOption(option string, value string) {
+	options := b.PublishStrategyOptions
+	if options == nil {
+		options = make(map[string]string)
+		b.PublishStrategyOptions = options
+	}
+	options[option] = value
+}
+
 // GetTimeout returns the specified duration or a default one
 func (b IntegrationPlatformBuildSpec) GetTimeout() metav1.Duration {
 	if b.Timeout == nil {
diff --git a/pkg/builder/buildah.go b/pkg/builder/buildah.go
index d900ec1fe..cec77ef4a 100644
--- a/pkg/builder/buildah.go
+++ b/pkg/builder/buildah.go
@@ -18,3 +18,5 @@ limitations under the License.
 package builder
 
 const BuildahPlatform = "BuildahPlatform"
+const BuildahImage = "BuildahImage"
+const BuildahDefaultImage = "quay.io/buildah/stable"
diff --git a/pkg/builder/kaniko.go b/pkg/builder/kaniko.go
index 260dc72ec..df44551b3 100644
--- a/pkg/builder/kaniko.go
+++ b/pkg/builder/kaniko.go
@@ -21,3 +21,7 @@ package builder
 const KanikoCacheDir = "/kaniko/cache"
 const KanikoPVCName = "KanikoPersistentVolumeClaim"
 const KanikoBuildCacheEnabled = "KanikoBuildCacheEnabled"
+const KanikoExecutorImage = "KanikoExecutorImage"
+const KanikoWarmerImage = "KanikoWarmerImage"
+const KanikoDefaultExecutorImage = "gcr.io/kaniko-project/executor"
+const KanikoDefaultWarmerImage = "gcr.io/kaniko-project/warmer"
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 1185c50b6..c4da20c31 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -110,7 +110,14 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) (*cobra.Command, *installCmdO
 	cmd.Flags().String("build-publish-strategy", "", "Set the build publish strategy")
 	cmd.Flags().String("build-timeout", "", "Set how long the build process can last")
 	cmd.Flags().String("trait-profile", "", "The profile to use for traits")
+
+	// Kaniko
 	cmd.Flags().Bool("kaniko-build-cache", false, "To enable or disable the Kaniko cache")
+	cmd.Flags().String("kaniko-executor-image", "", "The name of the docker image of the Kaniko executor")
+	cmd.Flags().String("kaniko-warmer-image", "", "The name of the docker image of the Kaniko warmer")
+
+	// Buildah
+	cmd.Flags().String("buildah-image", "", "The name of the docker image to use for Buildah")
 
 	// OLM
 	cmd.Flags().Bool("olm", true, "Try to install everything via OLM (Operator Lifecycle Manager) if available")
@@ -165,6 +172,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) (*cobra.Command, *installCmdO
 type installCmdOptions struct {
 	*RootCmdOptions
 	Wait                     bool     `mapstructure:"wait"`
+	BuildahImage             string   `mapstructure:"buildah-image"`
 	ClusterSetupOnly         bool     `mapstructure:"cluster-setup"`
 	SkipOperatorSetup        bool     `mapstructure:"skip-operator-setup"`
 	SkipClusterSetup         bool     `mapstructure:"skip-cluster-setup"`
@@ -173,6 +181,8 @@ type installCmdOptions struct {
 	ExampleSetup             bool     `mapstructure:"example"`
 	Global                   bool     `mapstructure:"global"`
 	KanikoBuildCache         bool     `mapstructure:"kaniko-build-cache"`
+	KanikoExecutorImage      string   `mapstructure:"kaniko-executor-image"`
+	KanikoWarmerImage        string   `mapstructure:"kaniko-warmer-image"`
 	Save                     bool     `mapstructure:"save" kamel:"omitsave"`
 	Force                    bool     `mapstructure:"force"`
 	Olm                      bool     `mapstructure:"olm"`
@@ -480,11 +490,22 @@ func (o *installCmdOptions) install(cobraCmd *cobra.Command, _ []string) error {
 			}
 		}
 
-		kanikoBuildCacheFlag := cobraCmd.Flags().Lookup("kaniko-build-cache")
-		if kanikoBuildCacheFlag.Changed {
-			platform.Spec.Build.PublishStrategyOptions[builder.KanikoBuildCacheEnabled] = strconv.FormatBool(o.KanikoBuildCache)
+		if platform.Spec.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyKaniko {
+			kanikoBuildCacheFlag := cobraCmd.Flags().Lookup("kaniko-build-cache")
+			if kanikoBuildCacheFlag.Changed {
+				platform.Spec.Build.AddOption(builder.KanikoBuildCacheEnabled, strconv.FormatBool(o.KanikoBuildCache))
+			}
+			if o.KanikoExecutorImage != "" {
+				platform.Spec.Build.AddOption(builder.KanikoExecutorImage, o.KanikoExecutorImage)
+			}
+			if o.KanikoWarmerImage != "" {
+				platform.Spec.Build.AddOption(builder.KanikoWarmerImage, o.KanikoWarmerImage)
+			}
 		}
 
+		if platform.Spec.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyBuildah && o.BuildahImage != "" {
+			platform.Spec.Build.AddOption(builder.BuildahImage, o.BuildahImage)
+		}
 		// Always create a platform in the namespace where the operator is located
 		err = install.ObjectOrCollect(o.Context, c, namespace, collection, o.Force, platform)
 		if err != nil {
diff --git a/pkg/cmd/install_test.go b/pkg/cmd/install_test.go
index c1aaaee59..27007a60a 100644
--- a/pkg/cmd/install_test.go
+++ b/pkg/cmd/install_test.go
@@ -164,6 +164,27 @@ func TestInstallKanikoBuildCacheFlag(t *testing.T) {
 	assert.Equal(t, true, installCmdOptions.KanikoBuildCache)
 }
 
+func TestInstallKanikoExecutorImage(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--kaniko-executor-image", "some-executor-image")
+	assert.Nil(t, err)
+	assert.Equal(t, "some-executor-image", installCmdOptions.KanikoExecutorImage)
+}
+
+func TestInstallKanikoWarmerImage(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--kaniko-warmer-image", "some-warmer-image")
+	assert.Nil(t, err)
+	assert.Equal(t, "some-warmer-image", installCmdOptions.KanikoWarmerImage)
+}
+
+func TestInstallBuildahImage(t *testing.T) {
+	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
+	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--buildah-image", "some-buildah-image")
+	assert.Nil(t, err)
+	assert.Equal(t, "some-buildah-image", installCmdOptions.BuildahImage)
+}
+
 func TestInstallLocalRepositoryFlag(t *testing.T) {
 	installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t)
 	_, err := test.ExecuteCommand(rootCmd, cmdInstall, "--maven-local-repository", "someString")
diff --git a/pkg/controller/build/build_pod.go b/pkg/controller/build/build_pod.go
index 1ebb74c52..b801f8e58 100644
--- a/pkg/controller/build/build_pod.go
+++ b/pkg/controller/build/build_pod.go
@@ -19,7 +19,6 @@ package build
 
 import (
 	"context"
-	"fmt"
 	"os"
 	"path"
 	"strconv"
@@ -326,7 +325,7 @@ func addBuildahTaskToPod(ctx context.Context, c ctrl.Reader, build *v1.Build, ta
 
 	container := corev1.Container{
 		Name:            task.Name,
-		Image:           fmt.Sprintf("quay.io/buildah/stable:v%s", defaults.BuildahVersion),
+		Image:           task.Image,
 		ImagePullPolicy: corev1.PullIfNotPresent,
 		Command:         []string{"/bin/sh", "-c"},
 		Args:            []string{strings.Join(args, " && ")},
@@ -438,7 +437,7 @@ func addKanikoTaskToPod(ctx context.Context, c ctrl.Reader, build *v1.Build, tas
 
 	container := corev1.Container{
 		Name:            task.Name,
-		Image:           fmt.Sprintf("gcr.io/kaniko-project/executor:v%s", defaults.KanikoVersion),
+		Image:           task.Image,
 		ImagePullPolicy: corev1.PullIfNotPresent,
 		Args:            args,
 		Env:             env,
diff --git a/pkg/controller/integrationplatform/kaniko_cache.go b/pkg/controller/integrationplatform/kaniko_cache.go
index 6292eea9b..a4b97bb21 100644
--- a/pkg/controller/integrationplatform/kaniko_cache.go
+++ b/pkg/controller/integrationplatform/kaniko_cache.go
@@ -46,6 +46,11 @@ func createKanikoCacheWarmerPod(ctx context.Context, client client.Client, platf
 		pvcName = persistentVolumeClaim
 	}
 
+	warmerImage := fmt.Sprintf("%s:v%s", builder.KanikoDefaultWarmerImage, defaults.KanikoVersion)
+	if image, found := platform.Status.Build.PublishStrategyOptions[builder.KanikoWarmerImage]; found {
+		warmerImage = image
+	}
+
 	pod := corev1.Pod{
 		TypeMeta: metav1.TypeMeta{
 			APIVersion: corev1.SchemeGroupVersion.String(),
@@ -62,7 +67,7 @@ func createKanikoCacheWarmerPod(ctx context.Context, client client.Client, platf
 			Containers: []corev1.Container{
 				{
 					Name:  "warm-kaniko-cache",
-					Image: fmt.Sprintf("gcr.io/kaniko-project/warmer:v%s", defaults.KanikoVersion),
+					Image: warmerImage,
 					Args: []string{
 						"--cache-dir=" + builder.KanikoCacheDir,
 						"--image=" + platform.Status.Build.BaseImage,
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 44e677f71..f8419d0c9 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -138,23 +138,23 @@ var assets = func() http.FileSystem {
 		"/crd/bases/camel.apache.org_integrationplatforms.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_integrationplatforms.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 174371,
+			uncompressedSize: 177901,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7d\x73\xdb\x36\xb6\x30\xfe\x7f\x3e\x05\xc6\xfd\x23\x4e\xc6\x92\x9b\xdd\xdb\xdd\x5e\xdf\xe9\x3c\x8f\xd7\x49\x5b\x37\x71\xec\x6b\x39\xb9\x77\xa7\xed\x54\x10\x79\x24\x21\x22\x01\x2e\x00\xca\x51\x7f\xfb\xfb\xee\xcf\xe0\x00\x20\x29\x89\x04\x29\xc9\x6f\x6d\xc4\xce\xec\xc6\x36\x01\x1e\x1c\x1c\x9c\x37\x9c\x97\xaf\x48\xef\xee\x9e\x67\x5f\x91\x77\x2c\x02\xae\x20\x26\x5a\x10\x3d\x05\x72\x9a\xd1\x68\x0a\x64\x20\xc6\xfa\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\xdb\x36\xb6\x30\x8e\xff\x9e\xbf\x02\xe3\xce\x9d\x38\x19\x49\x4e\xba\xb7\xbb\xbd\x7e\xa6\xf3\x3c\xae\x93\xb6\x6e\xe2\xd8\xd7\x76\x72\xef\x4e\xdb\xa9\x20\xf2\x48\x42\x4c\x02\x5c\x00\x94\xad\x7e\xf7\xfb\xbf\x7f\x06\x07\x00\x49\x49\x24\x48\x49\x7e\x6b\x23\x76\x66\x37\xb6\x09\xf0\xe0\xe0\xe0\xbc\xe1\xbc\x7c\x45\xfa\x77\xf7\x3c\xfb\x8a\xbc\x67\x11\x70\x05\x31\xd1\x82\xe8\x29\x90\xa3\x8c\x46\x53\x20\x97\x62\x [...]
 		},
 		"/crd/bases/camel.apache.org_integrations.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_integrations.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 470929,
+			uncompressedSize: 472694,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\x1b\x37\xf6\x28\xf8\xbf\x3f\x05\x4a\x49\x5d\x49\x13\x91\xb2\x33\x73\x53\xbf\xf1\x4e\xdd\x94\x46\x92\x13\x6d\x6c\x99\x65\x29\xc9\x4d\x39\x9e\x04\xec\x06\x49\x5c\x35\x81\x1e\x00\x4d\x89\xbf\xf5\x7e\xf7\x2d\x1c\x00\xfd\xe0\xab\x0f\x5a\xa2\xe3\xcc\x36\xa6\x6a\x62\x52\xec\xd3\x78\x1c\x9c\xf7\xe3\x0b\x32\x78\xba\xf1\xec\x0b\xf2\x9a\x27\x4c\x68\x96\x12\x23\x89\x99\x31\x72\x96\xd3\x64\xc6\xc8\x8d\x9c\x98\x7b\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\x1b\x37\xf6\x28\xf8\xbf\x3f\x05\x4a\x49\x5d\x49\x13\x91\xb2\x33\x73\x53\xbf\xf1\x4e\xdd\x94\x46\x92\x13\x6d\x6c\x99\x65\x29\xc9\x4d\x39\x9e\x04\xec\x06\x49\x5c\x35\x81\x1e\x00\x4d\x89\xbf\xf5\x7e\xf7\x2d\x1c\x00\xfd\xe0\xab\x0f\x5a\xa2\xe3\xcc\x36\xa6\x6a\x62\x52\xec\xd3\x78\x1c\x9c\xf7\xe3\x0b\x32\x78\xba\xf1\xec\x0b\xf2\x9a\x27\x4c\x68\x96\x12\x23\x89\x99\x31\x72\x96\xd3\x64\xc6\xc8\x8d\x9c\x98\x7b\x [...]
 		},
 		"/crd/bases/camel.apache.org_kameletbindings.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_kameletbindings.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 543879,
+			uncompressedSize: 545786,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\x1b\x37\xb2\x2f\x8c\xff\xee\xbf\x02\x25\xa7\xae\xa4\x13\x92\xb2\xb3\xbb\xa9\xb3\xfe\x6e\xdd\x94\x56\x96\x13\x7d\x63\xcb\x2c\x4b\x71\x6e\xca\xc9\x49\xc0\x19\x90\xc4\xd5\x10\x98\x05\x30\x94\xb8\x8f\x9f\xff\xfd\x29\x34\x80\x79\xe1\x9b\xd0\x43\x51\x51\x36\x83\x53\x75\x36\x92\x35\x3d\x18\x00\xdd\xe8\xee\x4f\xbf\x3c\x27\xfd\x87\x1b\xcf\x9e\x93\xb7\x3c\x61\x42\xb3\x94\x18\x49\xcc\x94\x91\xd3\x9c\x26\x53\x46\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\x1b\x37\xb2\x2f\x8c\xff\xee\xbf\x02\x25\xa7\xae\xa4\x13\x92\xb2\xb3\xbb\xa9\xb3\xfe\x6e\xdd\x94\x56\x96\x13\x7d\x63\xcb\x2c\x4b\x71\x6e\xca\xc9\x49\xc0\x19\x90\xc4\xd5\x10\x98\x05\x30\x94\xb8\x8f\x9f\xff\xfd\x29\x34\x80\x79\xe1\x9b\xd0\x43\x51\x51\x36\x83\x53\x75\x36\x92\x35\x3d\x18\x00\xdd\xe8\xee\x4f\xbf\x3c\x27\xfd\x87\x1b\xcf\x9e\x93\xb7\x3c\x61\x42\xb3\x94\x18\x49\xcc\x94\x91\xd3\x9c\x26\x53\x46\x [...]
 		},
 		"/crd/bases/camel.apache.org_kamelets.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "camel.apache.org_kamelets.yaml",
@@ -420,9 +420,9 @@ var assets = func() http.FileSystem {
 		"/rbac/operator-role.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "operator-role.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 2928,
+			uncompressedSize: 2952,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x56\xc1\x6e\xe3\x36\x10\xbd\xeb\x2b\x06\xd6\x65\x17\x88\xed\xb6\xa7\xc2\x3d\xb9\xbb\x49\x6b\x74\x61\x03\x91\xb7\x8b\x3d\x8e\xc8\xb1\x3c\x35\xc5\x61\x49\x2a\x8e\xfb\xf5\x05\x65\x29\x76\x22\x3b\x28\xba\x8b\x6e\x7d\x09\x45\x4e\xde\xbc\x79\xef\x51\x50\x0e\xe3\xaf\xf7\xcb\x72\xf8\xc0\x8a\x6c\x20\x0d\x51\x20\x6e\x09\xe6\x0e\xd5\x96\xa0\x90\x4d\xdc\xa3\x27\xb8\x93\xc6\x6a\x8c\x2c\x16\xde\xcc\x8b\xbb\xb7\xd0\x58\x4d\x1e\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x56\xc1\x6e\xdb\x46\x10\xbd\xf3\x2b\x06\xe2\x25\x01\x2c\xa9\xed\xa9\x50\x4f\x6a\x62\xb7\x42\x03\x09\xb0\x94\x06\x39\x0e\x97\x23\x6a\xaa\xe5\xce\x76\x76\x69\x59\xfd\xfa\x62\x29\x32\x92\x4d\x2b\x28\x9a\xa0\xa9\x2e\x5e\xee\x8e\xdf\xbc\x79\xef\x2d\xc1\x1c\xc6\x5f\xef\x97\xe5\xf0\x8e\x0d\xb9\x40\x25\x44\x81\xb8\x23\x98\x7b\x34\x3b\x82\xb5\x6c\xe3\x01\x95\xe0\x4e\x1a\x57\x62\x64\x71\xf0\x6a\xbe\xbe\x7b\x0d\x8d\x2b\x49\x [...]
 		},
 		"/rbac/patch-role-to-clusterrole.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "patch-role-to-clusterrole.yaml",
@@ -604,9 +604,9 @@ var assets = func() http.FileSystem {
 		"/traits.yaml": &vfsgen۰CompressedFileInfo{
 			name:             "traits.yaml",
 			modTime:          time.Time{},
-			uncompressedSize: 51862,
+			uncompressedSize: 53036,
 
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\xfb\x73\x1b\xb9\xd1\xe0\xef\xfb\x57\xa0\x94\xab\xb2\xa4\x22\x29\xef\xe6\x4b\xb2\xa7\xbb\xfd\x72\x5a\xdb\x9b\x68\xd7\x0f\x9d\xa5\xdd\x7c\x29\x9f\x2b\x04\x67\x9a\x24\xcc\x21\x30\x01\x30\x92\x99\xcb\xfd\xef\x57\xe8\x6e\x3c\x86\x0f\x89\xb2\xad\xbd\xe8\xea\xcb\x56\xc5\x22\x39\x03\x34\x1a\xdd\x8d\x7e\xc3\x5b\xa9\xbc\x3b\xfd\x6a\x28\xb4\x5c\xc2\xa9\xf8\xad\xab\x64\x03\x5f\x09\xd1\x36\xd2\x4f\x8d\x5d\x9e\x8a\xa9\x6c\x [...]
+			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\x1b\xb9\xb5\x20\xfe\xff\x7c\x0a\x94\xee\xef\x96\x25\x17\x49\x79\x26\x77\x72\xe7\xa7\xdd\xb9\x59\x8d\xed\x49\x34\xe3\x87\xd6\xf2\x4c\x6e\xca\xeb\x0a\xc1\x6e\x90\x84\xd9\x04\x3a\x00\x5a\x32\xb3\xd9\xef\xbe\x85\xf3\x00\xd0\x64\x4b\xa2\x6c\x6b\x36\xda\xda\x4c\x55\x2c\x92\xdd\xc0\xc1\xc1\x39\x07\xe7\x8d\xe0\xa4\x0e\xfe\xe4\xab\xb1\x30\x72\xad\x4e\xc4\xef\x7c\x25\x1b\xf5\x95\x10\x6d\x23\xc3\xdc\xba\xf5\x89\x [...]
 		},
 	}
 	fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index fff4aff9d..aac72c4d6 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -27,6 +27,7 @@ import (
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 	traitv1 "github.com/apache/camel-k/pkg/apis/camel/v1/trait"
 	"github.com/apache/camel-k/pkg/builder"
+	"github.com/apache/camel-k/pkg/util/defaults"
 	mvn "github.com/apache/camel-k/pkg/util/maven"
 	"github.com/apache/camel-k/pkg/util/property"
 )
@@ -104,7 +105,13 @@ func (t *builderTrait) Apply(e *Environment) error {
 		} else {
 			t.L.Infof("User defined %s platform, will be used from buildah!", platform)
 		}
-
+		var buildahImage string
+		if image, found := e.Platform.Status.Build.PublishStrategyOptions[builder.KanikoExecutorImage]; found {
+			buildahImage = image
+			t.L.Infof("User defined image %s will be used for buildah", image)
+		} else {
+			buildahImage = fmt.Sprintf("%s:v%s", builder.BuildahDefaultImage, defaults.BuildahVersion)
+		}
 		e.BuildTasks = append(e.BuildTasks, v1.Task{Buildah: &v1.BuildahTask{
 			Platform: platform,
 			BaseTask: v1.BaseTask{
@@ -115,6 +122,7 @@ func (t *builderTrait) Apply(e *Environment) error {
 				Registry: e.Platform.Status.Build.Registry,
 			},
 			Verbose: t.Verbose,
+			Image:   buildahImage,
 		}})
 	// nolint: staticcheck
 	case v1.IntegrationPlatformBuildPublishStrategyKaniko:
@@ -129,6 +137,14 @@ func (t *builderTrait) Apply(e *Environment) error {
 			cacheEnabled = *e.Platform.Status.Build.KanikoBuildCache
 		}
 
+		var kanikoImage string
+		if image, found := e.Platform.Status.Build.PublishStrategyOptions[builder.KanikoExecutorImage]; found {
+			kanikoImage = image
+			t.L.Infof("User defined executor image %s will be used for kaniko", image)
+		} else {
+			kanikoImage = fmt.Sprintf("%s:v%s", builder.KanikoDefaultExecutorImage, defaults.KanikoVersion)
+		}
+
 		e.BuildTasks = append(e.BuildTasks, v1.Task{Kaniko: &v1.KanikoTask{
 			BaseTask: v1.BaseTask{
 				Name: "kaniko",
@@ -142,6 +158,7 @@ func (t *builderTrait) Apply(e *Environment) error {
 				PersistentVolumeClaim: persistentVolumeClaim,
 			},
 			Verbose: t.Verbose,
+			Image:   kanikoImage,
 		}})
 	}