containerapply

package
v1.1.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: EPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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 CPUQuota

func CPUQuota(cpus float64) int64

CPUQuota converts a CPU count to CFS quota with period CPUCFSPeriod.

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

func DockerUser(runAsUser, runAsGroup *string) string

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 NanoCPUs

func NanoCPUs(cpus float64) int64

NanoCPUs converts a CPU count to Docker NanoCPUs (1e9 per CPU).

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

func ShmHostDir(diskDir, msUUID string) string

ShmHostDir is the host directory used for a sized CRI /dev/shm bind.

func TmpfsHostDir

func TmpfsHostDir(diskDir, msUUID, containerPath string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL