Skip to content

Commit 00012e3

Browse files
authored
Merge pull request #28385 from SIMVIA-lucas-sovre/main
Fixes: #27620 replace dots by hyphens in kubectl volume names generation
2 parents d0e0571 + d2ff809 commit 00012e3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

libpod/kube.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func (v *Volume) GenerateForKube() *v1.PersistentVolumeClaim {
315315
APIVersion: "v1",
316316
},
317317
ObjectMeta: v12.ObjectMeta{
318-
Name: v.Name(),
318+
Name: fixKubeVolumeName(v.Name()),
319319
Labels: v.Labels(),
320320
Annotations: annotations,
321321
CreationTimestamp: v12.Now(),
@@ -1260,7 +1260,7 @@ func fixKubeVolumeName(source string) string {
12601260
// Replace underscores with dashes.
12611261
// Force all letters to lower case
12621262
// Thus, /mnt/data/ will become mnt-data
1263-
return strings.ToLower(strings.ReplaceAll(strings.ReplaceAll(strings.Trim(source, "/"), "/", "-"), "_", "-"))
1263+
return strings.ToLower(strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(strings.Trim(source, "/"), "/", "-"), ".", "-"), "_", "-"))
12641264
}
12651265

12661266
func convertVolumePathToName(hostSourcePath string) (string, error) {

0 commit comments

Comments
 (0)