Documentation
¶
Index ¶
- Constants
- func CPUQuota(cpus float64) int64
- func CatalogBind(ms *models.Microservice, diskDir string) (host, container string, readOnly bool, ok bool)
- func CommandArgs(ms *models.Microservice) []string
- func DockerTmpfsOptions(t models.TmpfsMount) string
- func DockerUser(runAsUser, runAsGroup *string) string
- func Marshal(fp Fingerprint) (string, error)
- func MatchesLabel(label string, ms *models.Microservice) bool
- func NanoCPUs(cpus float64) int64
- func POSIXRlimits(ulimits map[string]models.Ulimit) []specs.POSIXRlimit
- func ShmHostDir(diskDir, msUUID string) string
- func TmpfsHostDir(diskDir, msUUID, containerPath string) string
- type Fingerprint
Constants ¶
const ( // LabelFingerprint is stored on the container so spec drift recreates it. LabelFingerprint = "iofog-container-apply" // CPUCFSPeriod is the CFS period (100ms) used with CPU quota. CPUCFSPeriod int64 = 100000 )
Variables ¶
This section is empty.
Functions ¶
func CatalogBind ¶
func CatalogBind(ms *models.Microservice, diskDir string) (host, container string, readOnly bool, ok bool)
CatalogBind is the single parent catalog mount (host projection → bindPath).
func CommandArgs ¶
func CommandArgs(ms *models.Microservice) []string
CommandArgs is the engine command list, or nil to leave the image default.
func DockerTmpfsOptions ¶
func DockerTmpfsOptions(t models.TmpfsMount) string
DockerTmpfsOptions formats tmpfs size (MiB) and mode for HostConfig.Tmpfs.
func DockerUser ¶
DockerUser is Config.User. Group is appended as uid:gid only when both are set and runAsUser does not already contain ':'.
func Marshal ¶
func Marshal(fp Fingerprint) (string, error)
Marshal encodes the fingerprint as a compact JSON label value.
func MatchesLabel ¶
func MatchesLabel(label string, ms *models.Microservice) bool
MatchesLabel reports whether the stored fingerprint matches the microservice. A missing label matches only when the spec has no apply fields (legacy containers).
func POSIXRlimits ¶
func POSIXRlimits(ulimits map[string]models.Ulimit) []specs.POSIXRlimit
POSIXRlimits maps ulimit names to OCI rlimits. -1 becomes unlimited (max uint64).
func ShmHostDir ¶
ShmHostDir is the host directory used for a sized CRI /dev/shm bind.
func TmpfsHostDir ¶
TmpfsHostDir is the host directory used for a CRI tmpfs bind.
Types ¶
type Fingerprint ¶
type Fingerprint struct {
BindPath string `json:"bindPath,omitempty"`
Permissions string `json:"permissions,omitempty"`
Entrypoint []string `json:"entrypoint,omitempty"`
Commands []string `json:"commands,omitempty"`
WorkingDir string `json:"workingDir,omitempty"`
RunAsGroup string `json:"runAsGroup,omitempty"`
ReadOnlyRoot bool `json:"readOnlyRoot,omitempty"`
Tmpfs []models.TmpfsMount `json:"tmpfs,omitempty"`
ShmSize *int64 `json:"shmSize,omitempty"`
Cpus *float64 `json:"cpus,omitempty"`
MemoryReservation *int64 `json:"memoryReservation,omitempty"`
MemorySwap *int64 `json:"memorySwap,omitempty"`
Sysctls map[string]string `json:"sysctls,omitempty"`
Ulimits map[string]models.Ulimit `json:"ulimits,omitempty"`
Devices []models.DeviceMapping `json:"devices,omitempty"`
}
Fingerprint is the recreate-relevant apply snapshot. Catalog item membership is omitted so add/remove of models stays in-place when bindPath and permissions are unchanged.
func FromMicroservice ¶
func FromMicroservice(ms *models.Microservice) Fingerprint
FromMicroservice builds the apply fingerprint for a microservice.
func (Fingerprint) Empty ¶
func (f Fingerprint) Empty() bool
Empty reports whether no recreate-relevant apply fields are set.