|
1 | 1 | package kaniko |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "path/filepath" |
| 5 | + |
4 | 6 | "github.com/loft-sh/devspace/pkg/devspace/build/builder/kaniko/util" |
5 | 7 | devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context" |
6 | | - "path/filepath" |
7 | 8 |
|
8 | 9 | "github.com/docker/distribution/reference" |
9 | 10 | jsonyaml "github.com/ghodss/yaml" |
@@ -38,6 +39,9 @@ const devspaceQuota = "devspace-quota" |
38 | 39 | // DevspaceLimitRange is the limit range name of the space limit range in the devspace cloud |
39 | 40 | const devspaceLimitRange = "devspace-limit-range" |
40 | 41 |
|
| 42 | +// The generateName string for the kaniko pod that we use by default |
| 43 | +const podGenerateName = "devspace-build-kaniko-" |
| 44 | + |
41 | 45 | type availableResources struct { |
42 | 46 | CPU resource.Quantity |
43 | 47 | Memory resource.Quantity |
@@ -74,6 +78,11 @@ func (b *Builder) getBuildPod(ctx devspacecontext.Context, buildID string, optio |
74 | 78 | kanikoInitImage = kanikoOptions.InitImage |
75 | 79 | } |
76 | 80 |
|
| 81 | + kanikoPodGenerateName := podGenerateName |
| 82 | + if kanikoOptions.GenerateName != "" { |
| 83 | + kanikoPodGenerateName = kanikoOptions.GenerateName |
| 84 | + } |
| 85 | + |
77 | 86 | // additional options to pass to kaniko |
78 | 87 | kanikoArgs := []string{ |
79 | 88 | "--dockerfile=" + kanikoContextPath + "/" + filepath.Base(dockerfilePath), |
@@ -213,7 +222,7 @@ func (b *Builder) getBuildPod(ctx devspacecontext.Context, buildID string, optio |
213 | 222 | // create the build pod |
214 | 223 | pod := &k8sv1.Pod{ |
215 | 224 | ObjectMeta: metav1.ObjectMeta{ |
216 | | - GenerateName: "devspace-build-kaniko-", |
| 225 | + GenerateName: kanikoPodGenerateName, |
217 | 226 | Annotations: map[string]string{}, |
218 | 227 | Labels: map[string]string{ |
219 | 228 | "devspace-build": "true", |
|
0 commit comments