Skip to content

Commit 2879cc4

Browse files
author
Samuel Archambault
committed
Rename properly + move volume path and name to const
Signed-off-by: Samuel Archambault <[email protected]>
1 parent fdefda2 commit 2879cc4

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

driver/kubernetes/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (f *factory) processDriverOpts(deploymentName string, namespace string, cfg
288288
}
289289
case "buildkit-root-volume-memory":
290290
if v != "" {
291-
deploymentOpt.BuildKitRootFolderMemory = v
291+
deploymentOpt.BuildKitRootVolumeMemory = v
292292
}
293293
case "default-load":
294294
defaultLoad, err = strconv.ParseBool(v)

driver/kubernetes/manifest/manifest.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type DeploymentOpt struct {
3232
// files mounted at /etc/buildkitd
3333
ConfigFiles map[string][]byte
3434

35-
BuildKitRootFolderMemory string
35+
BuildKitRootVolumeMemory string
3636
Rootless bool
3737
NodeSelector map[string]string
3838
CustomAnnotations map[string]string
@@ -51,7 +51,8 @@ const (
5151
containerName = "buildkitd"
5252
AnnotationPlatform = "buildx.docker.com/platform"
5353
LabelApp = "app"
54-
rootVolumeName = "buildkit-root"
54+
rootVolumeName = "buildkit-memory"
55+
rootVolumePath = "/var/lib/buildkit"
5556
)
5657

5758
type ErrReservedAnnotationPlatform struct{}
@@ -249,23 +250,23 @@ func NewDeployment(opt *DeploymentOpt) (d *appsv1.Deployment, c []*corev1.Config
249250
d.Spec.Template.Spec.Containers[0].Resources.Limits[corev1.ResourceEphemeralStorage] = limEphemeralStorage
250251
}
251252

252-
if opt.BuildKitRootFolderMemory != "" {
253-
buildKitRootFolderMemory, err := resource.ParseQuantity(opt.BuildKitRootFolderMemory)
253+
if opt.BuildKitRootVolumeMemory != "" {
254+
buildKitRootVolumeMemory, err := resource.ParseQuantity(opt.BuildKitRootVolumeMemory)
254255
if err != nil {
255256
return nil, nil, err
256257
}
257258
d.Spec.Template.Spec.Volumes = append(d.Spec.Template.Spec.Volumes, corev1.Volume{
258-
Name: "buildkit-memory",
259+
Name: rootVolumeName,
259260
VolumeSource: corev1.VolumeSource{
260261
EmptyDir: &corev1.EmptyDirVolumeSource{
261262
Medium: "Memory",
262-
SizeLimit: &buildKitRootFolderMemory,
263+
SizeLimit: &buildKitRootVolumeMemory,
263264
},
264265
},
265266
})
266267
d.Spec.Template.Spec.Containers[0].VolumeMounts = append(d.Spec.Template.Spec.Containers[0].VolumeMounts, corev1.VolumeMount{
267-
Name: "buildkit-memory",
268-
MountPath: "/var/lib/buildkit",
268+
Name: rootVolumeName,
269+
MountPath: rootVolumePath,
269270
})
270271
}
271272

0 commit comments

Comments
 (0)