Documentation
¶
Index ¶
- Constants
- func ApplyLabel(ms *models.Microservice, env []string) (string, error)
- 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 EnvHashFromLabel(label string) (string, bool)
- func HasEnvHash(label string) bool
- func HashEnv(env []string) string
- func KnowledgeCatalogBind(ms *models.Microservice, diskDir string) (host, container string, readOnly bool, ok bool)
- 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 ApplyLabel ¶
func ApplyLabel(ms *models.Microservice, env []string) (string, error)
ApplyLabel is the create-time apply label, including the environment digest.
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 EnvHashFromLabel ¶
EnvHashFromLabel returns the stored environment digest when the label has one.
func HasEnvHash ¶
HasEnvHash reports whether the apply label includes an environment digest.
func KnowledgeCatalogBind ¶
func KnowledgeCatalogBind(ms *models.Microservice, diskDir string) (host, container string, readOnly bool, ok bool)
KnowledgeCatalogBind is the single parent knowledge catalog mount (host projection → bindPath).
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). An environment digest on the label is ignored here; callers compare that separately.
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"`
KnowledgeBindPath string `json:"knowledgeBindPath,omitempty"`
KnowledgePermissions string `json:"knowledgePermissions,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"`
// EnvHash is the applied environment snapshot. It is written on create so a
// later compare can use labels instead of the OCI spec. A missing hash is
// not a recreate reason.
EnvHash string `json:"envHash,omitempty"`
}
Fingerprint is the recreate-relevant apply snapshot. Catalog item membership is omitted so add/remove of models or knowledge 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.