From 6f5fe9ea9572b5570b1ddab1b8d08cb1308f9aaa Mon Sep 17 00:00:00 2001 From: dherges Date: Sat, 21 Dec 2024 13:58:39 +0100 Subject: [PATCH] feat: pull kaniko images from private registry w/ pull secret --- pkg/skaffold/build/cluster/pod.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/skaffold/build/cluster/pod.go b/pkg/skaffold/build/cluster/pod.go index 1932d7e890c..75d329dd2f3 100644 --- a/pkg/skaffold/build/cluster/pod.go +++ b/pkg/skaffold/build/cluster/pod.go @@ -95,6 +95,13 @@ func (b *Builder) kanikoPodSpec(artifact *latest.KanikoArtifact, tag string, pla addSecretVolume(pod, kaniko.DefaultSecretName, b.ClusterDetails.PullSecretMountPath, b.ClusterDetails.PullSecretName) } + // Add secret for pulling kaniko images from a private registry + if artifact.ImagePullSecret != "" { + pod.Spec.ImagePullSecrets = []v1.LocalObjectReference{{ + Name: artifact.ImagePullSecret, + }} + } + // Add host path volume for cache if artifact.Cache != nil && artifact.Cache.HostPath != "" { addHostPathVolume(pod, kaniko.DefaultCacheDirName, kaniko.DefaultCacheDirMountPath, artifact.Cache.HostPath)