Documentation
¶
Index ¶
- Constants
- Variables
- func AppendSubPaths(paths *searchPaths, path string, isUserFlag bool, ...)
- func ConvertBuild(build *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, isUser bool) (*parser.UnitFile, error, error)
- func ConvertContainer(container *parser.UnitFile, isUser bool, unitsInfoMap map[string]*UnitInfo) (*parser.UnitFile, error, error)
- func ConvertImage(image *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, isUser bool) (*parser.UnitFile, error)
- func ConvertKube(kube *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, isUser bool) (*parser.UnitFile, error)
- func ConvertNetwork(network *parser.UnitFile, name string, unitsInfoMap map[string]*UnitInfo, ...) (*parser.UnitFile, error, error)
- func ConvertPod(podUnit *parser.UnitFile, name string, unitsInfoMap map[string]*UnitInfo, ...) (*parser.UnitFile, error, error)
- func ConvertVolume(volume *parser.UnitFile, name string, unitsInfoMap map[string]*UnitInfo, ...) (*parser.UnitFile, error, error)
- func GetBuildServiceName(podUnit *parser.UnitFile) string
- func GetBuiltImageName(buildUnit *parser.UnitFile) string
- func GetContainerResourceName(container *parser.UnitFile) string
- func GetContainerServiceName(podUnit *parser.UnitFile) string
- func GetImageServiceName(podUnit *parser.UnitFile) string
- func GetInstallUnitDirPath(rootless bool) string
- func GetKubeServiceName(podUnit *parser.UnitFile) string
- func GetNetworkServiceName(podUnit *parser.UnitFile) string
- func GetNonNumericFilter(resolvedUnitDirAdminUser string, systemUserDirLevel int) func(string, bool) bool
- func GetPodResourceName(podUnit *parser.UnitFile) string
- func GetPodServiceName(podUnit *parser.UnitFile) string
- func GetUnitDirs(rootless bool) []string
- func GetUnitServiceName(unit *parser.UnitFile) (string, error)
- func GetUserLevelFilter(resolvedUnitDirAdminUser string) func(string, bool) bool
- func GetVolumeServiceName(podUnit *parser.UnitFile) string
- func IsExtSupported(filename string) bool
- func NewSearchPaths() *searchPaths
- func ResolveUnitDirAdminUser() string
- type GroupInfo
- type PodmanCmdline
- type UnitInfo
Constants ¶
const ( // Directory for temporary Quadlet files (sysadmin owned) UnitDirTemp = "/run/containers/systemd" // Directory for global Quadlet files (sysadmin owned) UnitDirAdmin = "/etc/containers/systemd" // Directory for global Quadlet files (distro owned) UnitDirDistro = "/usr/share/containers/systemd" // Names of commonly used systemd/quadlet group names ContainerGroup = "Container" InstallGroup = "Install" KubeGroup = "Kube" NetworkGroup = "Network" PodGroup = "Pod" ServiceGroup = "Service" UnitGroup = "Unit" VolumeGroup = "Volume" ImageGroup = "Image" BuildGroup = "Build" QuadletGroup = "Quadlet" XContainerGroup = "X-Container" XKubeGroup = "X-Kube" XNetworkGroup = "X-Network" XPodGroup = "X-Pod" XVolumeGroup = "X-Volume" XImageGroup = "X-Image" XBuildGroup = "X-Build" XQuadletGroup = "X-Quadlet" )
const ( KeyAddCapability = "AddCapability" KeyAddDevice = "AddDevice" KeyAddHost = "AddHost" KeyAllTags = "AllTags" KeyAnnotation = "Annotation" KeyArch = "Arch" KeyAuthFile = "AuthFile" KeyAutoUpdate = "AutoUpdate" KeyCertDir = "CertDir" KeyCgroupsMode = "CgroupsMode" KeyConfigMap = "ConfigMap" KeyContainerName = "ContainerName" KeyContainersConfModule = "ContainersConfModule" KeyCopy = "Copy" KeyCreds = "Creds" KeyDecryptionKey = "DecryptionKey" KeyDefaultDependencies = "DefaultDependencies" KeyDevice = "Device" KeyDisableDNS = "DisableDNS" KeyDNS = "DNS" KeyDNSOption = "DNSOption" KeyDNSSearch = "DNSSearch" KeyDriver = "Driver" KeyDropCapability = "DropCapability" KeyEntrypoint = "Entrypoint" KeyEnvironment = "Environment" KeyEnvironmentFile = "EnvironmentFile" KeyEnvironmentHost = "EnvironmentHost" KeyExec = "Exec" KeyExitCodePropagation = "ExitCodePropagation" KeyExitPolicy = "ExitPolicy" KeyExposeHostPort = "ExposeHostPort" KeyFile = "File" KeyForceRM = "ForceRM" KeyGateway = "Gateway" KeyGIDMap = "GIDMap" KeyGlobalArgs = "GlobalArgs" KeyGroup = "Group" KeyGroupAdd = "GroupAdd" KeyHealthCmd = "HealthCmd" KeyHealthInterval = "HealthInterval" KeyHealthLogDestination = "HealthLogDestination" KeyHealthMaxLogCount = "HealthMaxLogCount" KeyHealthMaxLogSize = "HealthMaxLogSize" KeyHealthOnFailure = "HealthOnFailure" KeyHealthRetries = "HealthRetries" KeyHealthStartPeriod = "HealthStartPeriod" KeyHealthStartupCmd = "HealthStartupCmd" KeyHealthStartupInterval = "HealthStartupInterval" KeyHealthStartupRetries = "HealthStartupRetries" KeyHealthStartupSuccess = "HealthStartupSuccess" KeyHealthStartupTimeout = "HealthStartupTimeout" KeyHealthTimeout = "HealthTimeout" KeyHostName = "HostName" KeyImage = "Image" KeyImageTag = "ImageTag" KeyInterfaceName = "InterfaceName" KeyInternal = "Internal" KeyIP = "IP" KeyIP6 = "IP6" KeyIPAMDriver = "IPAMDriver" KeyIPRange = "IPRange" KeyIPv6 = "IPv6" KeyKubeDownForce = "KubeDownForce" KeyLabel = "Label" KeyLogDriver = "LogDriver" KeyLogOpt = "LogOpt" KeyMask = "Mask" KeyMemory = "Memory" KeyMount = "Mount" KeyNetwork = "Network" KeyNetworkAlias = "NetworkAlias" KeyNetworkDeleteOnStop = "NetworkDeleteOnStop" KeyNetworkName = "NetworkName" KeyNoNewPrivileges = "NoNewPrivileges" KeyNotify = "Notify" KeyOptions = "Options" KeyOS = "OS" KeyPidsLimit = "PidsLimit" KeyPod = "Pod" KeyPodmanArgs = "PodmanArgs" KeyPodName = "PodName" KeyPolicy = "Policy" KeyPublishPort = "PublishPort" KeyPull = "Pull" KeyReadOnly = "ReadOnly" KeyReadOnlyTmpfs = "ReadOnlyTmpfs" KeyReloadCmd = "ReloadCmd" KeyReloadSignal = "ReloadSignal" KeyRemapGid = "RemapGid" // deprecated KeyRemapUid = "RemapUid" // deprecated KeyRemapUidSize = "RemapUidSize" // deprecated KeyRemapUsers = "RemapUsers" // deprecated KeyRetry = "Retry" KeyRetryDelay = "RetryDelay" KeyRootfs = "Rootfs" KeyRunInit = "RunInit" KeySeccompProfile = "SeccompProfile" KeySecret = "Secret" KeySecurityLabelDisable = "SecurityLabelDisable" KeySecurityLabelFileType = "SecurityLabelFileType" KeySecurityLabelLevel = "SecurityLabelLevel" KeySecurityLabelNested = "SecurityLabelNested" KeySecurityLabelType = "SecurityLabelType" KeyServiceName = "ServiceName" KeySetWorkingDirectory = "SetWorkingDirectory" KeyShmSize = "ShmSize" KeyStartWithPod = "StartWithPod" KeyStopSignal = "StopSignal" KeyStopTimeout = "StopTimeout" KeySubGIDMap = "SubGIDMap" KeySubnet = "Subnet" KeySubUIDMap = "SubUIDMap" KeySysctl = "Sysctl" KeyTarget = "Target" KeyTimezone = "Timezone" KeyTLSVerify = "TLSVerify" KeyTmpfs = "Tmpfs" KeyType = "Type" KeyUIDMap = "UIDMap" KeyUlimit = "Ulimit" KeyUnmask = "Unmask" KeyUser = "User" KeyUserNS = "UserNS" KeyVariant = "Variant" KeyVolatileTmp = "VolatileTmp" // deprecated KeyVolume = "Volume" KeyVolumeName = "VolumeName" KeyWorkingDir = "WorkingDir" KeyYaml = "Yaml" )
All the supported quadlet keys
const (
ServiceKeyWorkingDirectory = "WorkingDirectory"
)
Systemd Unit file keys
Variables ¶
var ( // Key: Extension // Value: Processing order for resource naming dependencies SupportedExtensions = map[string]int{ ".container": 4, ".volume": 2, ".kube": 4, ".network": 2, ".image": 1, ".build": 3, ".pod": 5, } )
var (
URL = regexp.Delayed(`^((https?)|(git)://)|(github\.com/).+$`)
)
var UnsupportedServiceKeys = [...]string{"User", "Group", "DynamicUser"}
Unsupported keys in the Service group. Defined here so we can error when they are found
Functions ¶
func AppendSubPaths ¶ added in v5.6.0
func ConvertBuild ¶ added in v5.2.0
func ConvertContainer ¶
func ConvertContainer(container *parser.UnitFile, isUser bool, unitsInfoMap map[string]*UnitInfo) (*parser.UnitFile, error, error)
Convert a quadlet container file (unit file with a Container group) to a systemd service file (unit file with Service group) based on the options in the Container group. The original Container group is kept around as X-Container.
func ConvertImage ¶
func ConvertKube ¶
func ConvertNetwork ¶
func ConvertNetwork(network *parser.UnitFile, name string, unitsInfoMap map[string]*UnitInfo, isUser bool) (*parser.UnitFile, error, error)
Convert a quadlet network file (unit file with a Network group) to a systemd service file (unit file with Service group) based on the options in the Network group. The original Network group is kept around as X-Network. Also returns the canonical network name, either auto-generated or user-defined via the NetworkName key-value.
func ConvertPod ¶
func ConvertVolume ¶
func ConvertVolume(volume *parser.UnitFile, name string, unitsInfoMap map[string]*UnitInfo, isUser bool) (*parser.UnitFile, error, error)
Convert a quadlet volume file (unit file with a Volume group) to a systemd service file (unit file with Service group) based on the options in the Volume group. The original Volume group is kept around as X-Volume. Also returns the canonical volume name, either auto-generated or user-defined via the VolumeName key-value.
func GetBuildServiceName ¶ added in v5.3.0
func GetBuiltImageName ¶ added in v5.2.0
func GetContainerResourceName ¶ added in v5.4.0
Get the resolved container name that contains no '%'. Returns an empty string if not resolvable.
func GetContainerServiceName ¶ added in v5.3.0
func GetImageServiceName ¶ added in v5.3.0
func GetInstallUnitDirPath ¶ added in v5.6.0
This returns default install paths for .Quadlet files for `rootless` and `root` user. Defaults to `/etc/containers/systemd` for root user and `$XDG_CONFIG_HOME/containers/systemd` for rootless users.
func GetKubeServiceName ¶ added in v5.3.0
func GetNetworkServiceName ¶ added in v5.3.0
func GetNonNumericFilter ¶ added in v5.6.0
func GetPodResourceName ¶ added in v5.6.0
func GetPodServiceName ¶
func GetUnitDirs ¶ added in v5.6.0
This returns the directories where we read quadlet .container and .volumes from For system generators these are in /usr/share/containers/systemd (for distro files) and /etc/containers/systemd (for sysadmin files). For user generators these can live in $XDG_RUNTIME_DIR/containers/systemd, /etc/containers/systemd/users, /etc/containers/systemd/users/$UID, and $XDG_CONFIG_HOME/containers/systemd
func GetUnitServiceName ¶ added in v5.6.0
func GetUserLevelFilter ¶ added in v5.6.0
func GetVolumeServiceName ¶ added in v5.3.0
func IsExtSupported ¶ added in v5.6.0
This returns whether a file has an extension recognized as a valid Quadlet unit type.
func NewSearchPaths ¶ added in v5.6.0
func NewSearchPaths() *searchPaths
func ResolveUnitDirAdminUser ¶ added in v5.6.0
func ResolveUnitDirAdminUser() string
Types ¶
type PodmanCmdline ¶
type PodmanCmdline struct {
Args []string
}
This is a helper for constructing podman commandlines
func NewPodmanCmdline ¶
func NewPodmanCmdline(args ...string) *PodmanCmdline
type UnitInfo ¶ added in v5.3.0
type UnitInfo struct {
// The name of the generated systemd service unit
ServiceName string
// The name of the podman resource created by the service
ResourceName string
// For .pod units
// List of containers to start with the pod
ContainersToStart []string
}