Quadlet - Allow the user to set the service name for .pod files

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
This commit is contained in:
Ygal Blum
2024-07-29 11:52:23 +03:00
parent 1c4fbe7965
commit f3a86266e6
3 changed files with 19 additions and 0 deletions

View File

@@ -143,6 +143,7 @@ const (
KeySecurityLabelLevel = "SecurityLabelLevel"
KeySecurityLabelNested = "SecurityLabelNested"
KeySecurityLabelType = "SecurityLabelType"
KeyServiceName = "ServiceName"
KeySetWorkingDirectory = "SetWorkingDirectory"
KeyShmSize = "ShmSize"
KeyStopSignal = "StopSignal"
@@ -373,6 +374,7 @@ var (
KeyPodName: true,
KeyPodmanArgs: true,
KeyPublishPort: true,
KeyServiceName: true,
KeyVolume: true,
}
)
@@ -1474,6 +1476,9 @@ func GetBuiltImageName(buildUnit *parser.UnitFile) string {
}
func GetPodServiceName(podUnit *parser.UnitFile) string {
if serviceName, ok := podUnit.Lookup(PodGroup, KeyServiceName); ok {
return serviceName
}
return replaceExtension(podUnit.Filename, "", "", "-pod")
}